pyconverters-openai_vision 0.5.46__py3-none-any.whl → 0.5.52__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.
- pyconverters_openai_vision/__init__.py +1 -1
- pyconverters_openai_vision/openai_vision.py +15 -12
- {pyconverters_openai_vision-0.5.46.dist-info → pyconverters_openai_vision-0.5.52.dist-info}/METADATA +1 -1
- pyconverters_openai_vision-0.5.52.dist-info/RECORD +7 -0
- pyconverters_openai_vision-0.5.46.dist-info/RECORD +0 -7
- {pyconverters_openai_vision-0.5.46.dist-info → pyconverters_openai_vision-0.5.52.dist-info}/WHEEL +0 -0
- {pyconverters_openai_vision-0.5.46.dist-info → pyconverters_openai_vision-0.5.52.dist-info}/entry_points.txt +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""OpenAIVision converter"""
|
|
2
|
-
__version__ = "0.5.
|
|
2
|
+
__version__ = "0.5.52"
|
|
@@ -396,19 +396,22 @@ class OpenAIVisionProcessorBase(ProcessorBase):
|
|
|
396
396
|
def compute_result(self, base_url, **kwargs):
|
|
397
397
|
pattern: Pattern = re.compile(r"```(?:markdown\s+)?(\W.*?)```", re.DOTALL)
|
|
398
398
|
"""Regex pattern to parse the output."""
|
|
399
|
-
response = openai_chat_completion(self.PREFIX, self.oauth_token, base_url, **kwargs)
|
|
400
|
-
contents = []
|
|
401
399
|
result = None
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
400
|
+
try:
|
|
401
|
+
response = openai_chat_completion(self.PREFIX, self.oauth_token, base_url, **kwargs)
|
|
402
|
+
contents = []
|
|
403
|
+
for choice in response.choices:
|
|
404
|
+
if choice.message.content:
|
|
405
|
+
if "```" in choice.message.content:
|
|
406
|
+
action_match = pattern.search(choice.message.content)
|
|
407
|
+
if action_match is not None:
|
|
408
|
+
contents.append(action_match.group(1).strip())
|
|
409
|
+
else:
|
|
410
|
+
contents.append(choice.message.content)
|
|
411
|
+
if contents:
|
|
412
|
+
result = "\n".join(contents)
|
|
413
|
+
except Exception:
|
|
414
|
+
logger.warning("Conversion of image failed", exc_info=True)
|
|
412
415
|
return result
|
|
413
416
|
|
|
414
417
|
def process(
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pyconverters_openai_vision/__init__.py,sha256=g7HB-L3arbfi4y27TjX8fUur2DtWbhxcEmibUoByG5U,52
|
|
2
|
+
pyconverters_openai_vision/openai_utils.py,sha256=XI4WYZ-EAVG0Vxd5yUDuZNDgEzqHJeriScxTUusi1oo,7740
|
|
3
|
+
pyconverters_openai_vision/openai_vision.py,sha256=A5TRj0q-Ojzi4LcKxiP9qdTXGglR_v2YgGApmrJWEeE,23855
|
|
4
|
+
pyconverters_openai_vision-0.5.52.dist-info/entry_points.txt,sha256=NR0re-yebKKyhApky1I6nDQzjJQfEyfOkJlJju0Ngzo,404
|
|
5
|
+
pyconverters_openai_vision-0.5.52.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
6
|
+
pyconverters_openai_vision-0.5.52.dist-info/METADATA,sha256=1BKH6j0kih-UTGREwtjmODwX_Mz0lfd8lHtqrInrHvM,2662
|
|
7
|
+
pyconverters_openai_vision-0.5.52.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
pyconverters_openai_vision/__init__.py,sha256=mD5UuYY15ujBLp9Y9YOMfwwmWkeBDwBUbZOxcWsqXug,52
|
|
2
|
-
pyconverters_openai_vision/openai_utils.py,sha256=XI4WYZ-EAVG0Vxd5yUDuZNDgEzqHJeriScxTUusi1oo,7740
|
|
3
|
-
pyconverters_openai_vision/openai_vision.py,sha256=GLV7CsovwVlrqD9HpmKmsoTwJ9jWLwfIbJESx6Q1uHU,23696
|
|
4
|
-
pyconverters_openai_vision-0.5.46.dist-info/entry_points.txt,sha256=NR0re-yebKKyhApky1I6nDQzjJQfEyfOkJlJju0Ngzo,404
|
|
5
|
-
pyconverters_openai_vision-0.5.46.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
6
|
-
pyconverters_openai_vision-0.5.46.dist-info/METADATA,sha256=gWNlE2ml9qZ6P-w3cCk777e6pd1NF3QUQzcs-WoMOYg,2662
|
|
7
|
-
pyconverters_openai_vision-0.5.46.dist-info/RECORD,,
|
{pyconverters_openai_vision-0.5.46.dist-info → pyconverters_openai_vision-0.5.52.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|