Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBer78 committed Nov 20, 2024
1 parent e40736d commit 8f07f79
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions swarm_copy/stream.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -39,9 +40,9 @@ async def stream_agent_response(
# Final chunk that contains the whole response
else:
if chunk[1]:
yield "\n<requires_human_approval>\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<requires_human_approval>\n" + tool_valid_list
to_db = chunk[0]

offset = len(messages) - 1 if not_ai_tool else len(messages)
Expand Down
1 change: 0 additions & 1 deletion swarm_copy/tools/bluenaas_memodel_getall.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ async def arun(self) -> PaginatedResponseUnionMEModelResponseSynaptomeModelRespo
},
headers={"Authorization": f"Bearer {self.metadata.token}"},
)
breakpoint()
return PaginatedResponseUnionMEModelResponseSynaptomeModelResponse(
**response.json()
)
2 changes: 2 additions & 0 deletions swarm_copy/tools/bluenaas_scs_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"],
Expand Down

0 comments on commit 8f07f79

Please sign in to comment.