openaivec 1.0.3__tar.gz → 1.0.5__tar.gz

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.
Files changed (90) hide show
  1. {openaivec-1.0.3 → openaivec-1.0.5}/PKG-INFO +10 -4
  2. {openaivec-1.0.3 → openaivec-1.0.5}/README.md +9 -3
  3. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_model.py +3 -10
  4. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_responses.py +11 -3
  5. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_schema/infer.py +0 -1
  6. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/pandas_ext.py +45 -26
  7. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/spark.py +4 -7
  8. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/customer_support/customer_sentiment.py +3 -4
  9. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/customer_support/inquiry_classification.py +2 -5
  10. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/customer_support/inquiry_summary.py +2 -5
  11. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/customer_support/intent_analysis.py +6 -8
  12. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/customer_support/response_suggestion.py +2 -5
  13. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/customer_support/urgency_analysis.py +2 -5
  14. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/nlp/dependency_parsing.py +3 -4
  15. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/nlp/keyword_extraction.py +3 -4
  16. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/nlp/morphological_analysis.py +3 -4
  17. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/nlp/named_entity_recognition.py +3 -4
  18. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/nlp/sentiment_analysis.py +3 -4
  19. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/nlp/translation.py +3 -5
  20. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/table/fillna.py +2 -7
  21. {openaivec-1.0.3 → openaivec-1.0.5}/tests/test_pandas_ext.py +24 -14
  22. {openaivec-1.0.3 → openaivec-1.0.5}/tests/test_spark.py +2 -4
  23. {openaivec-1.0.3 → openaivec-1.0.5}/tests/test_task.py +2 -45
  24. {openaivec-1.0.3 → openaivec-1.0.5}/.env.example +0 -0
  25. {openaivec-1.0.3 → openaivec-1.0.5}/.github/copilot-instructions.md +0 -0
  26. {openaivec-1.0.3 → openaivec-1.0.5}/.github/dependabot.yml +0 -0
  27. {openaivec-1.0.3 → openaivec-1.0.5}/.github/workflows/docs.yml +0 -0
  28. {openaivec-1.0.3 → openaivec-1.0.5}/.github/workflows/publish.yml +0 -0
  29. {openaivec-1.0.3 → openaivec-1.0.5}/.github/workflows/test.yml +0 -0
  30. {openaivec-1.0.3 → openaivec-1.0.5}/.gitignore +0 -0
  31. {openaivec-1.0.3 → openaivec-1.0.5}/AGENTS.md +0 -0
  32. {openaivec-1.0.3 → openaivec-1.0.5}/CODE_OF_CONDUCT.md +0 -0
  33. {openaivec-1.0.3 → openaivec-1.0.5}/LICENSE +0 -0
  34. {openaivec-1.0.3 → openaivec-1.0.5}/SECURITY.md +0 -0
  35. {openaivec-1.0.3 → openaivec-1.0.5}/SUPPORT.md +0 -0
  36. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/main.md +0 -0
  37. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/pandas_ext.md +0 -0
  38. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/spark.md +0 -0
  39. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/task.md +0 -0
  40. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/tasks/customer_support/customer_sentiment.md +0 -0
  41. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/tasks/customer_support/inquiry_classification.md +0 -0
  42. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/tasks/customer_support/inquiry_summary.md +0 -0
  43. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/tasks/customer_support/intent_analysis.md +0 -0
  44. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/tasks/customer_support/response_suggestion.md +0 -0
  45. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/tasks/customer_support/urgency_analysis.md +0 -0
  46. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/tasks/nlp/dependency_parsing.md +0 -0
  47. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/tasks/nlp/keyword_extraction.md +0 -0
  48. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/tasks/nlp/morphological_analysis.md +0 -0
  49. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/tasks/nlp/named_entity_recognition.md +0 -0
  50. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/tasks/nlp/sentiment_analysis.md +0 -0
  51. {openaivec-1.0.3 → openaivec-1.0.5}/docs/api/tasks/nlp/translation.md +0 -0
  52. {openaivec-1.0.3 → openaivec-1.0.5}/docs/contributor-guide.md +0 -0
  53. {openaivec-1.0.3 → openaivec-1.0.5}/docs/index.md +0 -0
  54. {openaivec-1.0.3 → openaivec-1.0.5}/docs/robots.txt +0 -0
  55. {openaivec-1.0.3 → openaivec-1.0.5}/mkdocs.yml +0 -0
  56. {openaivec-1.0.3 → openaivec-1.0.5}/pyproject.toml +0 -0
  57. {openaivec-1.0.3 → openaivec-1.0.5}/pytest.ini +0 -0
  58. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/__init__.py +0 -0
  59. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_cache/__init__.py +0 -0
  60. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_cache/optimize.py +0 -0
  61. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_cache/proxy.py +0 -0
  62. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_di.py +0 -0
  63. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_embeddings.py +0 -0
  64. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_log.py +0 -0
  65. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_prompt.py +0 -0
  66. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_provider.py +0 -0
  67. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_schema/__init__.py +0 -0
  68. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_schema/spec.py +0 -0
  69. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_serialize.py +0 -0
  70. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/_util.py +0 -0
  71. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/__init__.py +0 -0
  72. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/customer_support/__init__.py +0 -0
  73. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/nlp/__init__.py +0 -0
  74. {openaivec-1.0.3 → openaivec-1.0.5}/src/openaivec/task/table/__init__.py +0 -0
  75. {openaivec-1.0.3 → openaivec-1.0.5}/tests/__init__.py +0 -0
  76. {openaivec-1.0.3 → openaivec-1.0.5}/tests/_cache/test_optimize.py +0 -0
  77. {openaivec-1.0.3 → openaivec-1.0.5}/tests/_cache/test_proxy.py +0 -0
  78. {openaivec-1.0.3 → openaivec-1.0.5}/tests/_cache/test_proxy_suggester.py +0 -0
  79. {openaivec-1.0.3 → openaivec-1.0.5}/tests/_schema/test_infer.py +0 -0
  80. {openaivec-1.0.3 → openaivec-1.0.5}/tests/_schema/test_spec.py +0 -0
  81. {openaivec-1.0.3 → openaivec-1.0.5}/tests/conftest.py +0 -0
  82. {openaivec-1.0.3 → openaivec-1.0.5}/tests/test_di.py +0 -0
  83. {openaivec-1.0.3 → openaivec-1.0.5}/tests/test_embeddings.py +0 -0
  84. {openaivec-1.0.3 → openaivec-1.0.5}/tests/test_prompt.py +0 -0
  85. {openaivec-1.0.3 → openaivec-1.0.5}/tests/test_provider.py +0 -0
  86. {openaivec-1.0.3 → openaivec-1.0.5}/tests/test_responses.py +0 -0
  87. {openaivec-1.0.3 → openaivec-1.0.5}/tests/test_serialize.py +0 -0
  88. {openaivec-1.0.3 → openaivec-1.0.5}/tests/test_serialize_pydantic_v2_compliance.py +0 -0
  89. {openaivec-1.0.3 → openaivec-1.0.5}/tests/test_util.py +0 -0
  90. {openaivec-1.0.3 → openaivec-1.0.5}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openaivec
3
- Version: 1.0.3
3
+ Version: 1.0.5
4
4
  Summary: Generative mutation for tabular calculation
5
5
  Project-URL: Homepage, https://microsoft.github.io/openaivec/
6
6
  Project-URL: Repository, https://github.com/microsoft/openaivec
@@ -76,7 +76,7 @@ Simple task benchmark from [benchmark.ipynb](https://github.com/microsoft/openai
76
76
 
77
77
  Batching alone removes most HTTP overhead, and letting batching overlap with concurrency cuts total runtime to a few seconds while still yielding one output per input.
78
78
 
79
- ![Benchmark comparison for simple task](https://private-user-images.githubusercontent.com/6128022/519474214-d1931e34-6f9e-4695-8042-88b771e002c3.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjQyMDc5ODAsIm5iZiI6MTc2NDIwNzY4MCwicGF0aCI6Ii82MTI4MDIyLzUxOTQ3NDIxNC1kMTkzMWUzNC02ZjllLTQ2OTUtODA0Mi04OGI3NzFlMDAyYzMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MTEyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTExMjdUMDE0MTIwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Y2JhYmU2YjZhNDUxNDkxZDg5NGMxZGI1OTUzODgyYjQ4OTVhYzEzZjU3NmRkMjE1M2Y1ZDI3ZTdiNWI0M2VlMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.yuxT4AbDIBNsRGCIxPMjpGiHFqLcQUCLg_DjpqH02Lw)
79
+ <img alt="image" src="https://github.com/user-attachments/assets/8ace9bcd-bcae-4023-a37e-13082cd645e5" />
80
80
 
81
81
  ## Contents
82
82
 
@@ -215,8 +215,14 @@ text_df = pd.DataFrame({
215
215
  })
216
216
 
217
217
  results = text_df.assign(
218
- sentiment=lambda df: df.text.ai.task(nlp.SENTIMENT_ANALYSIS),
219
- intent=lambda df: df.text.ai.task(customer_support.INTENT_ANALYSIS),
218
+ sentiment=lambda df: df.text.ai.task(
219
+ nlp.SENTIMENT_ANALYSIS,
220
+ reasoning={"effort": "none"},
221
+ ),
222
+ intent=lambda df: df.text.ai.task(
223
+ customer_support.INTENT_ANALYSIS,
224
+ reasoning={"effort": "none"},
225
+ ),
220
226
  )
221
227
 
222
228
  # Extract structured results into separate columns
@@ -50,7 +50,7 @@ Simple task benchmark from [benchmark.ipynb](https://github.com/microsoft/openai
50
50
 
51
51
  Batching alone removes most HTTP overhead, and letting batching overlap with concurrency cuts total runtime to a few seconds while still yielding one output per input.
52
52
 
53
- ![Benchmark comparison for simple task](https://private-user-images.githubusercontent.com/6128022/519474214-d1931e34-6f9e-4695-8042-88b771e002c3.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjQyMDc5ODAsIm5iZiI6MTc2NDIwNzY4MCwicGF0aCI6Ii82MTI4MDIyLzUxOTQ3NDIxNC1kMTkzMWUzNC02ZjllLTQ2OTUtODA0Mi04OGI3NzFlMDAyYzMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MTEyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTExMjdUMDE0MTIwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Y2JhYmU2YjZhNDUxNDkxZDg5NGMxZGI1OTUzODgyYjQ4OTVhYzEzZjU3NmRkMjE1M2Y1ZDI3ZTdiNWI0M2VlMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.yuxT4AbDIBNsRGCIxPMjpGiHFqLcQUCLg_DjpqH02Lw)
53
+ <img alt="image" src="https://github.com/user-attachments/assets/8ace9bcd-bcae-4023-a37e-13082cd645e5" />
54
54
 
55
55
  ## Contents
56
56
 
@@ -189,8 +189,14 @@ text_df = pd.DataFrame({
189
189
  })
190
190
 
191
191
  results = text_df.assign(
192
- sentiment=lambda df: df.text.ai.task(nlp.SENTIMENT_ANALYSIS),
193
- intent=lambda df: df.text.ai.task(customer_support.INTENT_ANALYSIS),
192
+ sentiment=lambda df: df.text.ai.task(
193
+ nlp.SENTIMENT_ANALYSIS,
194
+ reasoning={"effort": "none"},
195
+ ),
196
+ intent=lambda df: df.text.ai.task(
197
+ customer_support.INTENT_ANALYSIS,
198
+ reasoning={"effort": "none"},
199
+ ),
194
200
  )
195
201
 
196
202
  # Extract structured results into separate columns
@@ -1,4 +1,4 @@
1
- from dataclasses import dataclass, field
1
+ from dataclasses import dataclass
2
2
  from typing import Generic, TypeVar
3
3
 
4
4
  __all__ = [
@@ -12,19 +12,14 @@ ResponseFormat = TypeVar("ResponseFormat")
12
12
  class PreparedTask(Generic[ResponseFormat]):
13
13
  """A data class representing a complete task configuration for OpenAI API calls.
14
14
 
15
- This class encapsulates all the necessary parameters for executing a task,
16
- including the instructions to be sent to the model, the expected response
17
- format using Pydantic models, and API parameters for controlling
18
- the model's output behavior.
15
+ This class encapsulates the instructions and expected response format for
16
+ executing a task against the OpenAI Responses API.
19
17
 
20
18
  Attributes:
21
19
  instructions (str): The prompt or instructions to send to the OpenAI model.
22
20
  This should contain clear, specific directions for the task.
23
21
  response_format (type[ResponseFormat]): A Pydantic model class or str type that defines the expected
24
22
  structure of the response. Can be either a BaseModel subclass or str.
25
- api_kwargs (dict[str, int | float | str | bool]): Additional OpenAI API parameters
26
- such as temperature, top_p, frequency_penalty, presence_penalty, seed, etc.
27
- Defaults to an empty dict.
28
23
 
29
24
  Example:
30
25
  Creating a custom task:
@@ -40,7 +35,6 @@ class PreparedTask(Generic[ResponseFormat]):
40
35
  custom_task = PreparedTask(
41
36
  instructions="Translate the following text to French:",
42
37
  response_format=TranslationResponse,
43
- api_kwargs={"temperature": 0.1, "top_p": 0.9}
44
38
  )
45
39
  ```
46
40
 
@@ -51,7 +45,6 @@ class PreparedTask(Generic[ResponseFormat]):
51
45
 
52
46
  instructions: str
53
47
  response_format: type[ResponseFormat]
54
- api_kwargs: dict[str, int | float | str | bool] = field(default_factory=dict)
55
48
 
56
49
 
57
50
  @dataclass(frozen=True)
@@ -202,7 +202,12 @@ class BatchResponses(Generic[ResponseFormat]):
202
202
 
203
203
  @classmethod
204
204
  def of_task(
205
- cls, client: OpenAI, model_name: str, task: PreparedTask[ResponseFormat], batch_size: int | None = None
205
+ cls,
206
+ client: OpenAI,
207
+ model_name: str,
208
+ task: PreparedTask[ResponseFormat],
209
+ batch_size: int | None = None,
210
+ **api_kwargs,
206
211
  ) -> "BatchResponses":
207
212
  """Factory from a PreparedTask.
208
213
 
@@ -212,6 +217,7 @@ class BatchResponses(Generic[ResponseFormat]):
212
217
  task (PreparedTask): Prepared task with instructions and response format.
213
218
  batch_size (int | None, optional): Max unique prompts per API call. Defaults to None
214
219
  (automatic batch size optimization). Set to a positive integer for fixed batch size.
220
+ **api_kwargs: Additional OpenAI API parameters forwarded to the Responses API.
215
221
 
216
222
  Returns:
217
223
  BatchResponses: Configured instance backed by a batching proxy.
@@ -222,7 +228,7 @@ class BatchResponses(Generic[ResponseFormat]):
222
228
  system_message=task.instructions,
223
229
  response_format=task.response_format,
224
230
  cache=BatchingMapProxy(batch_size=batch_size),
225
- api_kwargs=task.api_kwargs,
231
+ api_kwargs=api_kwargs,
226
232
  )
227
233
 
228
234
  def __post_init__(self):
@@ -403,6 +409,7 @@ class AsyncBatchResponses(Generic[ResponseFormat]):
403
409
  task: PreparedTask[ResponseFormat],
404
410
  batch_size: int | None = None,
405
411
  max_concurrency: int = 8,
412
+ **api_kwargs,
406
413
  ) -> "AsyncBatchResponses":
407
414
  """Factory from a PreparedTask.
408
415
 
@@ -413,6 +420,7 @@ class AsyncBatchResponses(Generic[ResponseFormat]):
413
420
  batch_size (int | None, optional): Max unique prompts per API call. Defaults to None
414
421
  (automatic batch size optimization). Set to a positive integer for fixed batch size.
415
422
  max_concurrency (int, optional): Max concurrent API calls. Defaults to 8.
423
+ **api_kwargs: Additional OpenAI API parameters forwarded to the Responses API.
416
424
 
417
425
  Returns:
418
426
  AsyncBatchResponses: Configured instance backed by an async batching proxy.
@@ -423,7 +431,7 @@ class AsyncBatchResponses(Generic[ResponseFormat]):
423
431
  system_message=task.instructions,
424
432
  response_format=task.response_format,
425
433
  cache=AsyncBatchingMapProxy(batch_size=batch_size, max_concurrency=max_concurrency),
426
- api_kwargs=task.api_kwargs,
434
+ api_kwargs=api_kwargs,
427
435
  )
428
436
 
429
437
  def __post_init__(self):
@@ -156,7 +156,6 @@ class SchemaInferenceOutput(BaseModel):
156
156
  return PreparedTask(
157
157
  instructions=self.inference_prompt,
158
158
  response_format=self.model,
159
- api_kwargs={"top_p": None, "temperature": None},
160
159
  )
161
160
 
162
161
  def build_model(self) -> type[BaseModel]:
@@ -378,12 +378,13 @@ class OpenAIVecSeriesAccessor:
378
378
  self,
379
379
  task: PreparedTask[ResponseFormat],
380
380
  cache: BatchingMapProxy[str, ResponseFormat],
381
+ **api_kwargs,
381
382
  ) -> pd.Series:
382
383
  """Execute a prepared task on every Series element using a provided cache.
383
384
 
384
- This mirrors ``responses_with_cache`` but uses the task's stored instructions,
385
- response format, and API parameters. A supplied ``BatchingMapProxy`` enables
386
- cross‑operation deduplicated reuse and external batch size / progress control.
385
+ This mirrors ``responses_with_cache`` but uses the task's stored instructions
386
+ and response format. A supplied ``BatchingMapProxy`` enables cross‑operation
387
+ deduplicated reuse and external batch size / progress control.
387
388
 
388
389
  Example:
389
390
  ```python
@@ -393,12 +394,13 @@ class OpenAIVecSeriesAccessor:
393
394
  ```
394
395
 
395
396
  Args:
396
- task (PreparedTask): Prepared task (instructions + response_format + sampling params).
397
+ task (PreparedTask): Prepared task (instructions + response_format).
397
398
  cache (BatchingMapProxy[str, ResponseFormat]): Pre‑configured cache instance.
399
+ **api_kwargs: Additional OpenAI API parameters forwarded to the Responses API.
398
400
 
399
401
  Note:
400
- The task's stored API parameters are used. Core routing keys (``model``, system
401
- instructions, user input) are managed internally and cannot be overridden.
402
+ Core routing keys (``model``, system instructions, user input) are managed
403
+ internally and cannot be overridden.
402
404
 
403
405
  Returns:
404
406
  pandas.Series: Task results aligned with the original Series index.
@@ -409,7 +411,7 @@ class OpenAIVecSeriesAccessor:
409
411
  system_message=task.instructions,
410
412
  response_format=task.response_format,
411
413
  cache=cache,
412
- api_kwargs=task.api_kwargs,
414
+ api_kwargs=api_kwargs,
413
415
  )
414
416
  return pd.Series(client.parse(self._obj.tolist()), index=self._obj.index, name=self._obj.name)
415
417
 
@@ -418,6 +420,7 @@ class OpenAIVecSeriesAccessor:
418
420
  task: PreparedTask,
419
421
  batch_size: int | None = None,
420
422
  show_progress: bool = True,
423
+ **api_kwargs,
421
424
  ) -> pd.Series:
422
425
  """Execute a prepared task on every Series element.
423
426
 
@@ -443,16 +446,16 @@ class OpenAIVecSeriesAccessor:
443
446
 
444
447
  Args:
445
448
  task (PreparedTask): A pre-configured task containing instructions,
446
- response format, and other parameters for processing the inputs.
449
+ response format for processing the inputs.
447
450
  batch_size (int | None, optional): Number of prompts grouped into a single
448
451
  request to optimize API usage. Defaults to ``None`` (automatic batch size
449
452
  optimization based on execution time). Set to a positive integer for fixed batch size.
450
453
  show_progress (bool, optional): Show progress bar in Jupyter notebooks. Defaults to ``True``.
454
+ **api_kwargs: Additional OpenAI API parameters forwarded to the Responses API.
451
455
 
452
456
  Note:
453
- The task's stored API parameters are used. Core batching / routing keys
454
- (``model``, ``instructions`` / system message, user ``input``) are managed by the
455
- library and cannot be overridden.
457
+ Core batching / routing keys (``model``, ``instructions`` / system message,
458
+ user ``input``) are managed by the library and cannot be overridden.
456
459
 
457
460
  Returns:
458
461
  pandas.Series: Series whose values are instances of the task's response format.
@@ -460,6 +463,7 @@ class OpenAIVecSeriesAccessor:
460
463
  return self.task_with_cache(
461
464
  task=task,
462
465
  cache=BatchingMapProxy(batch_size=batch_size, show_progress=show_progress),
466
+ **api_kwargs,
463
467
  )
464
468
 
465
469
  def parse_with_cache(
@@ -818,15 +822,17 @@ class OpenAIVecDataFrameAccessor:
818
822
  self,
819
823
  task: PreparedTask[ResponseFormat],
820
824
  cache: BatchingMapProxy[str, ResponseFormat],
825
+ **api_kwargs,
821
826
  ) -> pd.Series:
822
827
  """Execute a prepared task on each DataFrame row after serializing it to JSON using a provided cache.
823
828
 
824
829
  Args:
825
- task (PreparedTask): Prepared task (instructions + response_format + sampling params).
830
+ task (PreparedTask): Prepared task (instructions + response_format).
826
831
  cache (BatchingMapProxy[str, ResponseFormat]): Pre‑configured cache instance.
832
+ **api_kwargs: Additional OpenAI API parameters forwarded to the Responses API.
827
833
 
828
834
  Note:
829
- The task's stored API parameters are used. Core routing keys are managed internally.
835
+ Core routing keys are managed internally.
830
836
 
831
837
  Returns:
832
838
  pandas.Series: Task results aligned with the DataFrame's original index.
@@ -834,6 +840,7 @@ class OpenAIVecDataFrameAccessor:
834
840
  return _df_rows_to_json_series(self._obj).ai.task_with_cache(
835
841
  task=task,
836
842
  cache=cache,
843
+ **api_kwargs,
837
844
  )
838
845
 
839
846
  def task(
@@ -841,6 +848,7 @@ class OpenAIVecDataFrameAccessor:
841
848
  task: PreparedTask,
842
849
  batch_size: int | None = None,
843
850
  show_progress: bool = True,
851
+ **api_kwargs,
844
852
  ) -> pd.Series:
845
853
  """Execute a prepared task on each DataFrame row after serializing it to JSON.
846
854
 
@@ -870,16 +878,16 @@ class OpenAIVecDataFrameAccessor:
870
878
 
871
879
  Args:
872
880
  task (PreparedTask): A pre-configured task containing instructions,
873
- response format, and other parameters for processing the inputs.
881
+ response format for processing the inputs.
874
882
  batch_size (int | None, optional): Number of requests sent in one batch
875
883
  to optimize API usage. Defaults to ``None`` (automatic batch size
876
884
  optimization based on execution time). Set to a positive integer for fixed batch size.
877
885
  show_progress (bool, optional): Show progress bar in Jupyter notebooks. Defaults to ``True``.
886
+ **api_kwargs: Additional OpenAI API parameters forwarded to the Responses API.
878
887
 
879
888
  Note:
880
- The task's stored API parameters are used. Core batching / routing
881
- keys (``model``, ``instructions`` / system message, user ``input``) are managed by the
882
- library and cannot be overridden.
889
+ Core batching / routing keys (``model``, ``instructions`` / system message, user ``input``)
890
+ are managed by the library and cannot be overridden.
883
891
 
884
892
  Returns:
885
893
  pandas.Series: Series whose values are instances of the task's
@@ -889,6 +897,7 @@ class OpenAIVecDataFrameAccessor:
889
897
  task=task,
890
898
  batch_size=batch_size,
891
899
  show_progress=show_progress,
900
+ **api_kwargs,
892
901
  )
893
902
 
894
903
  def parse_with_cache(
@@ -1406,6 +1415,7 @@ class AsyncOpenAIVecSeriesAccessor:
1406
1415
  self,
1407
1416
  task: PreparedTask[ResponseFormat],
1408
1417
  cache: AsyncBatchingMapProxy[str, ResponseFormat],
1418
+ **api_kwargs,
1409
1419
  ) -> pd.Series:
1410
1420
  """Execute a prepared task on every Series element using a provided cache (asynchronously).
1411
1421
 
@@ -1416,10 +1426,11 @@ class AsyncOpenAIVecSeriesAccessor:
1416
1426
 
1417
1427
  Args:
1418
1428
  task (PreparedTask): A pre-configured task containing instructions,
1419
- response format, and other parameters for processing the inputs.
1429
+ response format for processing the inputs.
1420
1430
  cache (AsyncBatchingMapProxy[str, ResponseFormat]): Pre-configured cache
1421
1431
  instance for managing API call batching and deduplication.
1422
1432
  Set cache.batch_size=None to enable automatic batch size optimization.
1433
+ **api_kwargs: Additional OpenAI API parameters forwarded to the Responses API.
1423
1434
 
1424
1435
  Example:
1425
1436
  ```python
@@ -1456,7 +1467,7 @@ class AsyncOpenAIVecSeriesAccessor:
1456
1467
  system_message=task.instructions,
1457
1468
  response_format=task.response_format,
1458
1469
  cache=cache,
1459
- api_kwargs=task.api_kwargs,
1470
+ api_kwargs=api_kwargs,
1460
1471
  )
1461
1472
  results = await client.parse(self._obj.tolist())
1462
1473
 
@@ -1468,6 +1479,7 @@ class AsyncOpenAIVecSeriesAccessor:
1468
1479
  batch_size: int | None = None,
1469
1480
  max_concurrency: int = 8,
1470
1481
  show_progress: bool = True,
1482
+ **api_kwargs,
1471
1483
  ) -> pd.Series:
1472
1484
  """Execute a prepared task on every Series element (asynchronously).
1473
1485
 
@@ -1494,13 +1506,14 @@ class AsyncOpenAIVecSeriesAccessor:
1494
1506
 
1495
1507
  Args:
1496
1508
  task (PreparedTask): A pre-configured task containing instructions,
1497
- response format, and other parameters for processing the inputs.
1509
+ response format for processing the inputs.
1498
1510
  batch_size (int | None, optional): Number of prompts grouped into a single
1499
1511
  request to optimize API usage. Defaults to ``None`` (automatic batch size
1500
1512
  optimization based on execution time). Set to a positive integer for fixed batch size.
1501
1513
  max_concurrency (int, optional): Maximum number of concurrent
1502
1514
  requests. Defaults to 8.
1503
1515
  show_progress (bool, optional): Show progress bar in Jupyter notebooks. Defaults to ``True``.
1516
+ **api_kwargs: Additional OpenAI API parameters forwarded to the Responses API.
1504
1517
 
1505
1518
  Note:
1506
1519
  The task's stored API parameters are used. Core batching / routing
@@ -1519,6 +1532,7 @@ class AsyncOpenAIVecSeriesAccessor:
1519
1532
  cache=AsyncBatchingMapProxy(
1520
1533
  batch_size=batch_size, max_concurrency=max_concurrency, show_progress=show_progress
1521
1534
  ),
1535
+ **api_kwargs,
1522
1536
  )
1523
1537
 
1524
1538
  async def parse_with_cache(
@@ -1752,17 +1766,19 @@ class AsyncOpenAIVecDataFrameAccessor:
1752
1766
  self,
1753
1767
  task: PreparedTask[ResponseFormat],
1754
1768
  cache: AsyncBatchingMapProxy[str, ResponseFormat],
1769
+ **api_kwargs,
1755
1770
  ) -> pd.Series:
1756
1771
  """Execute a prepared task on each DataFrame row using a provided cache (asynchronously).
1757
1772
 
1758
1773
  After serializing each row to JSON, this method executes the prepared task.
1759
1774
 
1760
1775
  Args:
1761
- task (PreparedTask): Prepared task (instructions + response_format + sampling params).
1776
+ task (PreparedTask): Prepared task (instructions + response_format).
1762
1777
  cache (AsyncBatchingMapProxy[str, ResponseFormat]): Pre‑configured async cache instance.
1778
+ **api_kwargs: Additional OpenAI API parameters forwarded to the Responses API.
1763
1779
 
1764
1780
  Note:
1765
- The task's stored API parameters are used. Core routing keys are managed internally.
1781
+ Core routing keys are managed internally.
1766
1782
 
1767
1783
  Returns:
1768
1784
  pandas.Series: Task results aligned with the DataFrame's original index.
@@ -1773,6 +1789,7 @@ class AsyncOpenAIVecDataFrameAccessor:
1773
1789
  return await _df_rows_to_json_series(self._obj).aio.task_with_cache(
1774
1790
  task=task,
1775
1791
  cache=cache,
1792
+ **api_kwargs,
1776
1793
  )
1777
1794
 
1778
1795
  async def task(
@@ -1781,6 +1798,7 @@ class AsyncOpenAIVecDataFrameAccessor:
1781
1798
  batch_size: int | None = None,
1782
1799
  max_concurrency: int = 8,
1783
1800
  show_progress: bool = True,
1801
+ **api_kwargs,
1784
1802
  ) -> pd.Series:
1785
1803
  """Execute a prepared task on each DataFrame row after serializing it to JSON (asynchronously).
1786
1804
 
@@ -1811,18 +1829,18 @@ class AsyncOpenAIVecDataFrameAccessor:
1811
1829
 
1812
1830
  Args:
1813
1831
  task (PreparedTask): A pre-configured task containing instructions,
1814
- response format, and other parameters for processing the inputs.
1832
+ response format for processing the inputs.
1815
1833
  batch_size (int | None, optional): Number of requests sent in one batch
1816
1834
  to optimize API usage. Defaults to ``None`` (automatic batch size
1817
1835
  optimization based on execution time). Set to a positive integer for fixed batch size.
1818
1836
  max_concurrency (int, optional): Maximum number of concurrent
1819
1837
  requests. Defaults to 8.
1820
1838
  show_progress (bool, optional): Show progress bar in Jupyter notebooks. Defaults to ``True``.
1839
+ **api_kwargs: Additional OpenAI API parameters forwarded to the Responses API.
1821
1840
 
1822
1841
  Note:
1823
- The task's stored API parameters are used. Core batching / routing
1824
- keys (``model``, ``instructions`` / system message, user ``input``) are managed by the
1825
- library and cannot be overridden.
1842
+ Core batching / routing keys (``model``, ``instructions`` / system message, user ``input``)
1843
+ are managed by the library and cannot be overridden.
1826
1844
 
1827
1845
  Returns:
1828
1846
  pandas.Series: Series whose values are instances of the task's
@@ -1837,6 +1855,7 @@ class AsyncOpenAIVecDataFrameAccessor:
1837
1855
  batch_size=batch_size,
1838
1856
  max_concurrency=max_concurrency,
1839
1857
  show_progress=show_progress,
1858
+ **api_kwargs,
1840
1859
  )
1841
1860
 
1842
1861
  async def parse_with_cache(
@@ -503,8 +503,8 @@ def task_udf(
503
503
  datasets with overlapping content.
504
504
 
505
505
  Args:
506
- task (PreparedTask): A predefined task configuration containing instructions,
507
- response format, and API parameters.
506
+ task (PreparedTask): A predefined task configuration containing instructions
507
+ and response format.
508
508
  model_name (str | None): For Azure OpenAI, use your deployment name (e.g., "my-gpt4-deployment").
509
509
  For OpenAI, use the model name (e.g., "gpt-4.1-mini"). Defaults to configured model in DI container
510
510
  via ResponsesModelName if not provided.
@@ -522,7 +522,7 @@ def task_udf(
522
522
  Arbitrary OpenAI Responses API parameters (e.g. ``temperature``, ``top_p``,
523
523
  ``frequency_penalty``, ``presence_penalty``, ``seed``, ``max_output_tokens``, etc.)
524
524
  are forwarded verbatim to the underlying API calls. These parameters are applied to
525
- all API requests made by the UDF and override any parameters set in the task configuration.
525
+ all API requests made by the UDF.
526
526
 
527
527
  Returns:
528
528
  UserDefinedFunction: A Spark pandas UDF configured to execute the specified task
@@ -543,16 +543,13 @@ def task_udf(
543
543
  **Automatic Caching**: Duplicate inputs within each partition are cached,
544
544
  reducing API calls and costs significantly on datasets with repeated content.
545
545
  """
546
- # Merge task's api_kwargs with caller's api_kwargs (caller takes precedence)
547
- merged_kwargs = {**task.api_kwargs, **api_kwargs}
548
-
549
546
  return responses_udf(
550
547
  instructions=task.instructions,
551
548
  response_format=task.response_format,
552
549
  model_name=model_name,
553
550
  batch_size=batch_size,
554
551
  max_concurrency=max_concurrency,
555
- **merged_kwargs,
552
+ **api_kwargs,
556
553
  )
557
554
 
558
555
 
@@ -95,12 +95,11 @@ class CustomerSentiment(BaseModel):
95
95
  )
96
96
 
97
97
 
98
- def customer_sentiment(business_context: str = "general customer support", **api_kwargs) -> PreparedTask:
98
+ def customer_sentiment(business_context: str = "general customer support") -> PreparedTask:
99
99
  """Create a configurable customer sentiment analysis task.
100
100
 
101
101
  Args:
102
102
  business_context (str): Business context for sentiment analysis.
103
- **api_kwargs: Additional OpenAI API parameters (temperature, top_p, etc.).
104
103
 
105
104
  Returns:
106
105
  PreparedTask configured for customer sentiment analysis.
@@ -166,8 +165,8 @@ values like "positive" for sentiment.
166
165
 
167
166
  Provide comprehensive sentiment analysis with business context and recommended response strategy."""
168
167
 
169
- return PreparedTask(instructions=instructions, response_format=CustomerSentiment, api_kwargs=api_kwargs)
168
+ return PreparedTask(instructions=instructions, response_format=CustomerSentiment)
170
169
 
171
170
 
172
171
  # Backward compatibility - default configuration
173
- CUSTOMER_SENTIMENT = customer_sentiment(temperature=0.0, top_p=1.0)
172
+ CUSTOMER_SENTIMENT = customer_sentiment()
@@ -119,7 +119,6 @@ def inquiry_classification(
119
119
  priority_rules: Dict[str, str] | None = None,
120
120
  business_context: str = "general customer support",
121
121
  custom_keywords: Dict[str, list[str]] | None = None,
122
- **api_kwargs,
123
122
  ) -> PreparedTask:
124
123
  """Create a configurable inquiry classification task.
125
124
 
@@ -132,8 +131,6 @@ def inquiry_classification(
132
131
  Default uses standard priority indicators.
133
132
  business_context (str): Description of the business context to help with classification.
134
133
  custom_keywords (dict[str, list[str]] | None): Dictionary mapping categories to relevant keywords.
135
- **api_kwargs: Additional keyword arguments to pass to the OpenAI API,
136
- such as temperature, top_p, etc.
137
134
 
138
135
  Returns:
139
136
  PreparedTask configured for inquiry classification.
@@ -253,8 +250,8 @@ language where appropriate, but priority must use English values like "high".
253
250
 
254
251
  Provide accurate classification with detailed reasoning."""
255
252
 
256
- return PreparedTask(instructions=instructions, response_format=InquiryClassification, api_kwargs=api_kwargs)
253
+ return PreparedTask(instructions=instructions, response_format=InquiryClassification)
257
254
 
258
255
 
259
256
  # Backward compatibility - default configuration
260
- INQUIRY_CLASSIFICATION = inquiry_classification(temperature=0.0, top_p=1.0)
257
+ INQUIRY_CLASSIFICATION = inquiry_classification()
@@ -87,15 +87,12 @@ class InquirySummary(BaseModel):
87
87
  def inquiry_summary(
88
88
  summary_length: str = "concise",
89
89
  business_context: str = "general customer support",
90
- **api_kwargs,
91
90
  ) -> PreparedTask:
92
91
  """Create a configurable inquiry summary task.
93
92
 
94
93
  Args:
95
94
  summary_length (str): Length of summary (concise, detailed, bullet_points).
96
95
  business_context (str): Business context for summary.
97
- **api_kwargs: Additional keyword arguments to pass to the OpenAI API,
98
- such as temperature, top_p, etc.
99
96
 
100
97
  Returns:
101
98
  PreparedTask configured for inquiry summarization.
@@ -162,8 +159,8 @@ input is in German, provide all summary content in German, but use English value
162
159
 
163
160
  Provide accurate, actionable summary that enables efficient support resolution."""
164
161
 
165
- return PreparedTask(instructions=instructions, response_format=InquirySummary, api_kwargs=api_kwargs)
162
+ return PreparedTask(instructions=instructions, response_format=InquirySummary)
166
163
 
167
164
 
168
165
  # Backward compatibility - default configuration
169
- INQUIRY_SUMMARY = inquiry_summary(temperature=0.0, top_p=1.0)
166
+ INQUIRY_SUMMARY = inquiry_summary()
@@ -52,9 +52,9 @@ Example:
52
52
  ```
53
53
 
54
54
  Attributes:
55
- INTENT_ANALYSIS (PreparedTask): A prepared task instance
56
- configured for intent analysis with temperature=0.0 and
57
- top_p=1.0 for deterministic output.
55
+ INTENT_ANALYSIS (PreparedTask): A prepared task instance configured for intent
56
+ analysis. Provide ``temperature=0.0`` and ``top_p=1.0`` to your API calls
57
+ for deterministic output.
58
58
  """
59
59
 
60
60
  from typing import Literal
@@ -100,13 +100,11 @@ class IntentAnalysis(BaseModel):
100
100
  )
101
101
 
102
102
 
103
- def intent_analysis(business_context: str = "general customer support", **api_kwargs) -> PreparedTask:
103
+ def intent_analysis(business_context: str = "general customer support") -> PreparedTask:
104
104
  """Create a configurable intent analysis task.
105
105
 
106
106
  Args:
107
107
  business_context (str): Business context for intent analysis.
108
- **api_kwargs: Additional keyword arguments to pass to the OpenAI API,
109
- such as temperature, top_p, etc.
110
108
 
111
109
  Returns:
112
110
  PreparedTask configured for intent analysis.
@@ -169,8 +167,8 @@ next_steps, and reasoning in Japanese, but use English values like "get_help" fo
169
167
 
170
168
  Provide comprehensive intent analysis with actionable recommendations."""
171
169
 
172
- return PreparedTask(instructions=instructions, response_format=IntentAnalysis, api_kwargs=api_kwargs)
170
+ return PreparedTask(instructions=instructions, response_format=IntentAnalysis)
173
171
 
174
172
 
175
173
  # Backward compatibility - default configuration
176
- INTENT_ANALYSIS = intent_analysis(temperature=0.0, top_p=1.0)
174
+ INTENT_ANALYSIS = intent_analysis()
@@ -92,7 +92,6 @@ def response_suggestion(
92
92
  response_style: str = "professional",
93
93
  company_name: str = "our company",
94
94
  business_context: str = "general customer support",
95
- **api_kwargs,
96
95
  ) -> PreparedTask:
97
96
  """Create a configurable response suggestion task.
98
97
 
@@ -100,8 +99,6 @@ def response_suggestion(
100
99
  response_style (str): Style of response (professional, friendly, empathetic, formal).
101
100
  company_name (str): Name of the company for personalization.
102
101
  business_context (str): Business context for responses.
103
- **api_kwargs: Additional keyword arguments to pass to the OpenAI API,
104
- such as temperature, top_p, etc.
105
102
 
106
103
  Returns:
107
104
  PreparedTask configured for response suggestions.
@@ -189,8 +186,8 @@ but use English values like "empathetic" for tone.
189
186
  Generate helpful, professional response that moves toward resolution while maintaining
190
187
  positive customer relationship."""
191
188
 
192
- return PreparedTask(instructions=instructions, response_format=ResponseSuggestion, api_kwargs=api_kwargs)
189
+ return PreparedTask(instructions=instructions, response_format=ResponseSuggestion)
193
190
 
194
191
 
195
192
  # Backward compatibility - default configuration
196
- RESPONSE_SUGGESTION = response_suggestion(temperature=0.0, top_p=1.0)
193
+ RESPONSE_SUGGESTION = response_suggestion()
@@ -135,7 +135,6 @@ def urgency_analysis(
135
135
  business_context: str = "general customer support",
136
136
  business_hours: str = "24/7 support",
137
137
  sla_rules: Dict[str, str] | None = None,
138
- **api_kwargs,
139
138
  ) -> PreparedTask:
140
139
  """Create a configurable urgency analysis task.
141
140
 
@@ -148,8 +147,6 @@ def urgency_analysis(
148
147
  business_context (str): Description of the business context.
149
148
  business_hours (str): Description of business hours for response time calculation.
150
149
  sla_rules (dict[str, str] | None): Dictionary mapping customer tiers to SLA requirements.
151
- **api_kwargs: Additional keyword arguments to pass to the OpenAI API,
152
- such as temperature, top_p, etc.
153
150
 
154
151
  Returns:
155
152
  PreparedTask configured for urgency analysis.
@@ -286,8 +283,8 @@ urgency_level.
286
283
 
287
284
  Provide detailed analysis with clear reasoning for urgency level and response time recommendations."""
288
285
 
289
- return PreparedTask(instructions=instructions, response_format=UrgencyAnalysis, api_kwargs=api_kwargs)
286
+ return PreparedTask(instructions=instructions, response_format=UrgencyAnalysis)
290
287
 
291
288
 
292
289
  # Backward compatibility - default configuration
293
- URGENCY_ANALYSIS = urgency_analysis(temperature=0.0, top_p=1.0)
290
+ URGENCY_ANALYSIS = urgency_analysis()