livekit-plugins-anthropic 1.0.0rc4__py3-none-any.whl → 1.0.0rc6__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.
- livekit/plugins/anthropic/llm.py +15 -16
- livekit/plugins/anthropic/utils.py +2 -2
- livekit/plugins/anthropic/version.py +1 -1
- {livekit_plugins_anthropic-1.0.0rc4.dist-info → livekit_plugins_anthropic-1.0.0rc6.dist-info}/METADATA +3 -3
- livekit_plugins_anthropic-1.0.0rc6.dist-info/RECORD +10 -0
- livekit_plugins_anthropic-1.0.0rc4.dist-info/RECORD +0 -10
- {livekit_plugins_anthropic-1.0.0rc4.dist-info → livekit_plugins_anthropic-1.0.0rc6.dist-info}/WHEEL +0 -0
livekit/plugins/anthropic/llm.py
CHANGED
@@ -44,7 +44,7 @@ class _LLMOptions:
|
|
44
44
|
user: NotGivenOr[str]
|
45
45
|
temperature: NotGivenOr[float]
|
46
46
|
parallel_tool_calls: NotGivenOr[bool]
|
47
|
-
tool_choice: NotGivenOr[ToolChoice
|
47
|
+
tool_choice: NotGivenOr[ToolChoice]
|
48
48
|
caching: NotGivenOr[Literal["ephemeral"]]
|
49
49
|
top_k: NotGivenOr[int]
|
50
50
|
max_tokens: NotGivenOr[int]
|
@@ -64,7 +64,7 @@ class LLM(llm.LLM):
|
|
64
64
|
max_tokens: NotGivenOr[int] = NOT_GIVEN,
|
65
65
|
temperature: NotGivenOr[float] = NOT_GIVEN,
|
66
66
|
parallel_tool_calls: NotGivenOr[bool] = NOT_GIVEN,
|
67
|
-
tool_choice: NotGivenOr[ToolChoice
|
67
|
+
tool_choice: NotGivenOr[ToolChoice] = NOT_GIVEN,
|
68
68
|
caching: NotGivenOr[Literal["ephemeral"]] = NOT_GIVEN,
|
69
69
|
) -> None:
|
70
70
|
"""
|
@@ -74,14 +74,14 @@ class LLM(llm.LLM):
|
|
74
74
|
the ``ANTHROPIC_API_KEY`` environmental variable.
|
75
75
|
|
76
76
|
model (str | ChatModels): The model to use. Defaults to "claude-3-5-sonnet-20241022".
|
77
|
-
api_key (str
|
78
|
-
base_url (str
|
79
|
-
user (str
|
77
|
+
api_key (str, optional): The Anthropic API key. Defaults to the ANTHROPIC_API_KEY environment variable.
|
78
|
+
base_url (str, optional): The base URL for the Anthropic API. Defaults to None.
|
79
|
+
user (str, optional): The user for the Anthropic API. Defaults to None.
|
80
80
|
client (anthropic.AsyncClient | None): The Anthropic client to use. Defaults to None.
|
81
|
-
temperature (float
|
82
|
-
parallel_tool_calls (bool
|
83
|
-
tool_choice (
|
84
|
-
caching (Literal["ephemeral"]
|
81
|
+
temperature (float, optional): The temperature for the Anthropic API. Defaults to None.
|
82
|
+
parallel_tool_calls (bool, optional): Whether to parallelize tool calls. Defaults to None.
|
83
|
+
tool_choice (ToolChoice, optional): The tool choice for the Anthropic API. Defaults to "auto".
|
84
|
+
caching (Literal["ephemeral"], optional): If set to "ephemeral", caching will be enabled for the system prompt, tools, and chat history.
|
85
85
|
""" # noqa: E501
|
86
86
|
|
87
87
|
super().__init__()
|
@@ -121,7 +121,7 @@ class LLM(llm.LLM):
|
|
121
121
|
tools: list[FunctionTool] | None = None,
|
122
122
|
conn_options: APIConnectOptions = DEFAULT_API_CONNECT_OPTIONS,
|
123
123
|
parallel_tool_calls: NotGivenOr[bool] = NOT_GIVEN,
|
124
|
-
tool_choice: NotGivenOr[ToolChoice
|
124
|
+
tool_choice: NotGivenOr[ToolChoice] = NOT_GIVEN,
|
125
125
|
extra_kwargs: NotGivenOr[dict[str, Any]] = NOT_GIVEN,
|
126
126
|
) -> LLMStream:
|
127
127
|
extra = {}
|
@@ -145,12 +145,11 @@ class LLM(llm.LLM):
|
|
145
145
|
tool_choice = tool_choice if is_given(tool_choice) else self._opts.tool_choice
|
146
146
|
if is_given(tool_choice):
|
147
147
|
anthropic_tool_choice: dict[str, Any] | None = {"type": "auto"}
|
148
|
-
if isinstance(tool_choice,
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
}
|
148
|
+
if isinstance(tool_choice, dict) and tool_choice.get("type") == "function":
|
149
|
+
anthropic_tool_choice = {
|
150
|
+
"type": "tool",
|
151
|
+
"name": tool_choice["function"]["name"],
|
152
|
+
}
|
154
153
|
elif isinstance(tool_choice, str):
|
155
154
|
if tool_choice == "required":
|
156
155
|
anthropic_tool_choice = {"type": "any"}
|
@@ -36,7 +36,7 @@ def to_chat_ctx(
|
|
36
36
|
for i, msg in enumerate(chat_ctx.items):
|
37
37
|
if msg.type == "message" and msg.role == "system":
|
38
38
|
for content in msg.content:
|
39
|
-
if isinstance(content, str):
|
39
|
+
if content and isinstance(content, str):
|
40
40
|
system_message = anthropic.types.TextBlockParam(
|
41
41
|
text=content,
|
42
42
|
type="text",
|
@@ -64,7 +64,7 @@ def to_chat_ctx(
|
|
64
64
|
|
65
65
|
if msg.type == "message":
|
66
66
|
for c in msg.content:
|
67
|
-
if isinstance(c, str):
|
67
|
+
if c and isinstance(c, str):
|
68
68
|
content.append(
|
69
69
|
anthropic.types.TextBlockParam(
|
70
70
|
text=c, type="text", cache_control=cache_ctrl
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: livekit-plugins-anthropic
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.0rc6
|
4
4
|
Summary: Agent Framework plugin for services from Anthropic
|
5
5
|
Project-URL: Documentation, https://docs.livekit.io
|
6
6
|
Project-URL: Website, https://livekit.io/
|
7
7
|
Project-URL: Source, https://github.com/livekit/agents
|
8
|
-
Author-email: LiveKit <
|
8
|
+
Author-email: LiveKit <hello@livekit.io>
|
9
9
|
License-Expression: Apache-2.0
|
10
10
|
Keywords: audio,livekit,realtime,video,webrtc
|
11
11
|
Classifier: Intended Audience :: Developers
|
@@ -19,7 +19,7 @@ Classifier: Topic :: Multimedia :: Video
|
|
19
19
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
20
20
|
Requires-Python: >=3.9.0
|
21
21
|
Requires-Dist: anthropic>=0.34
|
22
|
-
Requires-Dist: livekit-agents>=1.0.0.
|
22
|
+
Requires-Dist: livekit-agents>=1.0.0.rc6
|
23
23
|
Description-Content-Type: text/markdown
|
24
24
|
|
25
25
|
# LiveKit Plugins Anthropic
|
@@ -0,0 +1,10 @@
|
|
1
|
+
livekit/plugins/anthropic/__init__.py,sha256=1WCyNEaR6qBsX54qJQM0SeY-QHIucww16PLXcSnMqRo,1175
|
2
|
+
livekit/plugins/anthropic/llm.py,sha256=0O0ed5GZsTrEy_tWgrVadbA9IaEZfBm-oKjicT69l34,12885
|
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/utils.py,sha256=Nfl9dGCZGDEJAHj_f-TmePr8bKJrc8IwM6Houjev4DE,5158
|
7
|
+
livekit/plugins/anthropic/version.py,sha256=PDOEKN5zsYLQdbfAm5Di6G1sFYANNA0LqJR8zZzeghg,604
|
8
|
+
livekit_plugins_anthropic-1.0.0rc6.dist-info/METADATA,sha256=O1xasxtrzyMYXr5u5MvF32WeDOnWAGeMcj8XxtUoPTM,1278
|
9
|
+
livekit_plugins_anthropic-1.0.0rc6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
+
livekit_plugins_anthropic-1.0.0rc6.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
livekit/plugins/anthropic/__init__.py,sha256=1WCyNEaR6qBsX54qJQM0SeY-QHIucww16PLXcSnMqRo,1175
|
2
|
-
livekit/plugins/anthropic/llm.py,sha256=Gj9oGm16kdeEHw1I4GB7EGSBLpgkzhv36f55Msby5o0,13042
|
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/utils.py,sha256=-fYF1fzHLEkxi_E3SFtSKCSX8TcEunJi2IvDj9_yojM,5140
|
7
|
-
livekit/plugins/anthropic/version.py,sha256=j59nZMZZ8g3asKADdj9zt64g9i53Uq4ib4H0zY4FnPM,604
|
8
|
-
livekit_plugins_anthropic-1.0.0rc4.dist-info/METADATA,sha256=fi1RScVb-30l-v8M2rnw82vHiZa60cUDqg-sJ9nbDf0,1280
|
9
|
-
livekit_plugins_anthropic-1.0.0rc4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
-
livekit_plugins_anthropic-1.0.0rc4.dist-info/RECORD,,
|
{livekit_plugins_anthropic-1.0.0rc4.dist-info → livekit_plugins_anthropic-1.0.0rc6.dist-info}/WHEEL
RENAMED
File without changes
|