Skip to content

Commit

Permalink
append messages right after request made
Browse files Browse the repository at this point in the history
  • Loading branch information
rgbkrk committed Nov 15, 2023
1 parent 06db076 commit 62af83d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions chatlab/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ async def submit(self, *messages: Union[ChatCompletionMessageParam, str], stream
temperature=kwargs.get("temperature", 0),
)

self.append(*messages)

finish_reason, function_call_request = await self.__process_stream(streaming_response)
else:
full_response = await client.chat.completions.create(
Expand All @@ -256,6 +258,8 @@ async def submit(self, *messages: Union[ChatCompletionMessageParam, str], stream
temperature=kwargs.get("temperature", 0),
)

self.append(*messages)

(
finish_reason,
function_call_request,
Expand All @@ -268,8 +272,6 @@ async def submit(self, *messages: Union[ChatCompletionMessageParam, str], stream

return

self.append(*messages)

if finish_reason == "function_call":
if function_call_request is None:
raise ValueError(
Expand Down

0 comments on commit 62af83d

Please sign in to comment.