diff --git a/swarm_copy/stream.py b/swarm_copy/stream.py index 28097c6..dacdc93 100644 --- a/swarm_copy/stream.py +++ b/swarm_copy/stream.py @@ -1,6 +1,7 @@ """Wrapper around streaming methods to reinitiate connections due to the way fastAPI StreamingResponse works.""" import json +import time from typing import Any, AsyncIterator from httpx import AsyncClient @@ -39,9 +40,9 @@ async def stream_agent_response( # Final chunk that contains the whole response else: if chunk[1]: - yield "\n\n" - for tools in chunk[1]: - yield json.dumps(tools.model_dump()) + time.sleep(0.1) + tool_valid_list = json.dumps([tool.model_dump() for tool in chunk[1]]) + yield "\n\n" + tool_valid_list to_db = chunk[0] offset = len(messages) - 1 if not_ai_tool else len(messages) diff --git a/swarm_copy/tools/bluenaas_memodel_getall.py b/swarm_copy/tools/bluenaas_memodel_getall.py index 8bda00e..e3dce4e 100644 --- a/swarm_copy/tools/bluenaas_memodel_getall.py +++ b/swarm_copy/tools/bluenaas_memodel_getall.py @@ -61,7 +61,6 @@ async def arun(self) -> PaginatedResponseUnionMEModelResponseSynaptomeModelRespo }, headers={"Authorization": f"Bearer {self.metadata.token}"}, ) - breakpoint() return PaginatedResponseUnionMEModelResponseSynaptomeModelResponse( **response.json() ) diff --git a/swarm_copy/tools/bluenaas_scs_post.py b/swarm_copy/tools/bluenaas_scs_post.py index 0e7faa2..c00493b 100644 --- a/swarm_copy/tools/bluenaas_scs_post.py +++ b/swarm_copy/tools/bluenaas_scs_post.py @@ -90,6 +90,7 @@ class SCSPostTool(BaseTool): Requires a "me_model_id" which must be fetched through the 'memodelgetall-tool' or directly provided by the user. Optionally, the user can specify simulation parameters. Returns the id of the simulation along with metadatas to fetch the simulation result and analyse it at a later stage. + Specify ALL of the parameters everytime you enter this tool. """ hil: ClassVar[bool] = True metadata: SCSPostMetadata @@ -122,6 +123,7 @@ async def arun(self) -> SCSPostOutput: json=json_api, ) json_response = response.json() + return SCSPostOutput( id=json_response["id"], status=json_response["status"],