File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 (
You can’t perform that action at this time.
0 commit comments