livekit-plugins-anthropic 0.2.8__py3-none-any.whl → 0.2.10__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.
@@ -39,7 +39,7 @@ from livekit.agents import (
39
39
  llm,
40
40
  utils,
41
41
  )
42
- from livekit.agents.llm import ToolChoice
42
+ from livekit.agents.llm import LLMCapabilities, ToolChoice
43
43
  from livekit.agents.llm.function_context import (
44
44
  _create_ai_function_info,
45
45
  _is_optional_type,
@@ -82,7 +82,13 @@ class LLM(llm.LLM):
82
82
  ``api_key`` must be set to your Anthropic API key, either using the argument or by setting
83
83
  the ``ANTHROPIC_API_KEY`` environmental variable.
84
84
  """
85
- super().__init__()
85
+
86
+ super().__init__(
87
+ capabilities=LLMCapabilities(
88
+ requires_persistent_functions=True,
89
+ supports_choices_on_int=True,
90
+ )
91
+ )
86
92
 
87
93
  # throw an error on our end
88
94
  api_key = api_key or os.environ.get("ANTHROPIC_API_KEY")
@@ -206,6 +212,7 @@ class LLMStream(llm.LLMStream):
206
212
  self._output_tokens = 0
207
213
 
208
214
  async def _run(self) -> None:
215
+ retryable = True
209
216
  try:
210
217
  if not self._anthropic_stream:
211
218
  self._anthropic_stream = await self._awaitable_anthropic_stream
@@ -215,6 +222,7 @@ class LLMStream(llm.LLMStream):
215
222
  chat_chunk = self._parse_event(event)
216
223
  if chat_chunk is not None:
217
224
  self._event_ch.send_nowait(chat_chunk)
225
+ retryable = False
218
226
 
219
227
  self._event_ch.send_nowait(
220
228
  llm.ChatChunk(
@@ -227,7 +235,7 @@ class LLMStream(llm.LLMStream):
227
235
  )
228
236
  )
229
237
  except anthropic.APITimeoutError:
230
- raise APITimeoutError()
238
+ raise APITimeoutError(retryable=retryable)
231
239
  except anthropic.APIStatusError as e:
232
240
  raise APIStatusError(
233
241
  e.message,
@@ -236,7 +244,7 @@ class LLMStream(llm.LLMStream):
236
244
  body=e.body,
237
245
  )
238
246
  except Exception as e:
239
- raise APIConnectionError() from e
247
+ raise APIConnectionError(retryable=retryable) from e
240
248
 
241
249
  def _parse_event(
242
250
  self, event: anthropic.types.RawMessageStreamEvent
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "0.2.8"
15
+ __version__ = "0.2.10"
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: livekit-plugins-anthropic
3
- Version: 0.2.8
3
+ Version: 0.2.10
4
4
  Summary: Agent Framework plugin for services from Anthropic
5
5
  Home-page: https://github.com/livekit/agents
6
6
  License: Apache-2.0
@@ -21,6 +21,16 @@ Requires-Python: >=3.9.0
21
21
  Description-Content-Type: text/markdown
22
22
  Requires-Dist: livekit-agents>=0.12.3
23
23
  Requires-Dist: anthropic>=0.34
24
+ Dynamic: classifier
25
+ Dynamic: description
26
+ Dynamic: description-content-type
27
+ Dynamic: home-page
28
+ Dynamic: keywords
29
+ Dynamic: license
30
+ Dynamic: project-url
31
+ Dynamic: requires-dist
32
+ Dynamic: requires-python
33
+ Dynamic: summary
24
34
 
25
35
  # LiveKit Plugins Anthropic
26
36
 
@@ -0,0 +1,10 @@
1
+ livekit/plugins/anthropic/__init__.py,sha256=1WCyNEaR6qBsX54qJQM0SeY-QHIucww16PLXcSnMqRo,1175
2
+ livekit/plugins/anthropic/llm.py,sha256=xRayMqq_FXFGZwskpqcINKVCbXL-754Jh2CJMWvxJnY,19261
3
+ livekit/plugins/anthropic/log.py,sha256=fG1pYSY88AnT738gZrmzF9FO4l4BdGENj3VKHMQB3Yo,72
4
+ livekit/plugins/anthropic/models.py,sha256=wyTr2nl6SL4ylN6s4mHJcqtmgV2mjJysZo89FknWdhI,213
5
+ livekit/plugins/anthropic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ livekit/plugins/anthropic/version.py,sha256=vT0ONEJ_8wtOHcTDpZ96O0mQtrdNrO2FOuqDfAOF_bI,601
7
+ livekit_plugins_anthropic-0.2.10.dist-info/METADATA,sha256=8DF-B_YzfayulYZMpOB2_smktfH8s9gKXXXeccz5J4U,1481
8
+ livekit_plugins_anthropic-0.2.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
9
+ livekit_plugins_anthropic-0.2.10.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
10
+ livekit_plugins_anthropic-0.2.10.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,10 +0,0 @@
1
- livekit/plugins/anthropic/__init__.py,sha256=1WCyNEaR6qBsX54qJQM0SeY-QHIucww16PLXcSnMqRo,1175
2
- livekit/plugins/anthropic/llm.py,sha256=e65Z_YchNHCXN2F1kKb8lczfSY1_Ak8Y_94nT12pZGI,18975
3
- livekit/plugins/anthropic/log.py,sha256=fG1pYSY88AnT738gZrmzF9FO4l4BdGENj3VKHMQB3Yo,72
4
- livekit/plugins/anthropic/models.py,sha256=wyTr2nl6SL4ylN6s4mHJcqtmgV2mjJysZo89FknWdhI,213
5
- livekit/plugins/anthropic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- livekit/plugins/anthropic/version.py,sha256=711Prlpzg5p2xCBjcE2dctFtzW_seKcOBI5-dvNUVK4,600
7
- livekit_plugins_anthropic-0.2.8.dist-info/METADATA,sha256=xG06Y2Xf9RjmmBqJ314_6ZmFlEM0ZCo00K82wJHEHHo,1265
8
- livekit_plugins_anthropic-0.2.8.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
9
- livekit_plugins_anthropic-0.2.8.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
10
- livekit_plugins_anthropic-0.2.8.dist-info/RECORD,,