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

Error "Input should be a valid string" sending request to API #1408

Open
gcalabria opened this issue May 24, 2024 · 2 comments
Open

Error "Input should be a valid string" sending request to API #1408

gcalabria opened this issue May 24, 2024 · 2 comments

Comments

@gcalabria
Copy link

Describe the bug

When I send a request to the API endpoint /api/agents/${agent_id}/config I get the following error:

 File "/Users/gui/wild/ai-prototypes-long-term-memory/MemGPT/memgpt/server/rest_api/agents/config.py", line 92, in get_agent_config
    return GetAgentResponse(
           ^^^^^^^^^^^^^^^^^
  File "/Users/gui/.pyenv/versions/3.11.9/envs/ai-prototype-long-term-memory/lib/python3.11/site-packages/pydantic/main.py", line 176, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for GetAgentResponse
sources.0
  Input should be a valid string [type=string_type, input_value=UUID('8194051a-3ce9-4bea-9ee9-9581abc1b793'), input_type=UUID]
    For further information visit https://errors.pydantic.dev/2.7/v/string_type

I took a look and the attached_sources variable is a list of UUIDs but the GetAgentResponse expects a list of strings instead.
The question is: should we change the GetAgentResponse pydantic model or simply convert the UUIDs to strings?

Please describe your setup

  • How did you install memgpt?
    • git clone
  • Describe your setup
    • macOS Sonoma 14.4, Python 3.11, postgres db (supabase)
    • How are you running memgpt?
    • memgpt server

Additional context
The problem only happens after I attach a data source to an agent.

MemGPT Config

[defaults]
preset = memgpt_chat
persona = sam_pov
human = basic

[model]
model = gpt-4
model_endpoint = https://api.openai.com/v1
model_endpoint_type = openai
context_window = 8192

[embedding]
embedding_endpoint_type = openai
embedding_endpoint = https://api.openai.com/v1
embedding_model = text-embedding-ada-002
embedding_dim = 1536
embedding_chunk_size = 300

[archival_storage]
type = postgres
path = /Users/gui/.memgpt/chroma
uri = postgresql://postgres:[email protected]:54322/postgres

[recall_storage]
type = postgres
path = /Users/gui/.memgpt
uri = postgresql://postgres:[email protected]:54322/postgres

[metadata_storage]
type = postgres
path = /Users/gui/.memgpt
uri = postgresql://postgres:[email protected]:54322/postgres

[version]
memgpt_version = 0.3.15

[client]
anon_clientid = 00000000-0000-0000-0000-000000000000
@gcalabria
Copy link
Author

I've modified the GetAgentResponse to expect UUIDs instead, and it is working fine for me. If you want, I can open a PR

@scenaristeur
Copy link
Contributor

seems to be same as #1664
should be fixed by #1679 when merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To triage
Development

No branches or pull requests

2 participants