superagent-ai / superagent-py

Superagent Python SDK

Home Page:https://docs.superagent.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API definition mismatch

kgrofelnik opened this issue · comments

I've created an agent using the admin interface and tried using it with the SDK.
It seems there's an entity definition mismatch.

SDK version 0.1.36

Traceback (most recent call last):
  File ".../main.py", line 5, in <module>
    agent = client.agent.get("XXXXXX")
  File ".../lib/python3.10/site-packages/superagent/resources/agent/client.py", line 89, in get
    return pydantic.parse_obj_as(AppModelsResponseAgent, _response.json())  # type: ignore
  File ".../lib/python3.10/site-packages/pydantic/v1/tools.py", line 38, in parse_obj_as
    return model_type(__root__=obj).__root__
  File ".../lib/python3.10/site-packages/pydantic/v1/main.py", line 341, in __init__
    raise validation_error
pydantic.v1.error_wrappers.ValidationError: 1 validation error for ParsingModel[AppModelsResponseAgent]
__root__ -> data -> llms -> 0 -> llm -> options

Did you add an llm to the agent? @kgrofelnik

@kgrofelnik This works for me:

response = client.agent.invoke(
    agent_id="XXXX",
    input="Hi, there",
    enable_streaming=False
)
print(response.data.get("output"))

Please confirm that the Agent you setup has an LLM attached to it. Also if the issue persists I would be glad to jump on DM on Discord to help debug. Here is the link to join: https://discord.gg/mhmJUTjW4b

I did not use the SDK to add an LLM, but I set the model via the admin page.
image

EDIT:

The agent works using the admin interface.
Agent ID is f60830db-8cd2-47c3-98ea-671ef4e0ee4c

@kgrofelnik thank u! Debugging.

What sdk function are you running? client.agent.get?

@kgrofelnik should also be fixed in the latest release of the SDK.