Skip to content

Commit

Permalink
feat: Add model selection support for Anthropic handler
Browse files Browse the repository at this point in the history
The Anthropic handler currently uses a hardcoded model (claude-3-opus-20240229).
This change allows model selection through configuration, matching the behavior
of the OpenAI handler.

Changes:
- Remove hardcoded model string
- Use config loader to get model name from configuration
- Update model settings initialization
  • Loading branch information
diekotto committed Dec 14, 2024
1 parent bc31a9b commit 8abe727
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion readmeai/models/anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def __init__(
) -> None:
super().__init__(config_loader, context)
self.client: Optional[Any] = None
self.model: str = "claude-3-opus-20240229"
if ANTHROPIC_AVAILABLE:
self._model_settings()
else:
Expand All @@ -63,6 +62,7 @@ def _model_settings(self):
return

self.client = anthropic.AsyncAnthropic(api_key=api_key)
self.model = self.config.llm.model

async def _build_payload(self, prompt: str, tokens: int) -> dict[str, Any]:
"""Build payload for POST request to the Anthropic API."""
Expand Down

0 comments on commit 8abe727

Please sign in to comment.