From 0a797e16e8fdb29986fc68a39e26cdbbba85c79e Mon Sep 17 00:00:00 2001 From: Igor Dvorkin Date: Sat, 26 Oct 2024 05:44:11 -0700 Subject: [PATCH 1/4] git ignore aider files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3b3cff88..8c728ace 100644 --- a/.gitignore +++ b/.gitignore @@ -311,3 +311,4 @@ dist static/ *.db-shm *.db-wal +.aider* From d9820fb99af2edd972defc86059261ec24cbe26d Mon Sep 17 00:00:00 2001 From: Igor Dvorkin Date: Sat, 26 Oct 2024 05:46:16 -0700 Subject: [PATCH 2/4] * Updates Claude 3.5 Sonnet model to use latest version 20241022 --- docs/src/core_concepts/tool_usage.rst | 2 +- examples/claude.py | 3 ++- examples/future/multimodal_tool_use.py | 2 +- examples/future/tool_using_chatbot.py | 2 +- examples/future/use_tool_once.py | 2 +- examples/providers/anthropic_ex.py | 4 ++-- src/ell/models/anthropic.py | 1 + 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/src/core_concepts/tool_usage.rst b/docs/src/core_concepts/tool_usage.rst index 3d6df4a1..83f49cc3 100644 --- a/docs/src/core_concepts/tool_usage.rst +++ b/docs/src/core_concepts/tool_usage.rst @@ -271,7 +271,7 @@ This is accomplished by a language model program that takes the source code of a .. code-block:: python - @ell.simple(model="claude-3-5-sonnet", temperature=0.0) + @ell.simple(model="claude-3-5-sonnet-20241022", temperature=0.0) def generate_tool_spec(tool_source: str): ''' You are a helpful assistant that takes in source code for a python function and produces a JSON schema for the function. diff --git a/examples/claude.py b/examples/claude.py index a15a4267..d42dc683 100644 --- a/examples/claude.py +++ b/examples/claude.py @@ -1,6 +1,7 @@ import ell # type: ignore +import anthropic -@ell.simple(model="claude-3-5-sonnet-20240620", max_tokens=100) +@ell.simple(model="claude-3-5-sonnet-20241022", client=anthropic.Anthropic(), max_tokens=100) def hello_from_claude(): """You are an AI assistant. Your task is to respond to the user's message with a friendly greeting.""" return "Say hello to the world!!!" diff --git a/examples/future/multimodal_tool_use.py b/examples/future/multimodal_tool_use.py index dc61eafe..7bb88d57 100644 --- a/examples/future/multimodal_tool_use.py +++ b/examples/future/multimodal_tool_use.py @@ -49,7 +49,7 @@ def get_ice_cream_flavors(): return to_content_blocks([("1. Vanilla"), "2.", (generate_strawberry_image()), ("3. Coconut")]) -@ell.complex(model="claude-3-5-sonnet-20240620", tools=[get_user_name, get_ice_cream_flavors], max_tokens=1000) +@ell.complex(model="claude-3-5-sonnet-20241022", tools=[get_user_name, get_ice_cream_flavors], max_tokens=1000) def f(message_history: list[ell.Message]) -> list[ell.Message]: return [ ell.system( diff --git a/examples/future/tool_using_chatbot.py b/examples/future/tool_using_chatbot.py index c9294977..598c2e3c 100644 --- a/examples/future/tool_using_chatbot.py +++ b/examples/future/tool_using_chatbot.py @@ -21,7 +21,7 @@ def approve_claim(claim_id : str): """Approve a claim""" return "approved" -@ell.complex(model="claude-3-5-sonnet-20240620", tools=[create_claim_draft, approve_claim], temperature=0.1, max_tokens=400) +@ell.complex(model="claude-3-5-sonnet-20241022", tools=[create_claim_draft, approve_claim], temperature=0.1, max_tokens=400) def insurance_claim_chatbot(message_history: List[Message]) -> List[Message]: return [ ell.system( """You are a an insurance adjuster AI. You are given a dialogue with a user and have access to various tools to effectuate the insurance claim adjustment process. Ask question until you have enough information to create a claim draft. Then ask for approval."""), diff --git a/examples/future/use_tool_once.py b/examples/future/use_tool_once.py index 150f5c99..66c8c953 100644 --- a/examples/future/use_tool_once.py +++ b/examples/future/use_tool_once.py @@ -21,7 +21,7 @@ def get_html_content( return soup.get_text()[:100] -@ell.complex(model="claude-3-5-sonnet-20240620", tools=[get_html_content], max_tokens=200) +@ell.complex(model="claude-3-5-sonnet-20241022", tools=[get_html_content], max_tokens=200) def summarize_website(website :str) -> str: """You are an agent that can summarize the contents of a website.""" return f"Tell me whats on {website}" diff --git a/examples/providers/anthropic_ex.py b/examples/providers/anthropic_ex.py index 1e1c80b6..9535fdec 100644 --- a/examples/providers/anthropic_ex.py +++ b/examples/providers/anthropic_ex.py @@ -9,14 +9,14 @@ # custom client client = anthropic.Anthropic() -@ell.simple(model='claude-3-5-sonnet-20240620', client=client, max_tokens=10) +@ell.simple(model='claude-3-5-sonnet-20241022', client=client, max_tokens=10) def chat(prompt: str) -> str: return prompt print(chat("Hello, how are you?")) # Models are automatically registered! -@ell.simple(model='claude-3-5-sonnet-20240620', max_tokens=10) +@ell.simple(model='claude-3-5-sonnet-20241022', max_tokens=10) def use_default_client(prompt: str) -> str: return prompt diff --git a/src/ell/models/anthropic.py b/src/ell/models/anthropic.py index 50f4b71e..39b737a6 100644 --- a/src/ell/models/anthropic.py +++ b/src/ell/models/anthropic.py @@ -28,6 +28,7 @@ def register(client: anthropic.Anthropic): ('claude-3-sonnet-20240229', 'anthropic'), ('claude-3-haiku-20240307', 'anthropic'), ('claude-3-5-sonnet-20240620', 'anthropic'), + ('claude-3-5-sonnet-20241022', 'anthropic'), ] for model_id, owned_by in model_data: config.register_model(model_id, client) From bd85e246f17ce55e204a33c559c609c9925089c5 Mon Sep 17 00:00:00 2001 From: Igor Dvorkin Date: Sat, 26 Oct 2024 07:59:48 -0700 Subject: [PATCH 3/4] Add Claude-3.5 Sonnet latest model variant to supported models --- src/ell/models/anthropic.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ell/models/anthropic.py b/src/ell/models/anthropic.py index 39b737a6..8077cc1b 100644 --- a/src/ell/models/anthropic.py +++ b/src/ell/models/anthropic.py @@ -29,6 +29,7 @@ def register(client: anthropic.Anthropic): ('claude-3-haiku-20240307', 'anthropic'), ('claude-3-5-sonnet-20240620', 'anthropic'), ('claude-3-5-sonnet-20241022', 'anthropic'), + ('claude-3-5-sonnet-latest', 'anthropic'), ] for model_id, owned_by in model_data: config.register_model(model_id, client) From 19c12dd76c34e79e2366bb8504bf5ceb98aaa199 Mon Sep 17 00:00:00 2001 From: Igor Dvorkin Date: Mon, 28 Oct 2024 18:39:47 -0700 Subject: [PATCH 4/4] Remove unneeded client param --- examples/claude.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/claude.py b/examples/claude.py index d42dc683..bbd1aca5 100644 --- a/examples/claude.py +++ b/examples/claude.py @@ -1,7 +1,6 @@ import ell # type: ignore -import anthropic -@ell.simple(model="claude-3-5-sonnet-20241022", client=anthropic.Anthropic(), max_tokens=100) +@ell.simple(model="claude-3-5-sonnet-20241022", max_tokens=100) def hello_from_claude(): """You are an AI assistant. Your task is to respond to the user's message with a friendly greeting.""" return "Say hello to the world!!!"