Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert result of Task.get_output to str #49

Closed
wants to merge 1 commit into from

Conversation

eraviart
Copy link
Contributor

@eraviart eraviart commented Apr 23, 2023

Currently, there is a typing mismatch:

  • AgentLLM.get_output method returns a list of strings
  • Config.get_task_output method expects that AgentLLM.get_output returns a string
  • The frontend component AgentObjective.js expects that the response generated by Config.get_task_output contains an array of strings

This commit modifies AgentLLM.get_output to return a string and AgentObjective.js to expect a string.

This fixes exception:

Traceback (most recent call last):
  File "~/agent-llm/.venv/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 436, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "~/agent-llm/.venv/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "~/agent-llm/.venv/lib/python3.9/site-packages/fastapi/applications.py", line 276, in __call__
    await super().__call__(scope, receive, send)
  File "~/agent-llm/.venv/lib/python3.9/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "~/agent-llm/.venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "~/agent-llm/.venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "~/agent-llm/.venv/lib/python3.9/site-packages/starlette/middleware/cors.py", line 84, in __call__
    await self.app(scope, receive, send)
  File "~/agent-llm/.venv/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "~/agent-llm/.venv/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "~/agent-llm/.venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "~/agent-llm/.venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "~/agent-llm/.venv/lib/python3.9/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "~/agent-llm/.venv/lib/python3.9/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "~/agent-llm/.venv/lib/python3.9/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "~/agent-llm/.venv/lib/python3.9/site-packages/fastapi/routing.py", line 237, in app
    raw_response = await run_endpoint_function(
  File "~/agent-llm/.venv/lib/python3.9/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
    return await dependant.call(**values)
  File "~/agent-llm/app.py", line 170, in get_task_output
    return TaskOutput(output=output, message="Task agent is still running")
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for TaskOutput
output
  str type expected (type=type_error.str)

@Josh-XT
Copy link
Owner

Josh-XT commented Apr 23, 2023

I appreciate this! I am going to hold off on merging for the moment though. I am in the process of moving the tasks to files, which started because of this error haha. I'm testing my tasks branch here shortly then will merge which will resolve this too if it works.

https://github.com/Josh-XT/Agent-LLM/tree/tasks

@Josh-XT
Copy link
Owner

Josh-XT commented Apr 23, 2023

Fixed in #50

@Josh-XT Josh-XT closed this Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants