vectorvein 0.1.9__py3-none-any.whl → 0.1.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.
@@ -25,7 +25,7 @@ def extract_tool_calls(response):
|
|
25
25
|
"index": index,
|
26
26
|
"id": tool_call["id"],
|
27
27
|
"function": tool_call["function"],
|
28
|
-
"type":
|
28
|
+
"type": "function",
|
29
29
|
}
|
30
30
|
for index, tool_call in enumerate(tool_calls)
|
31
31
|
]
|
@@ -59,6 +59,7 @@ class MiniMaxChatClient(BaseChatClient):
|
|
59
59
|
endpoint_id,
|
60
60
|
**kwargs,
|
61
61
|
)
|
62
|
+
self.http_client = httpx.Client()
|
62
63
|
|
63
64
|
def create_completion(
|
64
65
|
self,
|
@@ -136,41 +137,47 @@ class MiniMaxChatClient(BaseChatClient):
|
|
136
137
|
**tools_params,
|
137
138
|
}
|
138
139
|
|
139
|
-
response = httpx.post(
|
140
|
-
url=self.url,
|
141
|
-
headers=self.headers,
|
142
|
-
json=request_body,
|
143
|
-
timeout=60,
|
144
|
-
)
|
145
|
-
|
146
140
|
if self.stream:
|
147
141
|
|
148
142
|
def generator():
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
143
|
+
with self.http_client.stream(
|
144
|
+
"POST",
|
145
|
+
url=self.url,
|
146
|
+
headers=self.headers,
|
147
|
+
json=request_body,
|
148
|
+
timeout=60,
|
149
|
+
) as response:
|
150
|
+
for chunk in response.iter_lines():
|
151
|
+
if chunk:
|
152
|
+
chunk_data = json.loads(chunk[6:])
|
153
|
+
if chunk_data["object"] != "chat.completion.chunk":
|
154
|
+
continue
|
155
|
+
tool_calls_params = extract_tool_calls(chunk_data)
|
156
|
+
has_tool_calls = True if tool_calls_params else False
|
157
|
+
if has_tool_calls:
|
158
|
+
yield ChatCompletionDeltaMessage(
|
159
|
+
**{
|
160
|
+
"content": chunk_data["choices"][0]["delta"].get("content"),
|
161
|
+
"role": "assistant",
|
162
|
+
**tool_calls_params,
|
163
|
+
}
|
164
|
+
)
|
165
|
+
else:
|
166
|
+
yield ChatCompletionDeltaMessage(
|
167
|
+
**{
|
168
|
+
"content": chunk_data["choices"][0]["delta"]["content"],
|
169
|
+
"role": "assistant",
|
170
|
+
}
|
171
|
+
)
|
171
172
|
|
172
173
|
return generator()
|
173
174
|
else:
|
175
|
+
response = httpx.post(
|
176
|
+
url=self.url,
|
177
|
+
headers=self.headers,
|
178
|
+
json=request_body,
|
179
|
+
timeout=60,
|
180
|
+
)
|
174
181
|
result = response.json()
|
175
182
|
tool_calls_params = extract_tool_calls(result)
|
176
183
|
return ChatCompletionMessage(
|
@@ -1,5 +1,5 @@
|
|
1
|
-
vectorvein-0.1.
|
2
|
-
vectorvein-0.1.
|
1
|
+
vectorvein-0.1.10.dist-info/METADATA,sha256=9xKzC4bU-2nWl6CavXiKnv3VvQB6ZZn6obbaRLOWZqA,502
|
2
|
+
vectorvein-0.1.10.dist-info/WHEEL,sha256=rSwsxJWe3vzyR5HCwjWXQruDgschpei4h_giTm0dJVE,90
|
3
3
|
vectorvein/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
vectorvein/chat_clients/__init__.py,sha256=5j7W--jr-l2cqDJp38uXYvkydDK0rnzm7MYGSACHKmU,3976
|
5
5
|
vectorvein/chat_clients/anthropic_client.py,sha256=JjigSUsIn06ixIEjnOJhVbcMqy2_MAL3iVUlDFAFMW4,20008
|
@@ -8,7 +8,7 @@ vectorvein/chat_clients/deepseek_client.py,sha256=3qWu01NlJAP2N-Ff62d5-CZXZitliz
|
|
8
8
|
vectorvein/chat_clients/gemini_client.py,sha256=IHcBHTSHkj3f962S5L7Ga-XA-96sq8quIDRZpoqvGss,13653
|
9
9
|
vectorvein/chat_clients/groq_client.py,sha256=Uow4pgdmFi93ZQSoOol2-0PhhqkW-S0XuSldvppz5U4,498
|
10
10
|
vectorvein/chat_clients/local_client.py,sha256=55nOsxzqUf79q3Y14MKROA71zxhsT7p7FsDZ89rts2M,422
|
11
|
-
vectorvein/chat_clients/minimax_client.py,sha256=
|
11
|
+
vectorvein/chat_clients/minimax_client.py,sha256=ZnRiy1lxwkEugA8VnRLz6HHj2kwAWQ7UmMMwR5UkgyA,13398
|
12
12
|
vectorvein/chat_clients/mistral_client.py,sha256=1aKSylzBDaLYcFnaBIL4-sXSzWmXfBeON9Q0rq-ziWw,534
|
13
13
|
vectorvein/chat_clients/moonshot_client.py,sha256=gbu-6nGxx8uM_U2WlI4Wus881rFRotzHtMSoYOcruGU,526
|
14
14
|
vectorvein/chat_clients/openai_client.py,sha256=Nz6tV45pWcsOupxjnsRsGTicbQNJWIZyxuJoJ5DGMpg,527
|
@@ -23,4 +23,4 @@ vectorvein/types/enums.py,sha256=vzOenCnRlFXBwPh-lfFhjGfM-6yfDj7wZColHODqocI,155
|
|
23
23
|
vectorvein/types/llm_parameters.py,sha256=nBjStC2zndTY__yhD2WFXB09taxEhDLE3OHA6MICfgE,3494
|
24
24
|
vectorvein/utilities/media_processing.py,sha256=BujciRmw1GMmc3ELRvafL8STcy6r5b2rVnh27-uA7so,2256
|
25
25
|
vectorvein/utilities/retry.py,sha256=9ePuJdeUUGx-qMWfaFxmlOvG_lQPwCQ4UB1z3Edlo34,993
|
26
|
-
vectorvein-0.1.
|
26
|
+
vectorvein-0.1.10.dist-info/RECORD,,
|
File without changes
|