pyconverters-openai_vision 0.5.22__py3-none-any.whl → 0.5.26__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 +76 -7
- {pyconverters_openai_vision-0.5.22.dist-info → pyconverters_openai_vision-0.5.26.dist-info}/METADATA +1 -1
- pyconverters_openai_vision-0.5.26.dist-info/RECORD +7 -0
- pyconverters_openai_vision-0.5.22.dist-info/RECORD +0 -7
- {pyconverters_openai_vision-0.5.22.dist-info → pyconverters_openai_vision-0.5.26.dist-info}/WHEEL +0 -0
- {pyconverters_openai_vision-0.5.22.dist-info → pyconverters_openai_vision-0.5.26.dist-info}/entry_points.txt +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""OpenAIVision converter"""
|
|
2
|
-
__version__ = "0.5.
|
|
2
|
+
__version__ = "0.5.26"
|
|
@@ -276,9 +276,78 @@ def guess_kind(base64_src):
|
|
|
276
276
|
return kind
|
|
277
277
|
|
|
278
278
|
|
|
279
|
-
class OpenAIVisionProcessorBaseParameters(
|
|
279
|
+
class OpenAIVisionProcessorBaseParameters(ConverterParameters):
|
|
280
|
+
base_url: str = Field(
|
|
281
|
+
None,
|
|
282
|
+
description="""OpenAI endpoint base url""", extra="advanced"
|
|
283
|
+
)
|
|
284
|
+
model_str: str = Field(
|
|
285
|
+
None, extra="advanced"
|
|
286
|
+
)
|
|
287
|
+
model: str = Field(
|
|
288
|
+
None, extra="internal"
|
|
289
|
+
)
|
|
290
|
+
prompt: str = Field(
|
|
291
|
+
"""If the attached file is an image: describe the image.""",
|
|
292
|
+
description="""Contains the prompt as a string""",
|
|
293
|
+
extra="multiline",
|
|
294
|
+
)
|
|
295
|
+
max_tokens: int = Field(
|
|
296
|
+
16384,
|
|
297
|
+
description="""The maximum number of tokens to generate in the completion.
|
|
298
|
+
The token count of your prompt plus max_tokens cannot exceed the model's context length.
|
|
299
|
+
Most models have a context length of 2048 tokens (except for the newest models, which support 4096).""",
|
|
300
|
+
)
|
|
301
|
+
system_prompt: str = Field(
|
|
302
|
+
None,
|
|
303
|
+
description="""Contains the system prompt""",
|
|
304
|
+
extra="multiline,advanced",
|
|
305
|
+
)
|
|
306
|
+
temperature: float = Field(
|
|
307
|
+
0.1,
|
|
308
|
+
description="""What sampling temperature to use, between 0 and 2.
|
|
309
|
+
Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
|
|
310
|
+
We generally recommend altering this or `top_p` but not both.""",
|
|
311
|
+
extra="advanced",
|
|
312
|
+
)
|
|
313
|
+
top_p: int = Field(
|
|
314
|
+
1,
|
|
315
|
+
description="""An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
|
|
316
|
+
So 0.1 means only the tokens comprising the top 10% probability mass are considered.
|
|
317
|
+
We generally recommend altering this or `temperature` but not both.""",
|
|
318
|
+
extra="advanced",
|
|
319
|
+
)
|
|
320
|
+
n: int = Field(
|
|
321
|
+
1,
|
|
322
|
+
description="""How many completions to generate for each prompt.
|
|
323
|
+
Note: Because this parameter generates many completions, it can quickly consume your token quota.
|
|
324
|
+
Use carefully and ensure that you have reasonable settings for `max_tokens`.""",
|
|
325
|
+
extra="advanced",
|
|
326
|
+
)
|
|
327
|
+
best_of: int = Field(
|
|
328
|
+
1,
|
|
329
|
+
description="""Generates best_of completions server-side and returns the "best" (the one with the highest log probability per token).
|
|
330
|
+
Results cannot be streamed.
|
|
331
|
+
When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`.
|
|
332
|
+
Use carefully and ensure that you have reasonable settings for `max_tokens`.""",
|
|
333
|
+
extra="advanced",
|
|
334
|
+
)
|
|
335
|
+
presence_penalty: float = Field(
|
|
336
|
+
0.0,
|
|
337
|
+
description="""Number between -2.0 and 2.0.
|
|
338
|
+
Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.""",
|
|
339
|
+
extra="advanced",
|
|
340
|
+
)
|
|
341
|
+
frequency_penalty: float = Field(
|
|
342
|
+
0.0,
|
|
343
|
+
description="""Number between -2.0 and 2.0.
|
|
344
|
+
Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.""",
|
|
345
|
+
extra="advanced",
|
|
346
|
+
)
|
|
280
347
|
replace_refs_altTexts_by_descriptions: bool = Field(
|
|
281
|
-
|
|
348
|
+
True,
|
|
349
|
+
description="""Replace references to images in text by their textual description.""",
|
|
350
|
+
extra="advanced"
|
|
282
351
|
)
|
|
283
352
|
|
|
284
353
|
|
|
@@ -288,7 +357,7 @@ class OpenAIVisionProcessorBase(ProcessorBase):
|
|
|
288
357
|
PREFIX: str = ""
|
|
289
358
|
oauth_token: OAuthToken = OAuthToken()
|
|
290
359
|
|
|
291
|
-
def compute_args(self, params:
|
|
360
|
+
def compute_args(self, params: OpenAIVisionProcessorBaseParameters, source: str, kind
|
|
292
361
|
) -> Dict[str, Any]:
|
|
293
362
|
if kind.mime.startswith("image"):
|
|
294
363
|
binary_block = {
|
|
@@ -421,8 +490,8 @@ class OpenAIVisionProcessor(OpenAIVisionProcessorBase):
|
|
|
421
490
|
def process(
|
|
422
491
|
self, documents: List[Document], parameters: ProcessorParameters
|
|
423
492
|
) -> List[Document]:
|
|
424
|
-
params:
|
|
425
|
-
|
|
493
|
+
params: OpenAIVisionProcessorParameters = cast(
|
|
494
|
+
OpenAIVisionProcessorParameters, parameters
|
|
426
495
|
)
|
|
427
496
|
model_str = params.model_str if bool(params.model_str and params.model_str.strip()) else None
|
|
428
497
|
model = params.model.value if params.model is not None else None
|
|
@@ -453,8 +522,8 @@ class DeepInfraOpenAIVisionProcessor(OpenAIVisionProcessorBase):
|
|
|
453
522
|
def process(
|
|
454
523
|
self, documents: List[Document], parameters: ProcessorParameters
|
|
455
524
|
) -> List[Document]:
|
|
456
|
-
params:
|
|
457
|
-
|
|
525
|
+
params: DeepInfraOpenAIVisionProcessorParameters = cast(
|
|
526
|
+
DeepInfraOpenAIVisionProcessorParameters, parameters
|
|
458
527
|
)
|
|
459
528
|
model_str = params.model_str if bool(params.model_str and params.model_str.strip()) else None
|
|
460
529
|
model = params.model.value if params.model is not None else None
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pyconverters_openai_vision/__init__.py,sha256=PnExq8jYKRFvTtXW450BmUzu8pb8Qz5pbp741yExhHE,52
|
|
2
|
+
pyconverters_openai_vision/openai_utils.py,sha256=XI4WYZ-EAVG0Vxd5yUDuZNDgEzqHJeriScxTUusi1oo,7740
|
|
3
|
+
pyconverters_openai_vision/openai_vision.py,sha256=jrz6fZnoQvCPVxmKdU_YSFBYBXSi9Nx1c5SzUFJd8G0,23266
|
|
4
|
+
pyconverters_openai_vision-0.5.26.dist-info/entry_points.txt,sha256=KLlvDTMJjHy0fk6mvTXFNpn0pC8UKsTJLd9wre9SOHw,394
|
|
5
|
+
pyconverters_openai_vision-0.5.26.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
6
|
+
pyconverters_openai_vision-0.5.26.dist-info/METADATA,sha256=jVR83Tc8dQsrNuBtSe6go9Wh_1uDPVhiS89YBiIyM2g,2662
|
|
7
|
+
pyconverters_openai_vision-0.5.26.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
pyconverters_openai_vision/__init__.py,sha256=DVZWqJHpQcrIA6rtKEN3C-qJc4k9cH846SAacAXLaYY,52
|
|
2
|
-
pyconverters_openai_vision/openai_utils.py,sha256=XI4WYZ-EAVG0Vxd5yUDuZNDgEzqHJeriScxTUusi1oo,7740
|
|
3
|
-
pyconverters_openai_vision/openai_vision.py,sha256=PW_JnekYyE4_XVba6tRs0jwFF1wXbf5zfy1yF2p-BzQ,20014
|
|
4
|
-
pyconverters_openai_vision-0.5.22.dist-info/entry_points.txt,sha256=KLlvDTMJjHy0fk6mvTXFNpn0pC8UKsTJLd9wre9SOHw,394
|
|
5
|
-
pyconverters_openai_vision-0.5.22.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
6
|
-
pyconverters_openai_vision-0.5.22.dist-info/METADATA,sha256=C5srCJu7yQnlmRRORntBdmAcOhHdjRGAPWBrUiCKlY0,2662
|
|
7
|
-
pyconverters_openai_vision-0.5.22.dist-info/RECORD,,
|
{pyconverters_openai_vision-0.5.22.dist-info → pyconverters_openai_vision-0.5.26.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|