chatlas 0.8.1__py3-none-any.whl → 0.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chatlas/__init__.py +2 -1
- chatlas/_anthropic.py +79 -45
- chatlas/_auto.py +3 -12
- chatlas/_chat.py +749 -146
- chatlas/_content.py +149 -29
- chatlas/_databricks.py +4 -14
- chatlas/_github.py +21 -25
- chatlas/_google.py +71 -32
- chatlas/_groq.py +15 -18
- chatlas/_interpolate.py +3 -4
- chatlas/_mcp_manager.py +306 -0
- chatlas/_ollama.py +14 -18
- chatlas/_openai.py +74 -39
- chatlas/_perplexity.py +14 -18
- chatlas/_provider.py +78 -8
- chatlas/_snowflake.py +29 -18
- chatlas/_tokens.py +93 -5
- chatlas/_tools.py +181 -22
- chatlas/_turn.py +2 -18
- chatlas/_utils.py +27 -1
- chatlas/_version.py +2 -2
- chatlas/data/prices.json +264 -0
- chatlas/types/anthropic/_submit.py +2 -0
- chatlas/types/openai/_client.py +1 -0
- chatlas/types/openai/_client_azure.py +1 -0
- chatlas/types/openai/_submit.py +4 -1
- chatlas-0.9.0.dist-info/METADATA +141 -0
- chatlas-0.9.0.dist-info/RECORD +48 -0
- chatlas-0.8.1.dist-info/METADATA +0 -383
- chatlas-0.8.1.dist-info/RECORD +0 -46
- {chatlas-0.8.1.dist-info → chatlas-0.9.0.dist-info}/WHEEL +0 -0
- {chatlas-0.8.1.dist-info → chatlas-0.9.0.dist-info}/licenses/LICENSE +0 -0
chatlas/_turn.py
CHANGED
|
@@ -42,7 +42,8 @@ class Turn(BaseModel, Generic[CompletionT]):
|
|
|
42
42
|
assert turns[1].role == "assistant"
|
|
43
43
|
|
|
44
44
|
# Load context into a new chat instance
|
|
45
|
-
chat2 = ChatAnthropic(
|
|
45
|
+
chat2 = ChatAnthropic()
|
|
46
|
+
chat2.set_turns(turns)
|
|
46
47
|
turns2 = chat2.get_turns()
|
|
47
48
|
assert turns == turns2
|
|
48
49
|
```
|
|
@@ -134,20 +135,3 @@ def user_turn(*args: Content | str) -> Turn:
|
|
|
134
135
|
|
|
135
136
|
return Turn("user", args)
|
|
136
137
|
|
|
137
|
-
|
|
138
|
-
def normalize_turns(turns: list[Turn], system_prompt: str | None = None) -> list[Turn]:
|
|
139
|
-
if system_prompt is not None:
|
|
140
|
-
system_turn = Turn("system", system_prompt)
|
|
141
|
-
|
|
142
|
-
if not turns:
|
|
143
|
-
turns = [system_turn]
|
|
144
|
-
elif turns[0].role != "system":
|
|
145
|
-
turns = [system_turn] + turns
|
|
146
|
-
elif turns[0] == system_turn:
|
|
147
|
-
pass # Duplicate system prompt; don't need to do anything
|
|
148
|
-
else:
|
|
149
|
-
raise ValueError(
|
|
150
|
-
"system_prompt and turns[0] can't contain conflicting system prompts."
|
|
151
|
-
)
|
|
152
|
-
|
|
153
|
-
return turns
|
chatlas/_utils.py
CHANGED
|
@@ -7,7 +7,33 @@ import os
|
|
|
7
7
|
import re
|
|
8
8
|
from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, TypeVar, cast
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
import httpx
|
|
11
|
+
|
|
12
|
+
from ._typing_extensions import ParamSpec, TypedDict, TypeGuard
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class AnyTypeDict(TypedDict, total=False):
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
HTTPClientKwargs = TypeVar("HTTPClientKwargs", bound=AnyTypeDict)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def split_http_client_kwargs(
|
|
23
|
+
kwargs: HTTPClientKwargs,
|
|
24
|
+
) -> tuple[HTTPClientKwargs, HTTPClientKwargs]:
|
|
25
|
+
"""Split kwargs, removing incompatible http_client for sync/async."""
|
|
26
|
+
sync_kwargs = kwargs.copy()
|
|
27
|
+
async_kwargs = kwargs.copy()
|
|
28
|
+
|
|
29
|
+
http_client = kwargs.get("http_client")
|
|
30
|
+
if isinstance(http_client, httpx.AsyncClient):
|
|
31
|
+
sync_kwargs.pop("http_client")
|
|
32
|
+
elif isinstance(http_client, httpx.Client):
|
|
33
|
+
async_kwargs.pop("http_client")
|
|
34
|
+
|
|
35
|
+
return sync_kwargs, async_kwargs
|
|
36
|
+
|
|
11
37
|
|
|
12
38
|
# --------------------------------------------------------------------
|
|
13
39
|
# wrap_async() and is_async_callable() was copied from shiny/_utils.py
|
chatlas/_version.py
CHANGED
chatlas/data/prices.json
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"provider": "OpenAI",
|
|
4
|
+
"model": "gpt-4.5-preview",
|
|
5
|
+
"cached_input": 37.5,
|
|
6
|
+
"input": 75,
|
|
7
|
+
"output": 150
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"provider": "OpenAI",
|
|
11
|
+
"model": "gpt-4.5-preview-2025-02-27",
|
|
12
|
+
"cached_input": 37.5,
|
|
13
|
+
"input": 75,
|
|
14
|
+
"output": 150
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"provider": "OpenAI",
|
|
18
|
+
"model": "gpt-4.1",
|
|
19
|
+
"cached_input": 0.5,
|
|
20
|
+
"input": 2,
|
|
21
|
+
"output": 8
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"provider": "OpenAI",
|
|
25
|
+
"model": "gpt-4.1-mini",
|
|
26
|
+
"cached_input": 0.1,
|
|
27
|
+
"input": 0.4,
|
|
28
|
+
"output": 1.6
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"provider": "OpenAI",
|
|
32
|
+
"model": "gpt-4.1-nano",
|
|
33
|
+
"cached_input": 0.025,
|
|
34
|
+
"input": 0.1,
|
|
35
|
+
"output": 0.4
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"provider": "OpenAI",
|
|
39
|
+
"model": "gpt-4.1-2025-04-14",
|
|
40
|
+
"cached_input": 0.5,
|
|
41
|
+
"input": 2,
|
|
42
|
+
"output": 8
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"provider": "OpenAI",
|
|
46
|
+
"model": "gpt-4.1-mini-2025-04-14",
|
|
47
|
+
"cached_input": 0.1,
|
|
48
|
+
"input": 0.4,
|
|
49
|
+
"output": 1.6
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"provider": "OpenAI",
|
|
53
|
+
"model": "gpt-4.1-nano-2025-04-14",
|
|
54
|
+
"cached_input": 0.025,
|
|
55
|
+
"input": 0.1,
|
|
56
|
+
"output": 0.4
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"provider": "OpenAI",
|
|
60
|
+
"model": "gpt-4o",
|
|
61
|
+
"cached_input": 1.25,
|
|
62
|
+
"input": 2.5,
|
|
63
|
+
"output": 10
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"provider": "OpenAI",
|
|
67
|
+
"model": "gpt-4o-2024-11-20",
|
|
68
|
+
"cached_input": 1.25,
|
|
69
|
+
"input": 2.5,
|
|
70
|
+
"output": 10
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"provider": "OpenAI",
|
|
74
|
+
"model": "gpt-4o-2024-08-06",
|
|
75
|
+
"cached_input": 1.25,
|
|
76
|
+
"input": 2.5,
|
|
77
|
+
"output": 10
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"provider": "OpenAI",
|
|
81
|
+
"model": "gpt-4o-2024-05-13",
|
|
82
|
+
"input": 5,
|
|
83
|
+
"output": 15
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"provider": "OpenAI",
|
|
87
|
+
"model": "gpt-4o-mini",
|
|
88
|
+
"cached_input": 0.075,
|
|
89
|
+
"input": 0.15,
|
|
90
|
+
"output": 0.6
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"provider": "OpenAI",
|
|
94
|
+
"model": "gpt-4o-mini-2024-07-18",
|
|
95
|
+
"cached_input": 0.075,
|
|
96
|
+
"input": 0.15,
|
|
97
|
+
"output": 0.6
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"provider": "OpenAI",
|
|
101
|
+
"model": "o1",
|
|
102
|
+
"cached_input": 7.5,
|
|
103
|
+
"input": 15,
|
|
104
|
+
"output": 60
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"provider": "OpenAI",
|
|
108
|
+
"model": "o1-2024-12-17",
|
|
109
|
+
"cached_input": 7.5,
|
|
110
|
+
"input": 15,
|
|
111
|
+
"output": 60
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"provider": "OpenAI",
|
|
115
|
+
"model": "o1-preview-2024-09-12",
|
|
116
|
+
"cached_input": 7.5,
|
|
117
|
+
"input": 15,
|
|
118
|
+
"output": 60
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"provider": "OpenAI",
|
|
122
|
+
"model": "o1-pro",
|
|
123
|
+
"input": 150,
|
|
124
|
+
"output": 600
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"provider": "OpenAI",
|
|
128
|
+
"model": "o1-pro-2025-03-19",
|
|
129
|
+
"input": 150,
|
|
130
|
+
"output": 600
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"provider": "OpenAI",
|
|
134
|
+
"model": "o3-mini",
|
|
135
|
+
"cached_input": 0.55,
|
|
136
|
+
"input": 1.1,
|
|
137
|
+
"output": 4.4
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"provider": "OpenAI",
|
|
141
|
+
"model": "o3-mini-2025-01-31",
|
|
142
|
+
"cached_input": 0.55,
|
|
143
|
+
"input": 1.1,
|
|
144
|
+
"output": 4.4
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"provider": "OpenAI",
|
|
148
|
+
"model": "o1-mini",
|
|
149
|
+
"cached_input": 0.55,
|
|
150
|
+
"input": 1.1,
|
|
151
|
+
"output": 4.4
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"provider": "OpenAI",
|
|
155
|
+
"model": "o1-mini-2024-09-12",
|
|
156
|
+
"cached_input": 0.55,
|
|
157
|
+
"input": 1.1,
|
|
158
|
+
"output": 4.4
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"provider": "OpenAI",
|
|
162
|
+
"model": "gpt-4o-mini-search-preview",
|
|
163
|
+
"input": 0.15,
|
|
164
|
+
"output": 0.6
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"provider": "OpenAI",
|
|
168
|
+
"model": "gpt-4o-mini-search-preview-2025-03-11",
|
|
169
|
+
"input": 0.15,
|
|
170
|
+
"output": 0.6
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"provider": "OpenAI",
|
|
174
|
+
"model": "gpt-4o-search-preview",
|
|
175
|
+
"input": 2.5,
|
|
176
|
+
"output": 10
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"provider": "OpenAI",
|
|
180
|
+
"model": "gpt-4o-search-preview-2025-03-11",
|
|
181
|
+
"input": 2.5,
|
|
182
|
+
"output": 10
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"provider": "OpenAI",
|
|
186
|
+
"model": "computer-use-preview",
|
|
187
|
+
"input": 3,
|
|
188
|
+
"output": 12
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"provider": "OpenAI",
|
|
192
|
+
"model": "computer-use-preview-2025-03-11",
|
|
193
|
+
"input": 3,
|
|
194
|
+
"output": 12
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"provider": "Anthropic",
|
|
198
|
+
"model": "claude-opus-4",
|
|
199
|
+
"cached_input": 1.5,
|
|
200
|
+
"input": 15,
|
|
201
|
+
"output": 75
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"provider": "Anthropic",
|
|
205
|
+
"model": "claude-sonnet-4",
|
|
206
|
+
"cached_input": 0.3,
|
|
207
|
+
"input": 3,
|
|
208
|
+
"output": 15
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"provider": "Anthropic",
|
|
212
|
+
"model": "claude-3-7-sonnet",
|
|
213
|
+
"cached_input": 0.3,
|
|
214
|
+
"input": 3,
|
|
215
|
+
"output": 15
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"provider": "Anthropic",
|
|
219
|
+
"model": "claude-3-5-sonnet",
|
|
220
|
+
"cached_input": 0.3,
|
|
221
|
+
"input": 3,
|
|
222
|
+
"output": 15
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"provider": "Anthropic",
|
|
226
|
+
"model": "claude-3-5-haiku",
|
|
227
|
+
"cached_input": 0.08,
|
|
228
|
+
"input": 0.8,
|
|
229
|
+
"output": 4
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"provider": "Anthropic",
|
|
233
|
+
"model": "claude-3-opus",
|
|
234
|
+
"cached_input": 1.5,
|
|
235
|
+
"input": 15,
|
|
236
|
+
"output": 75
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"provider": "Anthropic",
|
|
240
|
+
"model": "claude-3-haiku",
|
|
241
|
+
"cached_input": 0.03,
|
|
242
|
+
"input": 0.25,
|
|
243
|
+
"output": 1.25
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"provider": "Google/Gemini",
|
|
247
|
+
"model": "gemini-2.0-flash",
|
|
248
|
+
"cached_input": 0.025,
|
|
249
|
+
"input": 0.1,
|
|
250
|
+
"output": 0.4
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"provider": "Google/Gemini",
|
|
254
|
+
"model": "gemini-2.0-flash-lite",
|
|
255
|
+
"input": 0.075,
|
|
256
|
+
"output": 0.3
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"provider": "Google/Gemini",
|
|
260
|
+
"model": "gemini-1.5-flash",
|
|
261
|
+
"input": 0.3,
|
|
262
|
+
"output": 0.075
|
|
263
|
+
}
|
|
264
|
+
]
|
|
@@ -17,6 +17,7 @@ import anthropic.types.tool_choice_none_param
|
|
|
17
17
|
import anthropic.types.tool_choice_tool_param
|
|
18
18
|
import anthropic.types.tool_param
|
|
19
19
|
import anthropic.types.tool_text_editor_20250124_param
|
|
20
|
+
import anthropic.types.tool_union_param
|
|
20
21
|
import anthropic.types.web_search_tool_20250305_param
|
|
21
22
|
|
|
22
23
|
|
|
@@ -74,6 +75,7 @@ class SubmitInputArgs(TypedDict, total=False):
|
|
|
74
75
|
anthropic.types.tool_param.ToolParam,
|
|
75
76
|
anthropic.types.tool_bash_20250124_param.ToolBash20250124Param,
|
|
76
77
|
anthropic.types.tool_text_editor_20250124_param.ToolTextEditor20250124Param,
|
|
78
|
+
anthropic.types.tool_union_param.TextEditor20250429,
|
|
77
79
|
anthropic.types.web_search_tool_20250305_param.WebSearchTool20250305Param,
|
|
78
80
|
]
|
|
79
81
|
],
|
chatlas/types/openai/_client.py
CHANGED
|
@@ -13,6 +13,7 @@ class ChatClientArgs(TypedDict, total=False):
|
|
|
13
13
|
api_key: str | None
|
|
14
14
|
organization: str | None
|
|
15
15
|
project: str | None
|
|
16
|
+
webhook_secret: str | None
|
|
16
17
|
base_url: str | httpx.URL | None
|
|
17
18
|
websocket_base_url: str | httpx.URL | None
|
|
18
19
|
timeout: Union[float, openai.Timeout, None, openai.NotGiven]
|
|
@@ -16,6 +16,7 @@ class ChatAzureClientArgs(TypedDict, total=False):
|
|
|
16
16
|
azure_ad_token: str | None
|
|
17
17
|
organization: str | None
|
|
18
18
|
project: str | None
|
|
19
|
+
webhook_secret: str | None
|
|
19
20
|
base_url: str | None
|
|
20
21
|
websocket_base_url: str | httpx.URL | None
|
|
21
22
|
timeout: float | openai.Timeout | None | openai.NotGiven
|
chatlas/types/openai/_submit.py
CHANGED
|
@@ -63,6 +63,7 @@ class SubmitInputArgs(TypedDict, total=False):
|
|
|
63
63
|
"gpt-4o-audio-preview",
|
|
64
64
|
"gpt-4o-audio-preview-2024-10-01",
|
|
65
65
|
"gpt-4o-audio-preview-2024-12-17",
|
|
66
|
+
"gpt-4o-audio-preview-2025-06-03",
|
|
66
67
|
"gpt-4o-mini-audio-preview",
|
|
67
68
|
"gpt-4o-mini-audio-preview-2024-12-17",
|
|
68
69
|
"gpt-4o-search-preview",
|
|
@@ -130,7 +131,9 @@ class SubmitInputArgs(TypedDict, total=False):
|
|
|
130
131
|
openai.NotGiven,
|
|
131
132
|
]
|
|
132
133
|
seed: Union[int, None, openai.NotGiven]
|
|
133
|
-
service_tier: Union[
|
|
134
|
+
service_tier: Union[
|
|
135
|
+
Literal["auto", "default", "flex", "scale", "priority"], None, openai.NotGiven
|
|
136
|
+
]
|
|
134
137
|
stop: Union[str, None, list[str], openai.NotGiven]
|
|
135
138
|
store: Union[bool, None, openai.NotGiven]
|
|
136
139
|
stream: Union[Literal[False], None, Literal[True], openai.NotGiven]
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chatlas
|
|
3
|
+
Version: 0.9.0
|
|
4
|
+
Summary: A simple and consistent interface for chatting with LLMs
|
|
5
|
+
Project-URL: Homepage, https://posit-dev.github.io/chatlas
|
|
6
|
+
Project-URL: Documentation, https://posit-dev.github.io/chatlas
|
|
7
|
+
Project-URL: Repository, https://github.com/posit-dev/chatlas
|
|
8
|
+
Project-URL: Issues, https://github.com/posit-dev/chatlas/issues/
|
|
9
|
+
Project-URL: Changelog, https://github.com/posit-dev/chatlas/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: Carson Sievert <carson@posit.co>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Requires-Dist: jinja2
|
|
23
|
+
Requires-Dist: openai
|
|
24
|
+
Requires-Dist: orjson
|
|
25
|
+
Requires-Dist: pydantic>=2.0
|
|
26
|
+
Requires-Dist: requests
|
|
27
|
+
Requires-Dist: rich
|
|
28
|
+
Provides-Extra: anthropic
|
|
29
|
+
Requires-Dist: anthropic; extra == 'anthropic'
|
|
30
|
+
Provides-Extra: azure-openai
|
|
31
|
+
Provides-Extra: bedrock-anthropic
|
|
32
|
+
Requires-Dist: anthropic[bedrock]; extra == 'bedrock-anthropic'
|
|
33
|
+
Provides-Extra: databricks
|
|
34
|
+
Requires-Dist: databricks-sdk; extra == 'databricks'
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: anthropic[bedrock]; extra == 'dev'
|
|
37
|
+
Requires-Dist: databricks-sdk; extra == 'dev'
|
|
38
|
+
Requires-Dist: google-genai>=1.14.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: htmltools; extra == 'dev'
|
|
40
|
+
Requires-Dist: matplotlib; extra == 'dev'
|
|
41
|
+
Requires-Dist: numpy>1.24.4; extra == 'dev'
|
|
42
|
+
Requires-Dist: openai; extra == 'dev'
|
|
43
|
+
Requires-Dist: pillow; extra == 'dev'
|
|
44
|
+
Requires-Dist: python-dotenv; extra == 'dev'
|
|
45
|
+
Requires-Dist: ruff>=0.6.5; extra == 'dev'
|
|
46
|
+
Requires-Dist: shiny; extra == 'dev'
|
|
47
|
+
Requires-Dist: snowflake-ml-python>=1.8.4; extra == 'dev'
|
|
48
|
+
Requires-Dist: tenacity; extra == 'dev'
|
|
49
|
+
Requires-Dist: tiktoken; extra == 'dev'
|
|
50
|
+
Requires-Dist: torch; (python_version <= '3.11') and extra == 'dev'
|
|
51
|
+
Provides-Extra: docs
|
|
52
|
+
Requires-Dist: griffe>=1; extra == 'docs'
|
|
53
|
+
Requires-Dist: ipykernel; extra == 'docs'
|
|
54
|
+
Requires-Dist: ipywidgets; extra == 'docs'
|
|
55
|
+
Requires-Dist: nbclient; extra == 'docs'
|
|
56
|
+
Requires-Dist: nbformat; extra == 'docs'
|
|
57
|
+
Requires-Dist: numpy; extra == 'docs'
|
|
58
|
+
Requires-Dist: pandas; extra == 'docs'
|
|
59
|
+
Requires-Dist: pyyaml; extra == 'docs'
|
|
60
|
+
Requires-Dist: quartodoc>=0.7; extra == 'docs'
|
|
61
|
+
Requires-Dist: sentence-transformers; extra == 'docs'
|
|
62
|
+
Provides-Extra: github
|
|
63
|
+
Provides-Extra: google
|
|
64
|
+
Requires-Dist: google-genai>=1.14.0; extra == 'google'
|
|
65
|
+
Provides-Extra: groq
|
|
66
|
+
Provides-Extra: mcp
|
|
67
|
+
Requires-Dist: mcp>=1.4.0; (python_version >= '3.10') and extra == 'mcp'
|
|
68
|
+
Provides-Extra: ollama
|
|
69
|
+
Provides-Extra: openai
|
|
70
|
+
Provides-Extra: perplexity
|
|
71
|
+
Provides-Extra: snowflake
|
|
72
|
+
Requires-Dist: snowflake-ml-python; extra == 'snowflake'
|
|
73
|
+
Provides-Extra: test
|
|
74
|
+
Requires-Dist: pyright>=1.1.379; extra == 'test'
|
|
75
|
+
Requires-Dist: pytest-asyncio; extra == 'test'
|
|
76
|
+
Requires-Dist: pytest>=8.3.2; extra == 'test'
|
|
77
|
+
Requires-Dist: syrupy>=4; extra == 'test'
|
|
78
|
+
Provides-Extra: vertex
|
|
79
|
+
Requires-Dist: google-genai>=1.14.0; extra == 'vertex'
|
|
80
|
+
Description-Content-Type: text/markdown
|
|
81
|
+
|
|
82
|
+
# chatlas <a href="https://posit-dev.github.io/chatlas"><img src="docs/logos/hex/logo.png" align="right" height="138" alt="chatlas website" /></a>
|
|
83
|
+
|
|
84
|
+
<p>
|
|
85
|
+
<!-- badges start -->
|
|
86
|
+
<a href="https://pypi.org/project/chatlas/"><img alt="PyPI" src="https://img.shields.io/pypi/v/chatlas?logo=python&logoColor=white&color=orange"></a>
|
|
87
|
+
<a href="https://choosealicense.com/licenses/mit/"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="MIT License"></a>
|
|
88
|
+
<a href="https://pypi.org/project/chatlas"><img src="https://img.shields.io/pypi/pyversions/chatlas.svg" alt="versions"></a>
|
|
89
|
+
<a href="https://github.com/posit-dev/chatlas"><img src="https://github.com/posit-dev/chatlas/actions/workflows/test.yml/badge.svg?branch=main" alt="Python Tests"></a>
|
|
90
|
+
<!-- badges end -->
|
|
91
|
+
</p>
|
|
92
|
+
|
|
93
|
+
Your friendly guide to building LLM chat apps in Python with less effort and more clarity.
|
|
94
|
+
|
|
95
|
+
## Install
|
|
96
|
+
|
|
97
|
+
Install the latest stable release [from PyPI](https://pypi.org/project/chatlas/):
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install -U chatlas
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Or, install the latest development version from GitHub:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pip install -U git+https://github.com/posit-dev/chatlas
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Quick start
|
|
110
|
+
|
|
111
|
+
Get started in 3 simple steps:
|
|
112
|
+
|
|
113
|
+
1. Choose a model provider, such as [ChatOpenAI](https://posit-dev.github.io/chatlas/reference/ChatOpenAI.html) or [ChatAnthropic](https://posit-dev.github.io/chatlas/reference/ChatAnthropic.html).
|
|
114
|
+
2. Visit the provider's [reference](https://posit-dev.github.io/chatlas/reference) page to get setup with necessary credentials.
|
|
115
|
+
3. Create the relevant `Chat` client and start chatting!
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from chatlas import ChatOpenAI
|
|
119
|
+
|
|
120
|
+
# Optional (but recommended) model and system_prompt
|
|
121
|
+
chat = ChatOpenAI(
|
|
122
|
+
model="gpt-4.1-mini",
|
|
123
|
+
system_prompt="You are a helpful assistant.",
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# Optional tool registration
|
|
127
|
+
def get_current_weather(lat: float, lng: float):
|
|
128
|
+
"Get the current weather for a given location."
|
|
129
|
+
return "sunny"
|
|
130
|
+
|
|
131
|
+
chat.register_tool(get_current_weather)
|
|
132
|
+
|
|
133
|
+
# Send user prompt to the model for a response.
|
|
134
|
+
chat.chat("How's the weather in San Francisco?")
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
<img src="docs/images/chatlas-hello.png" alt="Model response output to the user query: 'How's the weather in San Francisco?'" width="67%" style="display: block; margin-left: auto; margin-right: auto">
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
Learn more at <https://posit-dev.github.io/chatlas>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
chatlas/__init__.py,sha256=s_v-xnhDl6AIoAEE_UTHMxbYX2ukjSFlDutjpYKGiVA,1625
|
|
2
|
+
chatlas/_anthropic.py,sha256=WpIyfXWwJA27qShgBcsUsMs9pA_dXpwPZZ3Liup-CnE,25555
|
|
3
|
+
chatlas/_auto.py,sha256=8a0ozUnPR8H4_h6BeUiObLN1mZEGTXDGAUbxYcD_a7U,5579
|
|
4
|
+
chatlas/_callbacks.py,sha256=3RpPaOQonTqScjXbaShgKJ1Rc-YxzWerxKRBjVssFnc,1838
|
|
5
|
+
chatlas/_chat.py,sha256=b6eKa6DkITeXZfDxbKk5LGN3pKlLaF2svt5LlsplyRw,80035
|
|
6
|
+
chatlas/_content.py,sha256=Jk0frLSdZTEyGu4KDHsgQbQQDHEX9nYVMNUXx4OKGSo,19775
|
|
7
|
+
chatlas/_content_image.py,sha256=EUK6wAint-JatLsiwvaPDu4D3W-NcIsDCkzABkXgfDg,8304
|
|
8
|
+
chatlas/_content_pdf.py,sha256=cffeuJxzhUDukQ-Srkmpy62M8X12skYpU_FVq-Wvya4,2420
|
|
9
|
+
chatlas/_databricks.py,sha256=yZ3h40pGJfJYtwvo3aC3-XiI_mFVK3TO7MAdqhOHyiU,4144
|
|
10
|
+
chatlas/_display.py,sha256=wyQzSc6z1VqrJfkTLkw1wQcti9s1Pr4qT8UxFJESn4U,4664
|
|
11
|
+
chatlas/_github.py,sha256=pDtU6T_gOI6HNPpK0nQRtIdLImONpNtCgd-JCJecuME,3903
|
|
12
|
+
chatlas/_google.py,sha256=Yp9SVuo3MCAZXEAUUUr57gzzHdsEgw-SPLoJhGuXBj0,20185
|
|
13
|
+
chatlas/_groq.py,sha256=8imeJFKiRbK1E212FdHsZ8fwHEVd0JmJfZe0H9qCWao,3653
|
|
14
|
+
chatlas/_interpolate.py,sha256=kqMrSmqxqzNCl9ReweZqT2hOtdfLOgNcOguLCfAHNMY,3641
|
|
15
|
+
chatlas/_live_render.py,sha256=UMZltE35LxziDKPMEeDwQ9meZ95SeqwhJi7j-y9pcro,4004
|
|
16
|
+
chatlas/_logging.py,sha256=weKvXZDIZ88X7X61ruXM_S0AAhQ5mgiW9dR-km8x7Mg,3324
|
|
17
|
+
chatlas/_mcp_manager.py,sha256=smMXeKZzP90MrlCdnTHMyo7AWHwl7J2jkU8dKSlnEsQ,10237
|
|
18
|
+
chatlas/_merge.py,sha256=SGj_BetgA7gaOqSBKOhYmW3CYeQKTEehFrXvx3y4OYE,3924
|
|
19
|
+
chatlas/_ollama.py,sha256=tgx7DjaIHsGh-lnr4TzbkKoelPVXp7goG3LbyJ8bnYM,3291
|
|
20
|
+
chatlas/_openai.py,sha256=sJTPMpzoSbYJswJv2hnKHgHZ3n8Za-gpfW_Ue41dNL0,24814
|
|
21
|
+
chatlas/_perplexity.py,sha256=KcGbOwKwdKX8eJJZzkW33SPt9mPE4aFWLAP0pzsOjeQ,3940
|
|
22
|
+
chatlas/_provider.py,sha256=0cl6JtMe6xRbc-ghp4JqdwTv6OQeewQUgdToRSktJ3I,5374
|
|
23
|
+
chatlas/_snowflake.py,sha256=2RlD9NG_xWcrRPIqQHJP40jyt0y2Qzw7kcSFkAWFTsY,24210
|
|
24
|
+
chatlas/_tokens.py,sha256=UQx4WEZwBxFahcRrZUFbbSJ5_dAMa_EUJyZKuZ2Wsfo,5105
|
|
25
|
+
chatlas/_tokens_old.py,sha256=L9d9oafrXvEx2u4nIn_Jjn7adnQyLBnYBuPwJUE8Pl8,5005
|
|
26
|
+
chatlas/_tools.py,sha256=bOXJ0ry6vQqU8Qm-PVdESN8HTuUv1teqPH_vtqILv9k,11088
|
|
27
|
+
chatlas/_turn.py,sha256=WsJ4-28qMtLTKD6OMIWxTdx7aA1fhn_Lu2bmqfaRakg,4497
|
|
28
|
+
chatlas/_typing_extensions.py,sha256=YdzmlyPSBpIEcsOkoz12e6jETT1XEMV2Q72haE4cfwY,1036
|
|
29
|
+
chatlas/_utils.py,sha256=Kku2fa1mvTYCr5D28VxE6-fwfy2e2doCi-eKQkLEg4Y,4686
|
|
30
|
+
chatlas/_version.py,sha256=fqtOm8q4HIqAgc-mXbjsKoz34kMK1y3t9LDhc4497WE,511
|
|
31
|
+
chatlas/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
+
chatlas/data/prices.json,sha256=vSzIgzneH2BI4p50NIA1KZHnh4AFBLjtS8bEVinwL50,4823
|
|
33
|
+
chatlas/types/__init__.py,sha256=P_EDL4eqsigKwB-u2qRmKlYQS5Y65m7oWjGC3cYmxO4,719
|
|
34
|
+
chatlas/types/anthropic/__init__.py,sha256=OwubA-DPHYpYo0XyRyAFwftOI0mOxtHzAyhUSLcDx54,417
|
|
35
|
+
chatlas/types/anthropic/_client.py,sha256=G0LRhoFBcsSOMr5qhP-0rAScsVXaVlHCpggfVp54bnQ,690
|
|
36
|
+
chatlas/types/anthropic/_client_bedrock.py,sha256=mNazQlu0pQt8JdzrYn3LKNgE4n732GjhQUJdQQK9QkY,785
|
|
37
|
+
chatlas/types/anthropic/_submit.py,sha256=VKoWuMdB4aFd1-O7Lys9aj1DU1tL7OnfkblkTCE-pxM,3526
|
|
38
|
+
chatlas/types/google/__init__.py,sha256=ZJhi8Kwvio2zp8T1TQqmvdHqkS-Khb6BGESPjREADgo,337
|
|
39
|
+
chatlas/types/google/_client.py,sha256=t7aKbxYq_xOA1Z3RnWcjewifdQFSHi7vKEj6MyKMCJk,729
|
|
40
|
+
chatlas/types/google/_submit.py,sha256=b-ZqMvI551Ia7pFlWdqUQJjov3neHmVwLFw-P2bgU8w,1883
|
|
41
|
+
chatlas/types/openai/__init__.py,sha256=Q2RAr1bSH1nHsxICK05nAmKmxdhKmhbBkWD_XHiVSrI,411
|
|
42
|
+
chatlas/types/openai/_client.py,sha256=xEnMiVFjeIQkfMtTWA4mZP_cQbh8uBphml0H7x4ot4Q,785
|
|
43
|
+
chatlas/types/openai/_client_azure.py,sha256=Dw8AgWgBgjSOkpYKAyjlx8Gxndc2E4FLww32FzqTRPg,889
|
|
44
|
+
chatlas/types/openai/_submit.py,sha256=ZaOGUlLBUOnMCqLeCwn97MBOAiTC2d6nM6D_0e6_fxs,6689
|
|
45
|
+
chatlas-0.9.0.dist-info/METADATA,sha256=9R9CkNPpixOznVBElkO-0WbvwwpnJU6ckNhXhELjGjQ,5524
|
|
46
|
+
chatlas-0.9.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
47
|
+
chatlas-0.9.0.dist-info/licenses/LICENSE,sha256=zyuGzPOC7CcbOaBHsQ3UEyKYRO56KDUkor0OA4LqqDg,1081
|
|
48
|
+
chatlas-0.9.0.dist-info/RECORD,,
|