chatlas 0.6.1__tar.gz → 0.7.1__tar.gz

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.

Potentially problematic release.


This version of chatlas might be problematic. Click here for more details.

Files changed (174) hide show
  1. {chatlas-0.6.1 → chatlas-0.7.1}/.github/workflows/test.yml +2 -0
  2. {chatlas-0.6.1 → chatlas-0.7.1}/CHANGELOG.md +36 -0
  3. chatlas-0.7.1/LICENSE +21 -0
  4. {chatlas-0.6.1 → chatlas-0.7.1}/PKG-INFO +14 -10
  5. {chatlas-0.6.1 → chatlas-0.7.1}/README.md +1 -0
  6. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/__init__.py +5 -0
  7. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_anthropic.py +12 -6
  8. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_auto.py +7 -3
  9. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_chat.py +339 -120
  10. chatlas-0.7.1/chatlas/_content.py +545 -0
  11. chatlas-0.7.1/chatlas/_databricks.py +139 -0
  12. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_display.py +13 -7
  13. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_github.py +0 -6
  14. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_google.py +11 -6
  15. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_groq.py +0 -6
  16. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_ollama.py +3 -8
  17. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_openai.py +13 -38
  18. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_perplexity.py +0 -6
  19. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_snowflake.py +46 -23
  20. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_utils.py +36 -1
  21. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_version.py +2 -2
  22. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/anthropic/_submit.py +2 -0
  23. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/openai/_submit.py +11 -1
  24. {chatlas-0.6.1 → chatlas-0.7.1}/docs/_quarto.yml +1 -0
  25. {chatlas-0.6.1 → chatlas-0.7.1}/pyproject.toml +18 -9
  26. {chatlas-0.6.1 → chatlas-0.7.1}/tests/conftest.py +47 -26
  27. chatlas-0.7.1/tests/images/dice.png +0 -0
  28. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_chat.py +5 -5
  29. chatlas-0.7.1/tests/test_content_tools.py +322 -0
  30. chatlas-0.7.1/tests/test_provider_anthropic.py +130 -0
  31. chatlas-0.7.1/tests/test_provider_databricks.py +80 -0
  32. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_provider_google.py +53 -23
  33. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_provider_openai.py +2 -1
  34. chatlas-0.6.1/chatlas/_content.py +0 -347
  35. chatlas-0.6.1/tests/test_content_tools.py +0 -153
  36. chatlas-0.6.1/tests/test_provider_anthropic.py +0 -103
  37. {chatlas-0.6.1 → chatlas-0.7.1}/.github/workflows/check-update-types.yml +0 -0
  38. {chatlas-0.6.1 → chatlas-0.7.1}/.github/workflows/docs-publish.yml +0 -0
  39. {chatlas-0.6.1 → chatlas-0.7.1}/.github/workflows/release.yml +0 -0
  40. {chatlas-0.6.1 → chatlas-0.7.1}/.gitignore +0 -0
  41. {chatlas-0.6.1 → chatlas-0.7.1}/.vscode/extensions.json +0 -0
  42. {chatlas-0.6.1 → chatlas-0.7.1}/.vscode/settings.json +0 -0
  43. {chatlas-0.6.1 → chatlas-0.7.1}/Makefile +0 -0
  44. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_content_image.py +0 -0
  45. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_content_pdf.py +0 -0
  46. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_interpolate.py +0 -0
  47. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_live_render.py +0 -0
  48. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_logging.py +0 -0
  49. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_merge.py +0 -0
  50. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_provider.py +0 -0
  51. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_tokens.py +0 -0
  52. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_tokens_old.py +0 -0
  53. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_tools.py +0 -0
  54. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_turn.py +0 -0
  55. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/_typing_extensions.py +0 -0
  56. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/py.typed +0 -0
  57. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/__init__.py +0 -0
  58. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/anthropic/__init__.py +0 -0
  59. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/anthropic/_client.py +0 -0
  60. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/anthropic/_client_bedrock.py +0 -0
  61. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/google/__init__.py +0 -0
  62. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/google/_client.py +0 -0
  63. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/google/_submit.py +0 -0
  64. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/openai/__init__.py +0 -0
  65. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/openai/_client.py +0 -0
  66. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/openai/_client_azure.py +0 -0
  67. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/snowflake/__init__.py +0 -0
  68. {chatlas-0.6.1 → chatlas-0.7.1}/chatlas/types/snowflake/_submit.py +0 -0
  69. {chatlas-0.6.1 → chatlas-0.7.1}/docs/.gitignore +0 -0
  70. {chatlas-0.6.1 → chatlas-0.7.1}/docs/_extensions/machow/interlinks/.gitignore +0 -0
  71. {chatlas-0.6.1 → chatlas-0.7.1}/docs/_extensions/machow/interlinks/_extension.yml +0 -0
  72. {chatlas-0.6.1 → chatlas-0.7.1}/docs/_extensions/machow/interlinks/interlinks.lua +0 -0
  73. {chatlas-0.6.1 → chatlas-0.7.1}/docs/_sidebar.yml +0 -0
  74. {chatlas-0.6.1 → chatlas-0.7.1}/docs/congressional-assets.png +0 -0
  75. {chatlas-0.6.1 → chatlas-0.7.1}/docs/examples/third-party-testing.txt +0 -0
  76. {chatlas-0.6.1 → chatlas-0.7.1}/docs/get-started.qmd +0 -0
  77. {chatlas-0.6.1 → chatlas-0.7.1}/docs/images/congressional-assets.png +0 -0
  78. {chatlas-0.6.1 → chatlas-0.7.1}/docs/images/logo.png +0 -0
  79. {chatlas-0.6.1 → chatlas-0.7.1}/docs/images/posit-logo.png +0 -0
  80. {chatlas-0.6.1 → chatlas-0.7.1}/docs/images/tool-calling-right.svg +0 -0
  81. {chatlas-0.6.1 → chatlas-0.7.1}/docs/images/tool-calling-wrong.svg +0 -0
  82. {chatlas-0.6.1 → chatlas-0.7.1}/docs/index.py +0 -0
  83. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/favicon/android-chrome-192x192.png +0 -0
  84. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/favicon/android-chrome-512x512.png +0 -0
  85. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/favicon/apple-touch-icon.png +0 -0
  86. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/favicon/favicon-16x16.png +0 -0
  87. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/favicon/favicon-32x32.png +0 -0
  88. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/favicon/favicon.ico +0 -0
  89. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/icon/brand-yml-icon-black.png +0 -0
  90. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/icon/brand-yml-icon-black.svg +0 -0
  91. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/icon/brand-yml-icon-color.png +0 -0
  92. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/icon/brand-yml-icon-color.svg +0 -0
  93. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/icon/brand-yml-icon-white.png +0 -0
  94. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/icon/brand-yml-icon-white.svg +0 -0
  95. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/tall/brand-yml-tall-black.png +0 -0
  96. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/tall/brand-yml-tall-black.svg +0 -0
  97. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/tall/brand-yml-tall-color.png +0 -0
  98. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/tall/brand-yml-tall-color.svg +0 -0
  99. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/tall/brand-yml-tall-white.png +0 -0
  100. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/tall/brand-yml-tall-white.svg +0 -0
  101. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/wide/brand-yml-wide-black.png +0 -0
  102. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/wide/brand-yml-wide-black.svg +0 -0
  103. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/wide/brand-yml-wide-color.png +0 -0
  104. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/wide/brand-yml-wide-color.svg +0 -0
  105. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/wide/brand-yml-wide-large-black.png +0 -0
  106. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/wide/brand-yml-wide-large-color.png +0 -0
  107. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/wide/brand-yml-wide-large-white.png +0 -0
  108. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/wide/brand-yml-wide-white.png +0 -0
  109. {chatlas-0.6.1 → chatlas-0.7.1}/docs/logos/wide/brand-yml-wide-white.svg +0 -0
  110. {chatlas-0.6.1 → chatlas-0.7.1}/docs/prompt-design.qmd +0 -0
  111. {chatlas-0.6.1 → chatlas-0.7.1}/docs/rag.qmd +0 -0
  112. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/Chat.qmd +0 -0
  113. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/ChatAnthropic.qmd +0 -0
  114. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/ChatAzureOpenAI.qmd +0 -0
  115. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/ChatBedrockAnthropic.qmd +0 -0
  116. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/ChatGithub.qmd +0 -0
  117. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/ChatGoogle.qmd +0 -0
  118. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/ChatGroq.qmd +0 -0
  119. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/ChatOllama.qmd +0 -0
  120. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/ChatOpenAI.qmd +0 -0
  121. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/ChatPerplexity.qmd +0 -0
  122. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/ChatVertex.qmd +0 -0
  123. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/Provider.qmd +0 -0
  124. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/Tool.qmd +0 -0
  125. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/Turn.qmd +0 -0
  126. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/content_image_file.qmd +0 -0
  127. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/content_image_plot.qmd +0 -0
  128. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/content_image_url.qmd +0 -0
  129. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/image_file.qmd +0 -0
  130. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/image_plot.qmd +0 -0
  131. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/image_url.qmd +0 -0
  132. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/index.qmd +0 -0
  133. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/interpolate.qmd +0 -0
  134. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/interpolate_file.qmd +0 -0
  135. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/token_usage.qmd +0 -0
  136. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.ChatResponse.qmd +0 -0
  137. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.ChatResponseAsync.qmd +0 -0
  138. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.Content.qmd +0 -0
  139. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.ContentImage.qmd +0 -0
  140. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.ContentImageInline.qmd +0 -0
  141. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.ContentImageRemote.qmd +0 -0
  142. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.ContentJson.qmd +0 -0
  143. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.ContentText.qmd +0 -0
  144. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.ContentToolRequest.qmd +0 -0
  145. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.ContentToolResult.qmd +0 -0
  146. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.ImageContentTypes.qmd +0 -0
  147. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.MISSING.qmd +0 -0
  148. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.MISSING_TYPE.qmd +0 -0
  149. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.SubmitInputArgsT.qmd +0 -0
  150. {chatlas-0.6.1 → chatlas-0.7.1}/docs/reference/types.TokenUsage.qmd +0 -0
  151. {chatlas-0.6.1 → chatlas-0.7.1}/docs/structured-data.qmd +0 -0
  152. {chatlas-0.6.1 → chatlas-0.7.1}/docs/styles.scss +0 -0
  153. {chatlas-0.6.1 → chatlas-0.7.1}/docs/tool-calling.qmd +0 -0
  154. {chatlas-0.6.1 → chatlas-0.7.1}/docs/web-apps.qmd +0 -0
  155. {chatlas-0.6.1 → chatlas-0.7.1}/pytest.ini +0 -0
  156. {chatlas-0.6.1 → chatlas-0.7.1}/scripts/_generate_anthropic_types.py +0 -0
  157. {chatlas-0.6.1 → chatlas-0.7.1}/scripts/_generate_google_types.py +0 -0
  158. {chatlas-0.6.1 → chatlas-0.7.1}/scripts/_generate_openai_types.py +0 -0
  159. {chatlas-0.6.1 → chatlas-0.7.1}/scripts/_generate_snowflake_types.py +0 -0
  160. {chatlas-0.6.1 → chatlas-0.7.1}/scripts/_utils.py +0 -0
  161. {chatlas-0.6.1 → chatlas-0.7.1}/scripts/main.py +0 -0
  162. {chatlas-0.6.1 → chatlas-0.7.1}/tests/__init__.py +0 -0
  163. {chatlas-0.6.1 → chatlas-0.7.1}/tests/__snapshots__/test_chat.ambr +0 -0
  164. {chatlas-0.6.1 → chatlas-0.7.1}/tests/apples.pdf +0 -0
  165. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_auto.py +0 -0
  166. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_content.py +0 -0
  167. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_content_image.py +0 -0
  168. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_content_pdf.py +0 -0
  169. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_interpolate.py +0 -0
  170. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_provider_azure.py +0 -0
  171. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_provider_bedrock.py +0 -0
  172. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_tokens.py +0 -0
  173. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_turns.py +0 -0
  174. {chatlas-0.6.1 → chatlas-0.7.1}/tests/test_utils_merge.py +0 -0
@@ -29,6 +29,8 @@ jobs:
29
29
  ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
30
30
  GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
31
31
  AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
32
+ DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
33
+ DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
32
34
  # Free tier of Google is rate limited, so we only test on 3.12
33
35
  TEST_GOOGLE: ${{ matrix.config.test_google }}
34
36
  # Free tier of Azure is rate limited, so we only test on 3.12
@@ -7,6 +7,42 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
7
7
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
  -->
9
9
 
10
+ ## [0.7.1] - 2025-05-10
11
+
12
+ * Added `openai` as a hard dependency, making installation easier for a wide range of use cases. (#91)
13
+
14
+ ## [0.7.0] - 2025-04-22
15
+
16
+ ### New features
17
+
18
+ * Added `ChatDatabricks()`, for chatting with Databrick's [foundation models](https://docs.databricks.com/aws/en/machine-learning/model-serving/score-foundation-models). (#82)
19
+ * `.stream()` and `.stream_async()` gain a `content` argument. Set this to `"all"` to include `ContentToolResult`/`ContentToolRequest` objects in the stream. (#75)
20
+ * `ContentToolResult`/`ContentToolRequest` are now exported to `chatlas` namespace. (#75)
21
+ * `ContentToolResult`/`ContentToolRequest` gain a `.tagify()` method so they render sensibly in a Shiny app. (#75)
22
+ * A tool can now return a `ContentToolResult`. This is useful for:
23
+ * Specifying the format used for sending the tool result to the chat model (`model_format`). (#87)
24
+ * Custom rendering of the tool result (by overriding relevant methods in a subclass). (#75)
25
+ * `Chat` gains a new `.current_display` property. When a `.chat()` or `.stream()` is currently active, this property returns an object with a `.echo()` method (to echo new content to the display). This is primarily useful for displaying custom content during a tool call. (#79)
26
+
27
+ ### Improvements
28
+
29
+ * When a tool call ends in failure, a warning is now raised and the stacktrace is printed. (#79)
30
+ * Several improvements to `ChatSnowflake()`:
31
+ * `.extract_data()` is now supported.
32
+ * `async` methods are now supported. (#81)
33
+ * Fixed an issue with more than one session being active at once. (#83)
34
+ * `ChatAnthropic()` no longer chokes after receiving an output that consists only of whitespace. (#86)
35
+ * `orjson` is now used for JSON loading and dumping. (#87)
36
+
37
+ ### Changes
38
+
39
+ * The `echo` argument of the `.chat()` method defaults to a new value of `"output"`. As a result, tool requests and results are now echoed by default. To revert to the previous behavior, set `echo="text"`. (#78)
40
+ * Tool results are now dumped to JSON by default before being sent to the model. To revert to the previous behavior, have the tool return a `ContentToolResult` with `model_format="str"`. (#87)
41
+
42
+ ### Breaking changes
43
+
44
+ * The `.export()` method's `include` argument has been renamed to `content` (to match `.stream()`). (#75)
45
+
10
46
  ## [0.6.1] - 2025-04-03
11
47
 
12
48
  ### Bug fixes
chatlas-0.7.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022-2025 Posit Software, PBC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chatlas
3
- Version: 0.6.1
3
+ Version: 0.7.1
4
4
  Summary: A simple and consistent interface for chatting with LLMs
5
5
  Project-URL: Homepage, https://posit-dev.github.io/chatlas
6
6
  Project-URL: Documentation, https://posit-dev.github.io/chatlas
@@ -8,6 +8,8 @@ Project-URL: Repository, https://github.com/posit-dev/chatlas
8
8
  Project-URL: Issues, https://github.com/posit-dev/chatlas/issues/
9
9
  Project-URL: Changelog, https://github.com/posit-dev/chatlas/blob/main/CHANGELOG.md
10
10
  Author-email: Carson Sievert <carson@posit.co>
11
+ License-Expression: MIT
12
+ License-File: LICENSE
11
13
  Classifier: Development Status :: 4 - Beta
12
14
  Classifier: Intended Audience :: Developers
13
15
  Classifier: License :: OSI Approved :: MIT License
@@ -18,18 +20,23 @@ Classifier: Programming Language :: Python :: 3.12
18
20
  Classifier: Programming Language :: Python :: 3.13
19
21
  Requires-Python: >=3.9
20
22
  Requires-Dist: jinja2
23
+ Requires-Dist: openai
24
+ Requires-Dist: orjson
21
25
  Requires-Dist: pydantic>=2.0
22
26
  Requires-Dist: requests
23
27
  Requires-Dist: rich
24
28
  Provides-Extra: anthropic
25
29
  Requires-Dist: anthropic; extra == 'anthropic'
26
30
  Provides-Extra: azure-openai
27
- Requires-Dist: openai; extra == 'azure-openai'
28
31
  Provides-Extra: bedrock-anthropic
29
32
  Requires-Dist: anthropic[bedrock]; extra == 'bedrock-anthropic'
33
+ Provides-Extra: databricks
34
+ Requires-Dist: databricks-sdk; extra == 'databricks'
30
35
  Provides-Extra: dev
31
36
  Requires-Dist: anthropic[bedrock]; extra == 'dev'
32
- Requires-Dist: google-genai>=1.2.0; 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'
33
40
  Requires-Dist: matplotlib; extra == 'dev'
34
41
  Requires-Dist: numpy>1.24.4; extra == 'dev'
35
42
  Requires-Dist: openai; extra == 'dev'
@@ -38,6 +45,7 @@ Requires-Dist: python-dotenv; extra == 'dev'
38
45
  Requires-Dist: ruff>=0.6.5; extra == 'dev'
39
46
  Requires-Dist: shiny; extra == 'dev'
40
47
  Requires-Dist: snowflake-ml-python; extra == 'dev'
48
+ Requires-Dist: tenacity; extra == 'dev'
41
49
  Requires-Dist: tiktoken; extra == 'dev'
42
50
  Requires-Dist: torch; (python_version <= '3.11') and extra == 'dev'
43
51
  Provides-Extra: docs
@@ -52,17 +60,12 @@ Requires-Dist: pyyaml; extra == 'docs'
52
60
  Requires-Dist: quartodoc>=0.7; extra == 'docs'
53
61
  Requires-Dist: sentence-transformers; extra == 'docs'
54
62
  Provides-Extra: github
55
- Requires-Dist: openai; extra == 'github'
56
63
  Provides-Extra: google
57
- Requires-Dist: google-genai; extra == 'google'
64
+ Requires-Dist: google-genai>=1.14.0; extra == 'google'
58
65
  Provides-Extra: groq
59
- Requires-Dist: openai; extra == 'groq'
60
66
  Provides-Extra: ollama
61
- Requires-Dist: openai; extra == 'ollama'
62
67
  Provides-Extra: openai
63
- Requires-Dist: openai; extra == 'openai'
64
68
  Provides-Extra: perplexity
65
- Requires-Dist: openai; extra == 'perplexity'
66
69
  Provides-Extra: snowflake
67
70
  Requires-Dist: snowflake-ml-python; extra == 'snowflake'
68
71
  Provides-Extra: test
@@ -71,7 +74,7 @@ Requires-Dist: pytest-asyncio; extra == 'test'
71
74
  Requires-Dist: pytest>=8.3.2; extra == 'test'
72
75
  Requires-Dist: syrupy>=4; extra == 'test'
73
76
  Provides-Extra: vertex
74
- Requires-Dist: google-genai; extra == 'vertex'
77
+ Requires-Dist: google-genai>=1.14.0; extra == 'vertex'
75
78
  Description-Content-Type: text/markdown
76
79
 
77
80
  <h1 class="unnumbered unlisted"> chatlas <a href="https://posit-dev.github.io/chatlas"><img src="docs/images/logo.png" align="right" height="138" alt="chatlas website" /></a> </h1>
@@ -123,6 +126,7 @@ It also supports the following enterprise cloud providers:
123
126
 
124
127
  * AWS Bedrock: [`ChatBedrockAnthropic()`](https://posit-dev.github.io/chatlas/reference/ChatBedrockAnthropic.html).
125
128
  * Azure OpenAI: [`ChatAzureOpenAI()`](https://posit-dev.github.io/chatlas/reference/ChatAzureOpenAI.html).
129
+ * Databricks: [`ChatDatabricks()`](https://posit-dev.github.io/chatlas/reference/ChatDatabricks.html).
126
130
  * Snowflake Cortex: [`ChatSnowflake()`](https://posit-dev.github.io/chatlas/reference/ChatSnowflake.html).
127
131
  * Vertex AI: [`ChatVertex()`](https://posit-dev.github.io/chatlas/reference/ChatVertex.html).
128
132
 
@@ -47,6 +47,7 @@ It also supports the following enterprise cloud providers:
47
47
 
48
48
  * AWS Bedrock: [`ChatBedrockAnthropic()`](https://posit-dev.github.io/chatlas/reference/ChatBedrockAnthropic.html).
49
49
  * Azure OpenAI: [`ChatAzureOpenAI()`](https://posit-dev.github.io/chatlas/reference/ChatAzureOpenAI.html).
50
+ * Databricks: [`ChatDatabricks()`](https://posit-dev.github.io/chatlas/reference/ChatDatabricks.html).
50
51
  * Snowflake Cortex: [`ChatSnowflake()`](https://posit-dev.github.io/chatlas/reference/ChatSnowflake.html).
51
52
  * Vertex AI: [`ChatVertex()`](https://posit-dev.github.io/chatlas/reference/ChatVertex.html).
52
53
 
@@ -2,8 +2,10 @@ from . import types
2
2
  from ._anthropic import ChatAnthropic, ChatBedrockAnthropic
3
3
  from ._auto import ChatAuto
4
4
  from ._chat import Chat
5
+ from ._content import ContentToolRequest, ContentToolResult
5
6
  from ._content_image import content_image_file, content_image_plot, content_image_url
6
7
  from ._content_pdf import content_pdf_file, content_pdf_url
8
+ from ._databricks import ChatDatabricks
7
9
  from ._github import ChatGithub
8
10
  from ._google import ChatGoogle, ChatVertex
9
11
  from ._groq import ChatGroq
@@ -26,6 +28,7 @@ __all__ = (
26
28
  "ChatAnthropic",
27
29
  "ChatAuto",
28
30
  "ChatBedrockAnthropic",
31
+ "ChatDatabricks",
29
32
  "ChatGithub",
30
33
  "ChatGoogle",
31
34
  "ChatGroq",
@@ -41,6 +44,8 @@ __all__ = (
41
44
  "content_image_url",
42
45
  "content_pdf_file",
43
46
  "content_pdf_url",
47
+ "ContentToolRequest",
48
+ "ContentToolResult",
44
49
  "interpolate",
45
50
  "interpolate_file",
46
51
  "Provider",
@@ -1,10 +1,10 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import base64
4
- import json
5
4
  import warnings
6
5
  from typing import TYPE_CHECKING, Any, Literal, Optional, Union, cast, overload
7
6
 
7
+ import orjson
8
8
  from pydantic import BaseModel
9
9
 
10
10
  from ._chat import Chat
@@ -366,8 +366,8 @@ class AnthropicProvider(Provider[Message, RawMessageStreamEvent, Message]):
366
366
  this_content = completion.content[chunk.index]
367
367
  if this_content.type == "tool_use" and isinstance(this_content.input, str):
368
368
  try:
369
- this_content.input = json.loads(this_content.input or "{}")
370
- except json.JSONDecodeError as e:
369
+ this_content.input = orjson.loads(this_content.input or "{}")
370
+ except orjson.JSONDecodeError as e:
371
371
  raise ValueError(f"Invalid JSON input: {e}")
372
372
  elif chunk.type == "message_delta":
373
373
  completion.stop_reason = chunk.delta.stop_reason
@@ -451,7 +451,10 @@ class AnthropicProvider(Provider[Message, RawMessageStreamEvent, Message]):
451
451
  @staticmethod
452
452
  def _as_content_block(content: Content) -> "ContentBlockParam":
453
453
  if isinstance(content, ContentText):
454
- return {"text": content.text, "type": "text"}
454
+ text = content.text
455
+ if text == "" or text.isspace():
456
+ text = "[empty string]"
457
+ return {"type": "text", "text": text}
455
458
  elif isinstance(content, ContentJson):
456
459
  return {"text": "<structured data/>", "type": "text"}
457
460
  elif isinstance(content, ContentPDF):
@@ -485,12 +488,15 @@ class AnthropicProvider(Provider[Message, RawMessageStreamEvent, Message]):
485
488
  "input": content.arguments,
486
489
  }
487
490
  elif isinstance(content, ContentToolResult):
488
- return {
491
+ res: ToolResultBlockParam = {
489
492
  "type": "tool_result",
490
493
  "tool_use_id": content.id,
491
- "content": content.get_final_value(),
492
494
  "is_error": content.error is not None,
493
495
  }
496
+ # Anthropic supports non-text contents like ImageBlockParam
497
+ res["content"] = content.get_model_value() # type: ignore
498
+ return res
499
+
494
500
  raise ValueError(f"Unknown content type: {type(content)}")
495
501
 
496
502
  @staticmethod
@@ -1,11 +1,13 @@
1
1
  from __future__ import annotations
2
2
 
3
- import json
4
3
  import os
5
4
  from typing import Callable, Literal, Optional
6
5
 
6
+ import orjson
7
+
7
8
  from ._anthropic import ChatAnthropic, ChatBedrockAnthropic
8
9
  from ._chat import Chat
10
+ from ._databricks import ChatDatabricks
9
11
  from ._github import ChatGithub
10
12
  from ._google import ChatGoogle, ChatVertex
11
13
  from ._groq import ChatGroq
@@ -18,6 +20,7 @@ from ._turn import Turn
18
20
  AutoProviders = Literal[
19
21
  "anthropic",
20
22
  "bedrock-anthropic",
23
+ "databricks",
21
24
  "github",
22
25
  "google",
23
26
  "groq",
@@ -32,6 +35,7 @@ AutoProviders = Literal[
32
35
  _provider_chat_model_map: dict[AutoProviders, Callable[..., Chat]] = {
33
36
  "anthropic": ChatAnthropic,
34
37
  "bedrock-anthropic": ChatBedrockAnthropic,
38
+ "databricks": ChatDatabricks,
35
39
  "github": ChatGithub,
36
40
  "google": ChatGoogle,
37
41
  "groq": ChatGroq,
@@ -55,7 +59,7 @@ def ChatAuto(
55
59
  """
56
60
  Use environment variables (env vars) to configure the Chat provider and model.
57
61
 
58
- Creates a `:class:~chatlas.Chat` instance based on the specified provider.
62
+ Creates a :class:`~chatlas.Chat` instance based on the specified provider.
59
63
  The provider may be specified through the `provider` parameter and/or the
60
64
  `CHATLAS_CHAT_PROVIDER` env var. If both are set, the env var takes
61
65
  precedence. Similarly, the provider's model may be specified through the
@@ -175,7 +179,7 @@ def ChatAuto(
175
179
 
176
180
  env_kwargs = {}
177
181
  if env_kwargs_str := os.environ.get("CHATLAS_CHAT_ARGS"):
178
- env_kwargs = json.loads(env_kwargs_str)
182
+ env_kwargs = orjson.loads(env_kwargs_str)
179
183
 
180
184
  kwargs = {**kwargs, **env_kwargs, **base_args}
181
185
  kwargs = {k: v for k, v in kwargs.items() if v is not None}