Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

Commit 0e328a3

Browse files
authored
Merge pull request #75 from Not-Diamond/ENG-1992_support-gemini-20-flash-claude-37-gpt-45
Support Gemini 2.0 Flash, Claude Sonnet 3.7 and GPT 4.5
2 parents c9a55f4 + 3c6fc5b commit 0e328a3

51 files changed

Lines changed: 11965 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

notdiamond/llms/providers.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class NDLLMProviders(Enum):
2323
GPT_4o_MINI_2024_07_18 (NDLLMProvider): refers to 'gpt-4o-mini-2024-07-18' model by OpenAI
2424
GPT_4o_MINI (NDLLMProvider): refers to 'gpt-4o-mini' model by OpenAI
2525
GPT_4_0125_PREVIEW (NDLLMProvider): refers to 'gpt-4-0125-preview' model by OpenAI
26+
GPT_4_5_PREVIEW (NDLLMProvider): refers to 'gpt-4.5-preview' model by OpenAI
27+
GPT_4_5_PREVIEW_2025_02_27 (NDLLMProvider): refers to 'gpt-4.5-preview-2025-02-27' model by OpenAI
2628
O1_PREVIEW (NDLLMProvider): refers to 'o1-preview' model by OpenAI
2729
O1_PREVIEW_2024_09_12 (NDLLMProvider): refers to 'o1-preview-2024-09-12' model by OpenAI
2830
O1_MINI (NDLLMProvider): refers to 'o1-mini' model by OpenAI
@@ -32,6 +34,8 @@ class NDLLMProviders(Enum):
3234
CLAUDE_3_OPUS_20240229 (NDLLMProvider): refers to 'claude-3-opus-20240229' model by Anthropic
3335
CLAUDE_3_SONNET_20240229 (NDLLMProvider): refers to 'claude-3-sonnet-20240229' model by Anthropic
3436
CLAUDE_3_5_SONNET_20240620 (NDLLMProvider): refers to 'claude-3-5-sonnet-20240620' model by Anthropic
37+
CLAUDE_3_7_SONNET_LATEST (NDLLMProvider): refers to 'claude-3-7-sonnet-latest' model by Anthropic
38+
CLAUDE_3_7_SONNET_20250219 (NDLLMProvider): refers to 'claude-3-7-sonnet-20250219' model by Anthropic
3539
CLAUDE_3_5_HAIKU_20241022 (NDLLMProvider): refers to 'claude-3-5-haiku-20241022' model by Anthropic
3640
CLAUDE_3_HAIKU_20240307 (NDLLMProvider): refers to 'claude-3-haiku-20240307' model by Anthropic
3741
@@ -40,6 +44,8 @@ class NDLLMProviders(Enum):
4044
GEMINI_15_PRO_LATEST (NDLLMProvider): refers to 'gemini-1.5-pro-latest' model by Google
4145
GEMINI_15_PRO_EXP_0801 (NDLLMProvider): refers to 'gemini-1.5-pro-exp-0801' model by Google
4246
GEMINI_15_FLASH_LATEST (NDLLMProvider): refers to 'gemini-1.5-flash-latest' model by Google
47+
GEMINI_20_FLASH (NDLLMProvider): refers to 'gemini-20-flash' model by Google
48+
GEMINI_20_FLASH_001 (NDLLMProvider): refers to 'gemini-20-flash-001' model by Google
4349
4450
COMMAND_R (NDLLMProvider): refers to 'command-r' model by Cohere
4551
COMMAND_R_PLUS (NDLLMProvider): refers to 'command-r-plus' model by Cohere
@@ -93,6 +99,8 @@ class NDLLMProviders(Enum):
9399
GPT_4o_MINI_2024_07_18 = ("openai", "gpt-4o-mini-2024-07-18")
94100
GPT_4o_MINI = ("openai", "gpt-4o-mini")
95101
GPT_4_0125_PREVIEW = ("openai", "gpt-4-0125-preview")
102+
GPT_4_5_PREVIEW = ("openai", "gpt-4.5-preview")
103+
GPT_4_5_PREVIEW_2025_02_27 = ("openai", "gpt-4.5-preview-2025-02-27")
96104
O1_PREVIEW = ("openai", "o1-preview")
97105
O1_PREVIEW_2024_09_12 = ("openai", "o1-preview-2024-09-12")
98106
O1_MINI = ("openai", "o1-mini")
@@ -105,6 +113,8 @@ class NDLLMProviders(Enum):
105113
CLAUDE_3_5_SONNET_20240620 = ("anthropic", "claude-3-5-sonnet-20240620")
106114
CLAUDE_3_5_SONNET_20241022 = ("anthropic", "claude-3-5-sonnet-20241022")
107115
CLAUDE_3_5_SONNET_LATEST = ("anthropic", "claude-3-5-sonnet-latest")
116+
CLAUDE_3_7_SONNET_LATEST = ("anthropic", "claude-3-7-sonnet-latest")
117+
CLAUDE_3_7_SONNET_20250219 = ("anthropic", "claude-3-7-sonnet-20250219")
108118
CLAUDE_3_5_HAIKU_20241022 = ("anthropic", "claude-3-5-haiku-20241022")
109119
CLAUDE_3_HAIKU_20240307 = ("anthropic", "claude-3-haiku-20240307")
110120

@@ -113,6 +123,8 @@ class NDLLMProviders(Enum):
113123
GEMINI_15_PRO_LATEST = ("google", "gemini-1.5-pro-latest")
114124
GEMINI_15_PRO_EXP_0801 = ("google", "gemini-1.5-pro-exp-0801")
115125
GEMINI_15_FLASH_LATEST = ("google", "gemini-1.5-flash-latest")
126+
GEMINI_20_FLASH = ("google", "gemini-2.0-flash")
127+
GEMINI_20_FLASH_001 = ("google", "gemini-2.0-flash-001")
116128

117129
COMMAND_R = ("cohere", "command-r")
118130
COMMAND_R_PLUS = ("cohere", "command-r-plus")

notdiamond/settings.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
"gpt-4-turbo-preview",
4040
"gpt-4-0125-preview",
4141
"gpt-4-1106-preview",
42+
"gpt-4.5-preview",
43+
"gpt-4.5-preview-2025-02-27",
4244
"o1-preview",
4345
"o1-preview-2024-09-12",
4446
"o1-mini",
@@ -61,6 +63,9 @@
6163
"gpt-4-turbo-preview",
6264
"gpt-4-0125-preview",
6365
"gpt-4-1106-preview",
66+
# Need to update langchain-openai to >=0.3.9 to support these
67+
# "gpt-4.5-preview",
68+
# "gpt-4.5-preview-2025-02-27"
6469
],
6570
"support_response_model": [
6671
"gpt-3.5-turbo",
@@ -82,6 +87,8 @@
8287
"o1-mini",
8388
"o1-mini-2024-09-12",
8489
"chatgpt-4o-latest",
90+
"gpt-4.5-preview",
91+
"gpt-4.5-preview-2025-02-27",
8592
],
8693
"openrouter_identifier": {
8794
"gpt-3.5-turbo": "openai/gpt-3.5-turbo",
@@ -99,6 +106,8 @@
99106
"o1-mini": "openai/o1-mini",
100107
"o1-mini-2024-09-12": "openai/o1-mini-2024-09-12",
101108
"chatgpt-4o-latest": "openai/chatgpt-4o-latest",
109+
"gpt-4.5-preview": "openai/gpt-4.5-preview",
110+
"gpt-4.5-preview-2025-02-27": "openai/gpt-4.5-preview-2025-02-27",
102111
},
103112
"price": {
104113
"gpt-3.5-turbo": {"input": 0.5, "output": 1.5},
@@ -120,6 +129,8 @@
120129
"o1-mini": {"input": 3.0, "output": 12.0},
121130
"o1-mini-2024-09-12": {"input": 3.0, "output": 12.0},
122131
"chatgpt-4o-latest": {"input": 5.0, "output": 15.0},
132+
"gpt-4.5-preview": {"input": 75.0, "output": 150.0},
133+
"gpt-4.5-preview-2025-02-27": {"input": 75.0, "output": 150.0},
123134
},
124135
},
125136
"anthropic": {
@@ -132,6 +143,8 @@
132143
"claude-3-5-sonnet-20240620",
133144
"claude-3-5-sonnet-20241022",
134145
"claude-3-5-sonnet-latest",
146+
"claude-3-7-sonnet-latest",
147+
"claude-3-7-sonnet-20250219",
135148
],
136149
"api_key": ANTHROPIC_API_KEY,
137150
"support_tools": [
@@ -142,6 +155,8 @@
142155
"claude-3-5-sonnet-20241022",
143156
"claude-3-5-haiku-20241022",
144157
"claude-3-5-sonnet-latest",
158+
"claude-3-7-sonnet-latest",
159+
"claude-3-7-sonnet-20250219",
145160
],
146161
"support_response_model": [
147162
"claude-2.1",
@@ -155,6 +170,8 @@
155170
"claude-3-5-sonnet-20240620": "anthropic/claude-3.5-sonnet-20240620",
156171
"claude-3-5-sonnet-latest": "anthropic/claude-3.5-sonnet",
157172
"claude-3-5-haiku-20241022": "anthropic/claude-3.5-haiku",
173+
"claude-3-7-sonnet-latest": "anthropic/claude-3.7-sonnet",
174+
"claude-3-7-sonnet-20250219": "anthropic/claude-3.7-sonnet",
158175
},
159176
"price": {
160177
"claude-2.1": {"input": 8.0, "output": 24.0},
@@ -165,6 +182,8 @@
165182
"claude-3-5-sonnet-20240620": {"input": 3.0, "output": 15.0},
166183
"claude-3-5-sonnet-20241022": {"input": 3.0, "output": 15.0},
167184
"claude-3-5-sonnet-latest": {"input": 3.0, "output": 15.0},
185+
"claude-3-7-sonnet-latest": {"input": 3.0, "output": 15.0},
186+
"claude-3-7-sonnet-20250219": {"input": 3.0, "output": 15.0},
168187
},
169188
},
170189
"google": {
@@ -174,6 +193,8 @@
174193
"gemini-1.5-pro-latest",
175194
"gemini-1.5-pro-exp-0801",
176195
"gemini-1.5-flash-latest",
196+
"gemini-2.0-flash",
197+
"gemini-2.0-flash-001",
177198
],
178199
"api_key": GOOGLE_API_KEY,
179200
"support_tools": [
@@ -189,20 +210,26 @@
189210
"gemini-1.5-pro-latest",
190211
"gemini-1.5-pro-exp-0801",
191212
"gemini-1.5-flash-latest",
213+
"gemini-2.0-flash",
214+
"gemini-2.0-flash-001",
192215
],
193216
"openrouter_identifier": {
194217
"gemini-pro": "google/gemini-pro",
195218
"gemini-1.0-pro-latest": "google/gemini-pro",
196219
"gemini-1.5-pro-latest": "google/gemini-pro-1.5", #
197220
"gemini-1.5-pro-exp-0801": "google/gemini-pro-1.5-exp", #
198221
"gemini-1.5-flash-latest": "google/gemini-flash-1.5", #
222+
"gemini-2.0-flash": "google/gemini-2.0-flash", #
223+
"gemini-2.0-flash-001": "google/gemini-2.0-flash", #
199224
},
200225
"price": {
201226
"gemini-pro": {"input": 0.5, "output": 1.5},
202227
"gemini-1.0-pro-latest": {"input": 0.5, "output": 1.5},
203228
"gemini-1.5-pro-latest": {"input": 1.75, "output": 10.5},
204229
"gemini-1.5-pro-exp-0801": {"input": 1.75, "output": 10.5},
205230
"gemini-1.5-flash-latest": {"input": 0.35, "output": 1.05},
231+
"gemini-2.0-flash": {"input": 0.10, "output": 0.40},
232+
"gemini-2.0-flash-001": {"input": 0.10, "output": 0.40},
206233
},
207234
},
208235
"cohere": {
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
interactions:
2+
- request:
3+
body: '{"messages": [{"role": "user", "content": "How much is 3 + 5?"}], "llm_providers":
4+
[{"provider": "anthropic", "model": "claude-3-7-sonnet-20250219", "is_custom":
5+
false, "context_length": null, "input_price": null, "output_price": null, "latency":
6+
null}], "metric": "accuracy", "max_model_depth": 1, "hash_content": true, "tools":
7+
[{"type": "function", "function": {"name": "add_fct", "description": "Adds a
8+
and b.", "parameters": {"type": "object", "properties": {"a": {"type": "integer"},
9+
"b": {"type": "integer"}}, "required": ["a", "b"]}}}]}'
10+
headers:
11+
Accept:
12+
- '*/*'
13+
Accept-Encoding:
14+
- gzip, deflate
15+
Connection:
16+
- keep-alive
17+
Content-Length:
18+
- '544'
19+
User-Agent:
20+
- Python-SDK/0.3.40
21+
content-type:
22+
- application/json
23+
method: POST
24+
uri: https://staging-api.notdiamond.ai/v2/modelRouter/modelSelect
25+
response:
26+
body:
27+
string: '{"detail":"requestID=22a23aac-b73a-404c, Fuzzy hashing is not available
28+
on the free tier. Please upgrade to use this feature."}'
29+
headers:
30+
CF-RAY:
31+
- 923d3df3beb80c57-SOF
32+
Connection:
33+
- keep-alive
34+
Content-Type:
35+
- application/json
36+
Date:
37+
- Fri, 21 Mar 2025 11:52:15 GMT
38+
Server:
39+
- cloudflare
40+
Transfer-Encoding:
41+
- chunked
42+
alt-svc:
43+
- h3=":443"; ma=86400
44+
cf-cache-status:
45+
- DYNAMIC
46+
content-length:
47+
- '127'
48+
rndr-id:
49+
- 22a23aac-b73a-404c
50+
vary:
51+
- Accept-Encoding
52+
x-render-origin-server:
53+
- uvicorn
54+
status:
55+
code: 403
56+
message: Forbidden
57+
- request:
58+
body: '{"max_tokens": 200, "messages": [{"role": "user", "content": "How much
59+
is 3 + 5?"}], "model": "claude-3-7-sonnet-20250219", "tools": [{"name": "add_fct",
60+
"description": "Adds a and b.", "input_schema": {"type": "object", "properties":
61+
{"a": {"type": "integer"}, "b": {"type": "integer"}}, "required": ["a", "b"]}}]}'
62+
headers:
63+
accept:
64+
- application/json
65+
accept-encoding:
66+
- gzip, deflate
67+
anthropic-version:
68+
- '2023-06-01'
69+
connection:
70+
- keep-alive
71+
content-length:
72+
- '315'
73+
content-type:
74+
- application/json
75+
host:
76+
- api.anthropic.com
77+
user-agent:
78+
- Anthropic/Python 0.39.0
79+
x-api-key:
80+
- REDACTED
81+
x-stainless-arch:
82+
- x64
83+
x-stainless-async:
84+
- 'false'
85+
x-stainless-lang:
86+
- python
87+
x-stainless-os:
88+
- Linux
89+
x-stainless-package-version:
90+
- 0.39.0
91+
x-stainless-retry-count:
92+
- '0'
93+
x-stainless-runtime:
94+
- CPython
95+
x-stainless-runtime-version:
96+
- 3.12.3
97+
method: POST
98+
uri: https://api.anthropic.com/v1/messages
99+
response:
100+
body:
101+
string: '{"id":"msg_01W4rHnkewyjvBygzptvZTPK","type":"message","role":"assistant","model":"claude-3-7-sonnet-20250219","content":[{"type":"text","text":"I
102+
can help you calculate 3 + 5 using the add function. Let me do that for you:"},{"type":"tool_use","id":"toolu_01WJA57k7B6RUnPZ477h94Rj","name":"add_fct","input":{"a":3,"b":5}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":397,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":96}}'
103+
headers:
104+
CF-RAY:
105+
- 923d3df8ff78d0cb-SOF
106+
Connection:
107+
- keep-alive
108+
Content-Type:
109+
- application/json
110+
Date:
111+
- Fri, 21 Mar 2025 11:52:19 GMT
112+
Server:
113+
- cloudflare
114+
Transfer-Encoding:
115+
- chunked
116+
X-Robots-Tag:
117+
- none
118+
anthropic-organization-id:
119+
- a2610b2c-742e-455d-9552-6abe105b2a44
120+
anthropic-ratelimit-input-tokens-limit:
121+
- '200000'
122+
anthropic-ratelimit-input-tokens-remaining:
123+
- '200000'
124+
anthropic-ratelimit-input-tokens-reset:
125+
- '2025-03-21T11:52:17Z'
126+
anthropic-ratelimit-output-tokens-limit:
127+
- '80000'
128+
anthropic-ratelimit-output-tokens-remaining:
129+
- '80000'
130+
anthropic-ratelimit-output-tokens-reset:
131+
- '2025-03-21T11:52:18Z'
132+
anthropic-ratelimit-requests-limit:
133+
- '4000'
134+
anthropic-ratelimit-requests-remaining:
135+
- '3999'
136+
anthropic-ratelimit-requests-reset:
137+
- '2025-03-21T11:52:15Z'
138+
anthropic-ratelimit-tokens-limit:
139+
- '280000'
140+
anthropic-ratelimit-tokens-remaining:
141+
- '280000'
142+
anthropic-ratelimit-tokens-reset:
143+
- '2025-03-21T11:52:17Z'
144+
cf-cache-status:
145+
- DYNAMIC
146+
content-length:
147+
- '477'
148+
request-id:
149+
- req_019KnaVP3yZL4BFFW7HQZ8t1
150+
via:
151+
- 1.1 google
152+
status:
153+
code: 200
154+
message: OK
155+
version: 1

0 commit comments

Comments
 (0)