Skip to content

Commit d21d90d

Browse files
Docs: Address text-davinci-003 deprecation and new API structure in NewsAgent example (#521)
* upd readme * adding shutdown endpoint part 2 * Revert "adding shutdown endpoint part 2" This reverts commit ade9b2f. * making example more concise * Update README.md --------- Co-authored-by: Aniket Maurya <[email protected]>
1 parent 145daea commit d21d90d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ class NewsAgent(ls.LitAPI):
128128
website_text = re.sub(r'<[^>]+>', ' ', requests.get(website_url).text)
129129

130130
# ask the LLM to tell you about the news
131-
llm_response = self.openai_client.Completion.create(
132-
model="text-davinci-003",
133-
prompt=f"Based on this, what is the latest: {website_text}",
131+
llm_response = self.openai_client.chat.completions.create(
132+
model="gpt-3.5-turbo",
133+
messages=[{"role": "user", "content": f"Based on this, what is the latest: {website_text}"}],
134134
)
135-
output = llm_response.choices[0].text.strip()
135+
output = llm_response.choices[0].message.content.strip()
136136
return {"output": output}
137137

138138
def encode_response(self, output):

0 commit comments

Comments
 (0)