Skip to main content

Functionsmith is a general-purpose problem-solving agent using dynamic function calling

Project description

Functionsmith

Overview

Functionsmith is a general-purpose problem-solving agent using dynamic function calling.

USING THIS AGENT IS UNSAFE. It directly runs LLM-produced code, and thus should only be used for demonstration purposes.

See a sample session output.

Notebook usage

Open the demo notebook.

Command-line usage

Install with:

pip install functionsmith

To run with the default task investigating a CSV file with airport data:

export GOOGLE_API_KEY=my-api-key
wget https://raw.githubusercontent.com/davidmegginson/ourairports-data/refs/heads/main/airports.csv
functionsmith_cli

Implementation

This agent uses dynamic function calling, which means that instead of relying on a fixed set of tools predefined in the agent in normal LLM function calling, we let the agent itself write with all the functions it needs.

The functionsmith system prompt asks the agent to first write any low-level function it needs, as well as tests for them. The agent loop will try to run these functions and ask the LLM to make corrections if necessary. Once all the functions are ready, the agent will write and run the code to solve the actual user task.

The agent does not use function calling features of LLM clients. Instead, it simply tries to parse all the python or tool_use sections present in the raw LLM output. It keeps all function definitions as well as their source code in memory. Each call to the LLM is preceded by the function definitions to let the LLM know what functions are available locally.

The functions are not saved permanently, though this feature can be added.

TODO(simonf): add an Earth Engine-specific notebook agent.

Attribution

Functionsmith was written by Simon Ilyushchenko (simonf@google.com). I am grateful to Renee Johnston and other Googlers for implementation advice, as well as to Earth Engine expert advisors Jeffrey Cardille, Erin Trochim, Morgan Crowley, and Samapriya Roy, who helped me choose the right training tasks.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

functionsmith-0.1.2.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

functionsmith-0.1.2-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file functionsmith-0.1.2.tar.gz.

File metadata

  • Download URL: functionsmith-0.1.2.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for functionsmith-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6c7d7e2582f3b269a67a79c82ceb5a18612ae8200a18689750f69b2a8425d4e7
MD5 52c04455b5f3773f426135441a447623
BLAKE2b-256 232b63dddc656da75066add1899e1fd5937b76770dffdf3b177d3f12ac49a3f9

See more details on using hashes here.

File details

Details for the file functionsmith-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: functionsmith-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for functionsmith-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3da350d86985460a7b96be6ec0b8ba79efd2aec17b5ea6ba810c020a88b32717
MD5 2407b3d1bec54cd5b30af1bffa5ef0e9
BLAKE2b-256 f974a00be4e86a7b61d93ef97df2987c7ab0e6ff025344dbab8a98abca00ab29

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page