Skip to content

Commit 098d7bf

Browse files
committed
2 parents a07fca6 + 90afeaf commit 098d7bf

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/abi/services/agent/Agent.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ def as_api(
718718

719719
class CompletionQuery(BaseModel):
720720
prompt: str = Field(..., description="The prompt to send to the agent")
721-
thread_id: str = Field(
721+
thread_id: str | int = Field(
722722
..., description="The thread ID to use for the conversation"
723723
)
724724

@@ -729,6 +729,9 @@ class CompletionQuery(BaseModel):
729729
tags=tags,
730730
)
731731
def completion(query: CompletionQuery):
732+
if isinstance(query.thread_id, int):
733+
query.thread_id = str(query.thread_id)
734+
732735
new_agent = self.duplicate()
733736
new_agent.state.set_thread_id(query.thread_id)
734737
return new_agent.invoke(query.prompt)
@@ -740,6 +743,9 @@ def completion(query: CompletionQuery):
740743
tags=tags,
741744
)
742745
async def stream_completion(query: CompletionQuery):
746+
if isinstance(query.thread_id, int):
747+
query.thread_id = str(query.thread_id)
748+
743749
new_agent = self.duplicate()
744750
new_agent.state.set_thread_id(query.thread_id)
745751
return EventSourceResponse(

0 commit comments

Comments
 (0)