Add missing import in functions.py #2060
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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