add claude3 agent code
This commit is contained in:
@@ -534,17 +534,17 @@ class PromptAgent:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
if response.json()['error']['code'] == "context_length_exceeded":
|
# if response.json()['error']['code'] == "context_length_exceeded":
|
||||||
logger.error("Context length exceeded. Retrying with a smaller context.")
|
# logger.error("Context length exceeded. Retrying with a smaller context.")
|
||||||
payload["messages"] = payload["messages"][-1:]
|
# payload["messages"] = payload["messages"][-1:]
|
||||||
retry_response = requests.post(
|
# retry_response = requests.post(
|
||||||
"https://api.anthropic.com/v1/messages",
|
# "https://api.anthropic.com/v1/messages",
|
||||||
headers=headers,
|
# headers=headers,
|
||||||
json=payload
|
# json=payload
|
||||||
)
|
# )
|
||||||
if retry_response.status_code != 200:
|
# if retry_response.status_code != 200:
|
||||||
logger.error("Failed to call LLM: " + retry_response.text)
|
# logger.error("Failed to call LLM: " + retry_response.text)
|
||||||
return ""
|
# return ""
|
||||||
|
|
||||||
logger.error("Failed to call LLM: " + response.text)
|
logger.error("Failed to call LLM: " + response.text)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|||||||
Reference in New Issue
Block a user