-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Tools don´t work #2330
Comments
Sorry, lots of things changed. I think now for ver0.6.7, you don't need to include the param |
Can you please provide right format how to define tool |
You should be able to do this on the lates 0.6.9 version: from letta import create_client
def create_file(relative_path: str, initial_content: str = "") -> str:
"""
Creates a new file at '/Users/Shared/Projects/<project_name>/<relative_path>'
and optionally writes initial content.
If the file already exists, it will be overwritten.
Args:
relative_path (str): The path (relative to the project directory).
initial_content (str): Optional string content to write into the newly created file.
Returns:
str: A success or error message.
"""
import os
# Retrieve the project name from memory (adapt if your memory system differs).
project_name = self.memory.get_block("project_name").value
base_dir = "/Users/Shared/Projects"
full_path = os.path.join(base_dir, project_name, relative_path)
try:
os.makedirs(os.path.dirname(full_path), exist_ok=True)
with open(full_path, "w", encoding="utf-8") as f:
f.write(initial_content)
return f"File created at '{full_path}' with initial content."
except Exception as e:
return f"Failed to create file '{full_path}': {str(e)}"
client = create_client()
tool = client.create_tool(create_file)
print(tool) Note that you'll need to attach the tool to the agent when you create it. |
Mine is showing name is not defined when I am executing my code as well as the above code also is showing same error.
|
I am facing the same issue. Here is the old function (from the deeplearning.ai course)
and here is the function from Letta 0.6.27, which doesn't have the 'name' argument but it calls it in the body.
|
@alaliaa Yes, the Warning The legacy Letta Python LocalClient/RestClient SDK is available under pip install letta (which also contains the server). This client is deprecated and will be replaced in a future release with the new letta-client. Please migrate any Python code using the old RESTClient or LocalClient to use letta-client to avoid breaking changes in the future. Now the recommended way is to use the new letta-client, as follows: Lines 11 to 37 in a42a197
|
Describe the bug
I´m trying to create any tool, but it doesn´t work. I try this tool from the Deeplearning example:
When agent is working it always return me error like this:
Whenever I add any other tool, it always has issues with ´self´:
Please describe your setup
pip install letta
What's your OS (Windows/MacOS/Linux)?
MacOS
How are you running
letta
? (cmd.exe
/Powershell/Anaconda Shell/Terminal)Terminal
Letta Config
[defaults]
preset = memgpt_chat
persona = sam_pov
human = basic
[archival_storage]
type = sqlite
path = /Users/user/.letta
[recall_storage]
type = sqlite
path = /Users/user/.letta
[metadata_storage]
type = sqlite
path = /Users/user/.letta
[version]
letta_version = 0.6.7
The text was updated successfully, but these errors were encountered: