vectorvein 0.1.94__py3-none-any.whl → 0.1.95__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.
@@ -562,7 +562,10 @@ def transform_from_openai_message(message: ChatCompletionMessageParam, backend:
562
562
  if isinstance(item, str):
563
563
  formatted_content.append({"type": "text", "text": item})
564
564
  elif isinstance(item, dict) and "type" in item:
565
- formatted_content.append(item)
565
+ if item["type"] == "image_url":
566
+ formatted_content.append(format_image_message(item["image_url"]["url"], backend))
567
+ else:
568
+ formatted_content.append(item)
566
569
  return {"role": role, "content": formatted_content}
567
570
  else:
568
571
  return {"role": role, "content": content}
@@ -32,11 +32,18 @@ class ImageProcessor:
32
32
  self._cached_base64_image = None
33
33
 
34
34
  def _load_image(self):
35
- if not self.is_local and isinstance(self.image_source, str):
36
- image_url = self.image_source
37
- response = httpx.get(image_url)
38
- return Image.open(BytesIO(response.content))
39
- elif isinstance(self.image_source, (Path, str)):
35
+ if isinstance(self.image_source, str):
36
+ if self.image_source.startswith(("data:image/", "data:application/octet-stream;base64,")):
37
+ base64_data = self.image_source.split(",")[1]
38
+ image_data = base64.b64decode(base64_data)
39
+ return Image.open(BytesIO(image_data))
40
+ elif not self.is_local:
41
+ image_url = self.image_source
42
+ response = httpx.get(image_url)
43
+ return Image.open(BytesIO(response.content))
44
+ else:
45
+ return Image.open(self.image_source)
46
+ elif isinstance(self.image_source, Path):
40
47
  return Image.open(self.image_source)
41
48
  elif isinstance(self.image_source, Image.Image):
42
49
  return self.image_source
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vectorvein
3
- Version: 0.1.94
3
+ Version: 0.1.95
4
4
  Summary: VectorVein python SDK
5
5
  Author-Email: Anderson <andersonby@163.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
- vectorvein-0.1.94.dist-info/METADATA,sha256=GOy1lUZfBXtI3RqRGmAfpT6ju1I1gG94tytmlTbyNt8,775
2
- vectorvein-0.1.94.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- vectorvein-0.1.94.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1
+ vectorvein-0.1.95.dist-info/METADATA,sha256=9jaFqXZu5L1clFveApXDGA8IQEsC72Q7pyGibiFBAfU,775
2
+ vectorvein-0.1.95.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ vectorvein-0.1.95.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
4
  vectorvein/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  vectorvein/chat_clients/__init__.py,sha256=omQuG4PRRPNflSAgtdU--rwsWG6vMpwMEyIGZyFVHVQ,18596
6
6
  vectorvein/chat_clients/anthropic_client.py,sha256=Zk6X1feIvv7Az5dgyipJXbm9TkgWgpFghSTxLiXKKA8,38405
@@ -18,7 +18,7 @@ vectorvein/chat_clients/openai_compatible_client.py,sha256=H20SXdvXalf7_jaashff_
18
18
  vectorvein/chat_clients/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  vectorvein/chat_clients/qwen_client.py,sha256=-ryh-m9PgsO0fc4ulcCmPTy1155J8YUy15uPoJQOHA0,513
20
20
  vectorvein/chat_clients/stepfun_client.py,sha256=zsD2W5ahmR4DD9cqQTXmJr3txrGuvxbRWhFlRdwNijI,519
21
- vectorvein/chat_clients/utils.py,sha256=Xt-9Dm564SY0jRO4N9ArDcFDKZIdfh9pYMxshLRMfUc,24853
21
+ vectorvein/chat_clients/utils.py,sha256=r8tlt-suUjISSRjc_tCCcBYmQT3zng1YFVnQgeAG1Co,25041
22
22
  vectorvein/chat_clients/xai_client.py,sha256=eLFJJrNRJ-ni3DpshODcr3S1EJQLbhVwxyO1E54LaqM,491
23
23
  vectorvein/chat_clients/yi_client.py,sha256=RNf4CRuPJfixrwLZ3-DEc3t25QDe1mvZeb9sku2f8Bc,484
24
24
  vectorvein/chat_clients/zhipuai_client.py,sha256=Ys5DSeLCuedaDXr3PfG1EW2zKXopt-awO2IylWSwY0s,519
@@ -31,7 +31,7 @@ vectorvein/types/enums.py,sha256=7KTJSVtQueImmbr1fSwv3rQVtc0RyMWXJmoE2tDOaso,166
31
31
  vectorvein/types/exception.py,sha256=gnW4GnJ76jND6UGnodk9xmqkcbeS7Cz2rvncA2HpD5E,69
32
32
  vectorvein/types/llm_parameters.py,sha256=9KJ8z_7xVa0JsV0YPxRKz5n8Eb8PfvB9Y89e6ahjmjw,5989
33
33
  vectorvein/types/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- vectorvein/utilities/media_processing.py,sha256=CTRq-lGlFkFgP_FSRhNwF_qUgmOrXPf2_1Ok9HY42_g,5887
34
+ vectorvein/utilities/media_processing.py,sha256=7KtbLFzOYIn1e9QTN9G6C76NH8CBlV9kfAgiRKEIeXY,6263
35
35
  vectorvein/utilities/rate_limiter.py,sha256=dwolIUVw2wP83Odqpx0AAaE77de1GzxkYDGH4tM_u_4,10300
36
36
  vectorvein/utilities/retry.py,sha256=6KFS9R2HdhqM3_9jkjD4F36ZSpEx2YNFGOVlpOsUetM,2208
37
37
  vectorvein/workflow/graph/edge.py,sha256=xLZEJmBjAfVB53cd7CuRcKhgE6QqXv9nz32wJn8cmyk,1064
@@ -55,4 +55,4 @@ vectorvein/workflow/nodes/vector_db.py,sha256=t6I17q6iR3yQreiDHpRrksMdWDPIvgqJs0
55
55
  vectorvein/workflow/nodes/video_generation.py,sha256=qmdg-t_idpxq1veukd-jv_ChICMOoInKxprV9Z4Vi2w,4118
56
56
  vectorvein/workflow/nodes/web_crawlers.py,sha256=LsqomfXfqrXfHJDO1cl0Ox48f4St7X_SL12DSbAMSOw,5415
57
57
  vectorvein/workflow/utils/json_to_code.py,sha256=F7dhDy8kGc8ndOeihGLRLGFGlquoxVlb02ENtxnQ0C8,5914
58
- vectorvein-0.1.94.dist-info/RECORD,,
58
+ vectorvein-0.1.95.dist-info/RECORD,,