diff --git a/fastapi_server/fake_stream_server_dashscopy.py b/fastapi_server/fake_stream_server_dashscopy.py index 59bb656..d401462 100644 --- a/fastapi_server/fake_stream_server_dashscopy.py +++ b/fastapi_server/fake_stream_server_dashscopy.py @@ -33,7 +33,7 @@ class DSApplicationCallRequest(BaseModel): messages: List[DSMessage] stream: bool = Field(default=True) # Optional overrides for pipeline behavior - thread_id: Optional[int] = Field(default=3) + thread_id: Optional[str] = Field(default="3") app = FastAPI(title="DashScope-Compatible Application API", diff --git a/fastapi_server/server_dashscope.py b/fastapi_server/server_dashscope.py index 3b6582b..deb3bfb 100644 --- a/fastapi_server/server_dashscope.py +++ b/fastapi_server/server_dashscope.py @@ -33,7 +33,7 @@ class DSApplicationCallRequest(BaseModel): messages: List[DSMessage] stream: bool = Field(default=True) # Optional overrides for pipeline behavior - thread_id: Optional[int] = Field(default=3) + thread_id: Optional[str] = Field(default="3") app = FastAPI(title="DashScope-Compatible Application API", diff --git a/fastapi_server/server_openai.py b/fastapi_server/server_openai.py index 1fa4c0d..c5283ec 100644 --- a/fastapi_server/server_openai.py +++ b/fastapi_server/server_openai.py @@ -33,7 +33,7 @@ class OpenAIChatCompletionRequest(BaseModel): temperature: Optional[float] = Field(default=1.0) max_tokens: Optional[int] = Field(default=None) # Optional overrides for pipeline behavior - thread_id: Optional[int] = Field(default=3) + thread_id: Optional[str] = Field(default='3') app = FastAPI( diff --git a/lang_agent/pipeline.py b/lang_agent/pipeline.py index 3401e21..350e9e7 100644 --- a/lang_agent/pipeline.py +++ b/lang_agent/pipeline.py @@ -145,7 +145,7 @@ class Pipeline: async for chunk in out: yield chunk - def chat(self, inp:str, as_stream:bool=False, as_raw:bool=False, thread_id:int = None): + def chat(self, inp:str, as_stream:bool=False, as_raw:bool=False, thread_id:str = '3'): """ as_stream (bool): if true, enable the thing to be streamable as_raw (bool): return full dialoge of List[SystemMessage, HumanMessage, ToolMessage] @@ -153,7 +153,6 @@ class Pipeline: # NOTE: this prompt will be overwritten by 'configs/route_sys_prompts/chat_prompt.txt' for route graph u = DEFAULT_PROMPT - thread_id = thread_id if thread_id is not None else 3 inp = {"messages":[SystemMessage(u), HumanMessage(inp)]}, {"configurable": {"thread_id": thread_id}} @@ -188,7 +187,7 @@ class Pipeline: assert 0, "something is wrong" - async def achat(self, inp:str, as_stream:bool=False, as_raw:bool=False, thread_id:int = None): + async def achat(self, inp:str, as_stream:bool=False, as_raw:bool=False, thread_id:str = '3'): """ Async version of chat using LangGraph's native async support. @@ -198,7 +197,6 @@ class Pipeline: # NOTE: this prompt will be overwritten by 'configs/route_sys_prompts/chat_prompt.txt' for route graph u = DEFAULT_PROMPT - thread_id = thread_id if thread_id is not None else 3 inp_data = {"messages":[SystemMessage(u), HumanMessage(inp)]}, {"configurable": {"thread_id": thread_id}}