Skip to content

Commit

Permalink
Claude endpoint update!
Browse files Browse the repository at this point in the history
  • Loading branch information
st1vms committed Feb 4, 2024
1 parent dbfb968 commit e2d1b57
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions claude2_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,11 @@ def __parse_send_message_response(self, data_bytes: bytes) -> str | None:
res = sub("\n+", "\n", res).strip()

# Get json data lines
data_lines = [search(r"\{.*\}", r).group(0) for r in res.splitlines()]
data_lines = []
for r in res.splitlines():
s = search(r"\{.*\}", r)
if s is not None:
data_lines.append(s.group(0))

if not data_lines:
# Unable to parse data
Expand Down Expand Up @@ -497,19 +501,19 @@ def send_message(
if a
]

url = f"{self.__BASE_URL}/api/append_message"
url = (
f"{self.__BASE_URL}/api/organizations/"
+ f"{self.__session.organization_id}/chat_conversations/"
+ f"{chat_id}/completion"
)

payload = dumps(
{
"completion": {
"prompt": prompt,
"timezone": self.timezone,
"model": self.model_name,
},
"organization_uuid": self.__session.organization_id,
"conversation_uuid": chat_id,
"text": prompt,
"attachments": attachments,
"files": [],
"model": self.model_name,
"prompt": prompt,
"timezone": self.timezone,
},
indent=None,
separators=(",", ":"),
Expand Down

0 comments on commit e2d1b57

Please sign in to comment.