Skip to content

Commit

Permalink
Fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
WonderPG committed Jan 8, 2025
1 parent f6586e8 commit 5ea2c69
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
13 changes: 11 additions & 2 deletions src/neuroagent/app/routers/qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@ async def run_simple_agent(
) -> AgentResponse:
"""Run a single agent query."""
response = await agent_routine.arun(
agent, [{"role": "user", "content": user_request.query}], context_variables
agent,
[
Messages(
order=0,
thread_id="Dummy_thread_id",
entity=Entity.USER,
content=json.dumps({"role": "user", "content": user_request.query}),
)
],
context_variables,
)
return AgentResponse(message=response.messages[-1]["content"])

Expand Down Expand Up @@ -80,7 +89,7 @@ async def run_chat_agent(
thread.update_date = utc_now()
await session.commit()

if response.hil_messages:
if response.hil_messages is not None:
return response.hil_messages
return AgentResponse(message=response.messages[-1]["content"])

Expand Down
2 changes: 1 addition & 1 deletion src/neuroagent/new_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Response(BaseModel):
messages: list[dict[str, Any]] = []
agent: Agent | None = None
context_variables: dict[str, Any] = {}
hil_messages: list[HILResponse | None] = []
hil_messages: list[HILResponse] | None = None


class AgentRequest(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions src/neuroagent/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from sqlalchemy.ext.asyncio import AsyncSession

from neuroagent.agent_routine import AgentsRoutine
from neuroagent.app.database.sql_schemas import Messages, utc_now
from neuroagent.app.database.sql_schemas import Messages, Threads, utc_now
from neuroagent.new_types import Agent, Response


Expand All @@ -17,7 +17,7 @@ async def stream_agent_response(
agent: Agent,
messages: list[Messages],
context_variables: dict[str, Any],
thread: str,
thread: Threads,
request: Request,
) -> AsyncIterator[str]:
"""Redefine fastAPI connections to enable streaming."""
Expand Down

0 comments on commit 5ea2c69

Please sign in to comment.