pyconverters-openai_vision 0.5.36__py3-none-any.whl → 0.5.40__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 +9 -13
- {pyconverters_openai_vision-0.5.36.dist-info → pyconverters_openai_vision-0.5.40.dist-info}/METADATA +1 -1
- pyconverters_openai_vision-0.5.40.dist-info/RECORD +7 -0
- pyconverters_openai_vision-0.5.36.dist-info/RECORD +0 -7
- {pyconverters_openai_vision-0.5.36.dist-info → pyconverters_openai_vision-0.5.40.dist-info}/WHEEL +0 -0
- {pyconverters_openai_vision-0.5.36.dist-info → pyconverters_openai_vision-0.5.40.dist-info}/entry_points.txt +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""OpenAIVision converter"""
|
|
2
|
-
__version__ = "0.5.
|
|
2
|
+
__version__ = "0.5.40"
|
|
@@ -147,10 +147,6 @@ class OpenAIVisionConverterBase(ConverterBase):
|
|
|
147
147
|
PREFIX: str = ""
|
|
148
148
|
oauth_token: OAuthToken = OAuthToken()
|
|
149
149
|
|
|
150
|
-
@classmethod
|
|
151
|
-
def is_model_gpt_5_model(cls, model: str) -> bool:
|
|
152
|
-
return "gpt-5" in model
|
|
153
|
-
|
|
154
150
|
def compute_args(self, params: OpenAIVisionBaseParameters, source: UploadFile, kind
|
|
155
151
|
) -> Dict[str, Any]:
|
|
156
152
|
data = source.file.read()
|
|
@@ -171,11 +167,10 @@ class OpenAIVisionConverterBase(ConverterBase):
|
|
|
171
167
|
},
|
|
172
168
|
binary_block
|
|
173
169
|
]})
|
|
174
|
-
max_tokens_param = 'max_completion_tokens' if self.is_model_gpt_5_model(params.model_str) else 'max_tokens'
|
|
175
170
|
kwargs = {
|
|
176
171
|
'model': params.model_str,
|
|
177
172
|
'messages': messages,
|
|
178
|
-
|
|
173
|
+
'max_tokens': params.max_tokens,
|
|
179
174
|
'temperature': params.temperature,
|
|
180
175
|
'top_p': params.top_p,
|
|
181
176
|
'n': params.n,
|
|
@@ -185,7 +180,7 @@ class OpenAIVisionConverterBase(ConverterBase):
|
|
|
185
180
|
return kwargs
|
|
186
181
|
|
|
187
182
|
def compute_result(self, base_url, **kwargs):
|
|
188
|
-
pattern: Pattern = re.compile(r"```(?:markdown
|
|
183
|
+
pattern: Pattern = re.compile(r"```(?:markdown|json|python|html)?(\W.*?)```", re.DOTALL)
|
|
189
184
|
"""Regex pattern to parse the output."""
|
|
190
185
|
response = openai_chat_completion(self.PREFIX, self.oauth_token, base_url, **kwargs)
|
|
191
186
|
contents = []
|
|
@@ -196,6 +191,12 @@ class OpenAIVisionConverterBase(ConverterBase):
|
|
|
196
191
|
action_match = pattern.search(choice.message.content)
|
|
197
192
|
if action_match is not None:
|
|
198
193
|
contents.append(action_match.group(1).strip())
|
|
194
|
+
else:
|
|
195
|
+
action_match = re.search(r"```(.*?)```", choice.message.content, re.DOTALL)
|
|
196
|
+
if action_match is not None:
|
|
197
|
+
contents.append(action_match.group(1).strip())
|
|
198
|
+
else:
|
|
199
|
+
contents.append(choice.message.content)
|
|
199
200
|
else:
|
|
200
201
|
contents.append(choice.message.content)
|
|
201
202
|
if contents:
|
|
@@ -362,10 +363,6 @@ class OpenAIVisionProcessorBase(ProcessorBase):
|
|
|
362
363
|
PREFIX: str = ""
|
|
363
364
|
oauth_token: OAuthToken = OAuthToken()
|
|
364
365
|
|
|
365
|
-
@classmethod
|
|
366
|
-
def is_model_gpt_5_model(cls, model: str) -> bool:
|
|
367
|
-
return "gpt-5" in model
|
|
368
|
-
|
|
369
366
|
def compute_args(self, params: OpenAIVisionProcessorBaseParameters, source: str, kind
|
|
370
367
|
) -> Dict[str, Any]:
|
|
371
368
|
if kind.mime.startswith("image"):
|
|
@@ -384,11 +381,10 @@ class OpenAIVisionProcessorBase(ProcessorBase):
|
|
|
384
381
|
},
|
|
385
382
|
binary_block
|
|
386
383
|
]})
|
|
387
|
-
max_tokens_param = 'max_completion_tokens' if self.is_model_gpt_5_model(params.model_str) else 'max_tokens'
|
|
388
384
|
kwargs = {
|
|
389
385
|
'model': params.model_str,
|
|
390
386
|
'messages': messages,
|
|
391
|
-
|
|
387
|
+
'max_tokens': params.max_tokens,
|
|
392
388
|
'temperature': params.temperature,
|
|
393
389
|
'top_p': params.top_p,
|
|
394
390
|
'n': params.n,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pyconverters_openai_vision/__init__.py,sha256=nllf2jeljyeVthNdUtweGUh38v8sV1ezGTwnUTROXMc,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.40.dist-info/entry_points.txt,sha256=NR0re-yebKKyhApky1I6nDQzjJQfEyfOkJlJju0Ngzo,404
|
|
5
|
+
pyconverters_openai_vision-0.5.40.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
6
|
+
pyconverters_openai_vision-0.5.40.dist-info/METADATA,sha256=qrtL9hAuepmZMVz-Vyp7qZEhOs0ljksMGZxjluAkfTE,2662
|
|
7
|
+
pyconverters_openai_vision-0.5.40.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
pyconverters_openai_vision/__init__.py,sha256=-BX6FHKC8AX-7vCq_-SC81FmeXDVkY1SIy4vU9f9-gU,52
|
|
2
|
-
pyconverters_openai_vision/openai_utils.py,sha256=XI4WYZ-EAVG0Vxd5yUDuZNDgEzqHJeriScxTUusi1oo,7740
|
|
3
|
-
pyconverters_openai_vision/openai_vision.py,sha256=Lp8g8KbTvRznOrC7dPRM-C9qmZcgzs-Kq6QidHtZwA4,23780
|
|
4
|
-
pyconverters_openai_vision-0.5.36.dist-info/entry_points.txt,sha256=NR0re-yebKKyhApky1I6nDQzjJQfEyfOkJlJju0Ngzo,404
|
|
5
|
-
pyconverters_openai_vision-0.5.36.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
6
|
-
pyconverters_openai_vision-0.5.36.dist-info/METADATA,sha256=govETANuIkSFp_1AAH1t2AxwryMgupNpZ2VERpWhbyI,2662
|
|
7
|
-
pyconverters_openai_vision-0.5.36.dist-info/RECORD,,
|
{pyconverters_openai_vision-0.5.36.dist-info → pyconverters_openai_vision-0.5.40.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|