Skip to content

Commit

Permalink
Cleanups in schema and client
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaC215 committed Oct 5, 2024
1 parent b9422be commit 3a8561f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def ainvoke(
async with httpx.AsyncClient() as client:
response = await client.post(
f"{self.base_url}/invoke",
json=request.dict(),
json=request.model_dump(),
headers=self._headers,
timeout=self.timeout,
)
Expand Down Expand Up @@ -78,7 +78,7 @@ def invoke(
request.model = model
response = httpx.post(
f"{self.base_url}/invoke",
json=request.dict(),
json=request.model_dump(),
headers=self._headers,
timeout=self.timeout,
)
Expand Down Expand Up @@ -142,7 +142,7 @@ def stream(
with httpx.stream(
"POST",
f"{self.base_url}/stream",
json=request.dict(),
json=request.model_dump(),
headers=self._headers,
timeout=self.timeout,
) as response:
Expand Down Expand Up @@ -188,7 +188,7 @@ async def astream(
async with client.stream(
"POST",
f"{self.base_url}/stream",
json=request.dict(),
json=request.model_dump(),
headers=self._headers,
timeout=self.timeout,
) as response:
Expand All @@ -215,7 +215,7 @@ async def acreate_feedback(
async with httpx.AsyncClient() as client:
response = await client.post(
f"{self.base_url}/feedback",
json=request.dict(),
json=request.model_dump(),
headers=self._headers,
timeout=self.timeout,
)
Expand Down
4 changes: 3 additions & 1 deletion src/schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ def from_langchain(cls, message: BaseMessage) -> "ChatMessage":
def to_langchain(self) -> BaseMessage:
"""Convert the ChatMessage to a LangChain message."""
if self.original:
return messages_from_dict([self.original])[0]
raw_original = messages_from_dict([self.original])[0]
raw_original.content = self.content
return raw_original
match self.type:
case "human":
return HumanMessage(content=self.content)
Expand Down

0 comments on commit 3a8561f

Please sign in to comment.