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.3.tar.gz (16.1 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.3-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: functionsmith-0.1.3.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for functionsmith-0.1.3.tar.gz
Algorithm Hash digest
SHA256 59e3a0b5fdf7d318425244bad85db8561deaae2be1667b4516e771fbb32a0636
MD5 cb312d1824d0eabc0541c8f60db14d18
BLAKE2b-256 e9d478d120b2570989407f625785a4b1790ba07eac54655ee18baec20f9662e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: functionsmith-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for functionsmith-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a12e14857cf5aa5af3ac8bfafd50283eca89aeb77016fe172d2296fb7c0fc03f
MD5 158d915f9b6979330e8b33fbb70258b9
BLAKE2b-256 466e50e667862e1a05b52a33b6100c13db9a78d1570fd116fa4195ed731e1a33

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