Skip to content

feat: Add Anthropic (Claude) LLM support#18

Open
tonycdr-prog wants to merge 1 commit intotm243:mainfrom
tonycdr-prog:feat/anthropic-claude-support
Open

feat: Add Anthropic (Claude) LLM support#18
tonycdr-prog wants to merge 1 commit intotm243:mainfrom
tonycdr-prog:feat/anthropic-claude-support

Conversation

@tonycdr-prog
Copy link
Copy Markdown

Summary

Adds support for Anthropic Claude models as requested in #7.

Changes

  • Add Anthropic support to LLMFactory.create_llm_and_embeddings()
  • Support Claude models: claude-3-5-sonnet, claude-3-5-haiku, claude-3-opus
  • Short names mapped to full Anthropic model IDs
  • Uses langchain_anthropic.ChatAnthropic for LLM
  • Embeddings via OpenAI fallback or Ollama (Anthropic doesn't provide embeddings)
  • Updated extract_response() to handle Anthropic response format
  • Added langchain-anthropic dependency

Usage

from agent_assembly_line.config import Config
from agent_assembly_line.llm_factory import LLMFactory

# Set your API key
os.environ['ANTHROPIC_API_KEY'] = 'your-key'

# Create config with Anthropic
config = Config(llm_type='anthropic', model_name='claude-3-5-sonnet')
llm, embeddings = LLMFactory.create_llm_and_embeddings(config)

Testing

Tested locally with Claude 3.5 Sonnet. Works with the existing agent patterns.

Closes #7

- Add support for Claude models (claude-3-5-sonnet, claude-3-5-haiku, claude-3-opus)
- Map short model names to full Anthropic model IDs
- Use langchain_anthropic.ChatAnthropic for LLM
- Support embeddings via OpenAI fallback or Ollama
- Update extract_response to handle Anthropic response format
- Add langchain-anthropic dependency to pyproject.toml

Closes tm243#7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: Add Anthropic (Claude) LLM support

2 participants