Skip to content

Commit

Permalink
submit prompt to Claude
Browse files Browse the repository at this point in the history
  • Loading branch information
bc-devrev committed Jan 9, 2025
1 parent 159b0e6 commit 8e71b87
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion changelog.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import yaml
import argparse
import glob
import requests
import os
import datetime
import re


def main(vrn, d):

Expand All @@ -15,6 +17,35 @@ def main(vrn, d):
outfile.write(p)
print(f"Wrote prompt to {pr_file}.")

l = f"# {d}\n\n"
l += gen_log(p)

log_file = f"./fern/apis/{vrn}/{d}.md"
with open(log_file, 'w', encoding="utf-8") as outfile:
outfile.write(l)
print(f"Wrote log to {log_file}.")


def gen_log(prompt):

auth = os.environ.get('LLM_JWT')
headers = {"Content-Type": "application/json", "Authorization": f"Bearer {auth}"}
payload = {
"model": "us.anthropic.claude-3-5-sonnet-20241022-v2:0",
"messages": [
{
"role": "user",
"content": prompt
}
]
}

r = requests.post('https://openwebui.dev.devrev-eng.ai/api/chat/completions', json=payload,
headers=headers)
log = r.json()['choices'][0]['message']['content']
log = re.sub(r"^Here's.*\n?", '', log, flags=re.MULTILINE)
return log


def gen_prompt(oasdiff, links):
with open(oasdiff, 'r') as infile:
Expand Down

0 comments on commit 8e71b87

Please sign in to comment.