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": tool_call["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
- for chunk in response.iter_lines():
150
- if chunk:
151
- chunk_data = json.loads(chunk[6:])
152
- if chunk_data["object"] != "chat.completion.chunk":
153
- continue
154
- tool_calls_params = extract_tool_calls(chunk_data)
155
- has_tool_calls = True if tool_calls_params else False
156
- if has_tool_calls:
157
- yield ChatCompletionDeltaMessage(
158
- **{
159
- "content": chunk_data["choices"][0]["delta"].get("content"),
160
- "role": "assistant",
161
- **tool_calls_params,
162
- }
163
- )
164
- else:
165
- yield ChatCompletionDeltaMessage(
166
- **{
167
- "content": chunk_data["choices"][0]["delta"]["content"],
168
- "role": "assistant",
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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vectorvein
3
- Version: 0.1.9
3
+ Version: 0.1.10
4
4
  Summary: Default template for PDM package
5
5
  Author-Email: Anderson <andersonby@163.com>
6
6
  License: MIT
@@ -1,5 +1,5 @@
1
- vectorvein-0.1.9.dist-info/METADATA,sha256=AlikMRU7DLdZ6gZMohsL1X6NiuAWP3jGV0tE-uZkhNo,501
2
- vectorvein-0.1.9.dist-info/WHEEL,sha256=rSwsxJWe3vzyR5HCwjWXQruDgschpei4h_giTm0dJVE,90
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=uomp3DyTBmDXQtCmRiYp1VIIOFoVZ9_oyM3-j4JO7go,13000
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.9.dist-info/RECORD,,
26
+ vectorvein-0.1.10.dist-info/RECORD,,