Skip to content

Commit

Permalink
Adding AntrhopicLLM
Browse files Browse the repository at this point in the history
  • Loading branch information
parkervg committed Sep 1, 2024
1 parent 4c93ce1 commit 308dab9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
49 changes: 25 additions & 24 deletions blendsql/models/remote/_anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@


class AnthropicLLM(RemoteModel):
"""Class for Anthropic Model API.
Args:
model_name_or_path: Name of the Anthropic model to use
env: Path to directory of .env file, or to the file itself to load as a dotfile.
Should contain the variable `ANTRHOPIC_API_KEY`
config: Optional argument mapping to use in loading model
caching: Bool determining whether we access the model's cache
Examples:
Given the following `.env` file in the directory above current:
```text
ANTRHOPIC_API_KEY=my_api_key
```
```python
from blendsql.models import AnthropicLLM
model = AnthropicLLM(
"claude-3-5-sonnet-20240620",
env="..",
config={"temperature": 0.7}
)
```
"""

def __init__(
self,
model_name_or_path: str,
Expand All @@ -18,30 +43,6 @@ def __init__(
caching: bool = True,
**kwargs,
):
"""Class for Anthropic Model API.
Args:
model_name_or_path: Name of the Anthropic model to use
env: Path to directory of .env file, or to the file itself to load as a dotfile.
Should contain the variable `ANTRHOPIC_API_KEY`
config: Optional argument mapping to use in loading model
caching: Bool determining whether we access the model's cache
Examples:
Given the following `.env` file in the directory above current:
```text
ANTRHOPIC_API_KEY=my_api_key
```
```python
from blendsql.models import AnthropicLLM
model = AnthropicLLM(
"claude-3-5-sonnet-20240620",
env="..",
config={"temperature": 0.7}
)
```
"""
if not _has_anthropic:
raise ImportError(
"Please install anthropic with `pip install anthropic`!"
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/blenders/anthropic.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ hide:

## AnthropicLLM

::: blendsql.models.local._anthropic.AnthropicLLM
::: blendsql.models.remote._anthropic.AnthropicLLM
handler: python
show_source: false

0 comments on commit 308dab9

Please sign in to comment.