diff --git a/.gitignore b/.gitignore index 82f9275..97f415d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ __pycache__/ *.py[cod] *$py.class +uv.lock # C extensions *.so diff --git a/README.md b/README.md index 29880b3..ad089ae 100644 --- a/README.md +++ b/README.md @@ -40,17 +40,17 @@ The primary [search tool](./src/react_agent/tools.py) [^1] used is [Tavily](http Setup instruction auto-generated by `langgraph template lock`. DO NOT EDIT MANUALLY. --> -
-Setup for `model_name` -The `llm` configuration defaults are shown below: +### Setup Model + +The defaults values for `model` are shown below: ```yaml -model_name: anthropic/claude-3-5-sonnet-20240620 +model: anthropic/claude-3-5-sonnet-20240620 ``` Follow the instructions below to get set up, or pick one of the additional options. -### Anthropic Chat Models +#### Anthropic To use Anthropic's chat models: @@ -60,17 +60,7 @@ To use Anthropic's chat models: ``` ANTHROPIC_API_KEY=your-api-key ``` -### Fireworks Chat Models - -To use Fireworks AI's chat models: - -1. Sign up for a [Fireworks AI account](https://app.fireworks.ai/signup) and obtain an API key. -2. Add your Fireworks AI API key to your `.env` file: - -``` -FIREWORKS_API_KEY=your-api-key -``` -#### OpenAI Chat Models +#### OpenAI To use OpenAI's chat models: @@ -80,7 +70,7 @@ To use OpenAI's chat models: OPENAI_API_KEY=your-api-key ``` -
+ @@ -96,7 +86,7 @@ End setup instructions 1. **Add new tools**: Extend the agent's capabilities by adding new tools in [tools.py](./src/react_agent/tools.py). These can be any Python functions that perform specific tasks. 2. **Select a different model**: We default to Anthropic's Claude 3 Sonnet. You can select a compatible chat model using `provider/model-name` via configuration. Example: `openai/gpt-4-turbo-preview`. -3. **Customize the prompt**: We provide a default system prompt in [configuration.py](./src/react_agent/configuration.py). You can easily update this via configuration in the studio. +3. **Customize the prompt**: We provide a default system prompt in [prompts.py](./src/react_agent/prompts.py). You can easily update this via configuration in the studio. You can also quickly extend this template by: @@ -122,7 +112,7 @@ Configuration auto-generated by `langgraph template lock`. DO NOT EDIT MANUALLY. "agent": { "type": "object", "properties": { - "model_name": { + "model": { "type": "string", "default": "anthropic/claude-3-5-sonnet-20240620", "description": "The name of the language model to use for the agent's main interactions. Should be in the form: provider/model-name.", @@ -159,74 +149,6 @@ Configuration auto-generated by `langgraph template lock`. DO NOT EDIT MANUALLY. "value": "anthropic/claude-instant-1.2", "variables": "ANTHROPIC_API_KEY" }, - { - "value": "fireworks/gemma2-9b-it", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/llama-v3-70b-instruct", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/llama-v3-70b-instruct-hf", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/llama-v3-8b-instruct", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/llama-v3-8b-instruct-hf", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/llama-v3p1-405b-instruct", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/llama-v3p1-405b-instruct-long", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/llama-v3p1-70b-instruct", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/llama-v3p1-8b-instruct", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/mixtral-8x22b-instruct", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/mixtral-8x7b-instruct", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/mixtral-8x7b-instruct-hf", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/mythomax-l2-13b", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/phi-3-vision-128k-instruct", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/phi-3p5-vision-instruct", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/starcoder-16b", - "variables": "FIREWORKS_API_KEY" - }, - { - "value": "fireworks/yi-large", - "variables": "FIREWORKS_API_KEY" - }, { "value": "openai/gpt-3.5-turbo", "variables": "OPENAI_API_KEY" diff --git a/src/react_agent/configuration.py b/src/react_agent/configuration.py index 16ffea8..6848ed3 100644 --- a/src/react_agent/configuration.py +++ b/src/react_agent/configuration.py @@ -22,7 +22,7 @@ class Configuration: }, ) - model_name: Annotated[str, {"__template_metadata__": {"kind": "llm"}}] = field( + model: Annotated[str, {"__template_metadata__": {"kind": "llm"}}] = field( default="anthropic/claude-3-5-sonnet-20240620", metadata={ "description": "The name of the language model to use for the agent's main interactions. " diff --git a/src/react_agent/graph.py b/src/react_agent/graph.py index fd47ec3..5940fd7 100644 --- a/src/react_agent/graph.py +++ b/src/react_agent/graph.py @@ -42,7 +42,7 @@ async def call_model( ) # Initialize the model with tool binding. Change the model or add more tools here. - model = load_chat_model(configuration.model_name).bind_tools(TOOLS) + model = load_chat_model(configuration.model).bind_tools(TOOLS) # Prepare the input for the model, including the current system time message_value = await prompt.ainvoke(