llm_operate_file

llm_operate_file: File Management Operations

Uses the language model to perform file operations based on user instructions.

def llm_operate_file(
    agent_name: str, 
    messages: List[Dict[str, Any]], 
    tools: List[Dict[str, Any]] = None, 
    base_url: str = aios_kernel_url,
    llms: List[Dict[str, Any]] = None
) -> LLMResponse

Parameters:

  • agent_name: Identifier for the agent making the request

  • messages: List of message dictionaries

  • tools: Optional list of tools (usually not needed for file operations)

  • base_url: API endpoint URL

  • llms: Optional list of LLM configurations

Returns:

  • LLMResponse object containing file operation results

Example:

# Create a text file
response = llm_operate_file(
    "file_assistant",
    messages=[
        {"role": "user", "content": "Create a new file called notes.txt with a todo list for today"}
    ]
)

# Process the response
print(response["response"]["response_message"])  # Contains information about the file operation

Common Message Formats

All functions accept messages in the following format:

messages = [
    {
        "role": "system",  # Can be "system", "user", or "assistant"
        "content": "You are a helpful assistant specialized in...",  # Message content
        "name": "example_name"  # Optional name for the message sender
    },
    {
        "role": "user",
        "content": "Please help me with..."
    }
]

Last updated