A reference implementation for the tulip agent
, an LLM-backed agent with access to a large number of tools via a tool library.
This approach reduces costs, enables the use of tool sets that exceed API limits or context windows, and increases flexibility with regard to the tool set used.
🔬 Function analysis
Generate OpenAI API compatible tool descriptions for Python functions via introspection
🌷 Tool library
Combines a vector store for semantic search among tools and tool execution
🤖 Agents
- Baseline, without tool library
BaseAgent
: LLM agent without tool accessNaiveToolAgent
: Includes tool descriptions for all tools availableCotToolAgent
: Extends theNaiveToolAgent
with a planning step that decomposes the user input into subtasks
- Tulip variations with access to a tool library
MinimalTulipAgent
: Minimal implementation; searches for tools based on the user input directlyNaiveTulipAgent
: Naive implementation; searches for tools with a separate tool callCotTulipAgent
: COT implementation; derives a plan for the necessary steps and searches for suitable toolsInformedCotTulipAgent
: Same asCotTulipAgent
, but with a brief description of the tool library's contentsPrimedCotTulipAgent
: Same asCotTulipAgent
, but primed with tool names based on an initial search with the user requestOneShotCotTulipAgent
: Same asCotTulipAgent
, but the system prompt included a brief exampleAutoTulipAgent
: Fully autonomous variant; can use the search tool at any time and modify its tool library with CRUD operationsDfsTulipAgent
: DFS inspired variant that leverages a DAG for keeping track of tasks and suitable tools, can create new tools
📊 Evaluation
math_eval
: Math evaluationrobo_eval
: Robotics evaluation using tools created for AttentiveSupport
📝 Examples
See ./examples
- Make sure you have an OpenAI API key set up, see the official instructions
- Install with
poetry install
orpip install -e .
- Check out the
examples
and the robot evaluation insrc/robo_eval
- Python v3.10.11 recommended, higher versions may lead to issues with chroma when installing via Poetry
- Pre-commit hooks - install with
(poetry run) pre-commit install
- Linting: ruff
- Formatting: black
- Import sorting: isort
- Tests: Run with
(poetry run) python -m unittest discover tests/
See these troubleshooting instructions
- On Linux install pysqlite3-binary:
poetry add pysqlite3-binary
- Add the following to
lib/python3.10/site-packages/chromadb/__init__.py
in your venv
__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
Make sure to install the package itself, e.g., with poetry install
or pip install -e .
Then run the example with poetry run python examples/calculator_example.py