superagent-ai / superagent-py Goto Github PK
View Code? Open in Web Editor NEWSuperagent Python SDK
Home Page: https://docs.superagent.sh
License: MIT License
Superagent Python SDK
Home Page: https://docs.superagent.sh
License: MIT License
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
I've created an agent using the admin interface and tried using it with the SDK.
It seems that gpt-4-1106-preview
is missing.
Traceback (most recent call last):
File "main.py", line 5, in <module>
agent = client.agent.get("f60830db-8cd2-47c3-98ea-671ef4e0ee4c")
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: 2 validation errors for ParsingModel[AppModelsResponseAgent]
__root__ -> data -> llms -> 0 -> llm -> options
str type expected (type=type_error.str)
__root__ -> data -> llmModel
value is not a valid enumeration member; permitted: 'GPT_3_5_TURBO_16K_0613', 'GPT_3_5_TURBO_0613', 'GPT_4_0613', 'GPT_4_32K_0613' (type=type_error.enum; enum_values=[<LlmModel.GPT_3_5_TURBO_16_K_0613: 'GPT_3_5_TURBO_16K_0613'>, <LlmModel.GPT_3_5_TURBO_0613: 'GPT_3_5_TURBO_0613'>, <LlmModel.GPT_4_0613: 'GPT_4_0613'>, <LlmModel.GPT_4_32_K_0613: 'GPT_4_32K_0613'>])
๐ Hello, amazing community!
I'm exploring the integration of two powerful libraries: MiniAutoGen and superagent-py, and I would greatly appreciate your help and insights!
MiniAutoGen is an innovative open-source library designed to take applications with Large Language Models (LLMs) to the next level. Its differentiators are its lightweight and flexible approach, which allows for a high degree of customization.
Here are some notable features of MiniAutoGen:
My Challenge: I'm seeking help from the community to develop new integrations and modules.
I Seek Your Help: Do you have examples, tips, or guidance on how I can accomplish this integration? Any insight or shared experience would be extremely valuable!
Check out MiniAutoGen on Google Colab: MiniAutoGen on Google Colab
And here is the GitHub repository for more information: GitHub - brunocapelao/miniAutoGen
I'm looking forward to your ideas and suggestions. Let's shape the future of AI conversations together! ๐
AttributeError Traceback (most recent call last)
[/Users/dekahalane/superagent-py/test.ipynb](https://file+.vscode-resource.vscode-cdn.net/Users/dekahalane/superagent-py/test.ipynb) Cell 1 line 6
[2](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=1) from superagent.client import Superagent
[4](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=3) client = Superagent(token="REMOVED FOR DEBUGGING", base_url="https://api.beta.superagent.sh/")
----> [6](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=5) agent = client.agents.create(request={
[7](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=6) "name": "My Agent",
[8](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=7) "description": "My awesome agent",
[9](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=8) "isActive": True,
[10](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=9) "llmModel": "GPT_4_0613"
[11](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=10) })
[13](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=12) output = client.agent.invoke(
[14](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=13) agent_id=agent.data.id,
[15](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=14) input="Hi there!",
[16](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=15) enable_streaming=False,
[17](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=16) session_id="123"
[18](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=17) )
[20](vscode-notebook-cell:/Users/dekahalane/superagent-py/test.ipynb#W0sZmlsZQ%3D%3D?line=19) print("Received response from superagent", agent.data)
AttributeError: 'Superagent' object has no attribute 'agents'
I can't find the documentation to fix this error, I've tried both removing the agents
from client.agents.create
and just the s
as I thought it might be a typo but then it throws an InternalServerError
Hi,
This is just a small thing I saw when reading about the tool. There's a typo on README.md. It is written Flase
instead of False
.
To Add: Chat history of agents and the ability to retrieve past conversation of any session just like list conversation for threads in OpenAI Assistants API
Hi there, I'm unable to use the SDK with API Tokens. I keep getting {'detail': 'Not authenticated'}
. I think it's most likely because the API doesn't seem to accept API Tokens, only bearer auth (https://github.com/homanp/superagent/blob/7e73c21cde43c39c4e83d7ec069e4e0f7ec816c2/app/api/agents.py#L70C50-L70C59)
I would expect the GET request to return my agent successfully. But, let me know if I'm initializing it incorrectly in my code snippet below.
I included a code snippet with how I'm initializing the client
class WrappedSuperagent(object):
def __init__(self, api_token: str, environment="https://api.superagent.sh"):
self._client = Superagent(environment=environment, api_key=api_token)
# Begin Public Methods
def get_agent(self, agent_id: str) -> typing.Any:
return self._get_agent(agent_id)
# End Public Methods
# Begin Private Methods
def _get_agent(self, agent_id: str) -> typing.Any:
agent = self._client.agent.get_agent(agent_id) #### ---- Error starts here
return agent
# End Private Methods
Let me know if you need anymore info and I'm happy to add that as well!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.