letta-ai / letta

Letta (formerly MemGPT) is a framework for creating LLM services with memory.
https://letta.com
Apache License 2.0
12.88k stars 1.41k forks source link

Add missing import in functions.py #2060

Closed andrewrfitz closed 3 days ago

andrewrfitz commented 3 days ago

Please describe the purpose of this pull request. This fixes a bug

How to test How can we test your PR during review? What commands should we run? What outcomes should we expect?

Have you tested this PR? Have you tested the latest commit on the PR? If so please provide outputs from your tests.

Is your PR over 500 lines of code? If so, please break up your PR into multiple smaller PRs so that we can review them quickly, or provide justification for its length.

Additional context Traceback (most recent call last): File "/Users/gregory/.virtualenvs/gen-ai/lib/python3.12/site-packages/letta/functions/functions.py", line 21, in derive_openai_json_schema exec(source_code, env) File "", line 1, in NameError: name 'List' is not defined. Did you mean: 'list'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/gregory/code/gen-ai/bilt_agent/main.py", line 298, in benefit_tool = client.create_tool(get_benefits) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/gregory/.virtualenvs/gen-ai/lib/python3.12/site-packages/letta/client/client.py", line 2326, in create_tool return self.server.tool_manager.create_or_update_tool( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/gregory/.virtualenvs/gen-ai/lib/python3.12/site-packages/letta/utils.py", line 542, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/gregory/.virtualenvs/gen-ai/lib/python3.12/site-packages/letta/services/tool_manager.py", line 38, in create_or_update_tool derived_json_schema = pydantic_tool.json_schema or derive_openai_json_schema(source_code=pydantic_tool.source_code) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/gregory/.virtualenvs/gen-ai/lib/python3.12/site-packages/letta/functions/functions.py", line 31, in derive_openai_json_schema raise RuntimeError(f"Failed to execute source code: {e}") RuntimeError: Failed to execute source code: name 'List' is not defined