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.

Until there is a PyPi package, install with:

pip install "git+https://github.com/google/earthengine-community.git#egg=functionsmith&subdirectory=experimental/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

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 a notebook version of the general-purpose agent, as well as 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.0.tar.gz (15.5 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.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: functionsmith-0.1.0.tar.gz
  • Upload date:
  • Size: 15.5 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.0.tar.gz
Algorithm Hash digest
SHA256 fdbe0f0bfc52367a792a6e72c01fa7648ad19b295a30801e27988996071fc853
MD5 e725e978bb550c5063c05af9e89f281f
BLAKE2b-256 b3e961c73734cbe4809b6757e62cc68386659f7325e9f1dbdfdcd4e9599c6230

See more details on using hashes here.

File details

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

File metadata

  • Download URL: functionsmith-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d42f5087e6f393fbe43875f1cee5426f0379faa977f9d61dac329f0805a788e5
MD5 cc84fd37e8aa0dd3dd33d2b4c4c047e8
BLAKE2b-256 0e6d151829ac936e2ffa5cf6967facbf4ba2d72151298e15e3d267ff24a8b136

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