openai-sdk-helpers 0.6.0__py3-none-any.whl → 0.6.1__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.
@@ -429,9 +429,16 @@ class AgentBase(DataclassJSONSerializable):
429
429
  """
430
430
  return self._session
431
431
 
432
- def get_agent(self) -> Agent:
432
+ def get_agent(
433
+ self, output_structure: Optional[type[StructureBase]] = None
434
+ ) -> Agent:
433
435
  """Construct and return the configured :class:`agents.Agent` instance.
434
436
 
437
+ Parameters
438
+ ----------
439
+ output_structure : type[StructureBase] or None, default=None
440
+ Optional override for the agent output schema.
441
+
435
442
  Returns
436
443
  -------
437
444
  Agent
@@ -442,8 +449,9 @@ class AgentBase(DataclassJSONSerializable):
442
449
  "instructions": self._configuration.instructions_text or ".",
443
450
  "model": self._model,
444
451
  }
445
- if self._configuration.output_structure:
446
- agent_config["output_type"] = self._configuration.output_structure
452
+ output_type = output_structure or self._configuration.output_structure
453
+ if output_type is not None:
454
+ agent_config["output_type"] = output_type
447
455
  if self._configuration.tools:
448
456
  agent_config["tools"] = self._configuration.tools
449
457
  if self._model_settings:
@@ -490,7 +498,7 @@ class AgentBase(DataclassJSONSerializable):
490
498
  session_to_use = session if session is not None else self._session
491
499
  try:
492
500
  return await run_async(
493
- agent=self.get_agent(),
501
+ agent=self.get_agent(output_structure=output_structure),
494
502
  input=input,
495
503
  context=context,
496
504
  output_structure=output_structure,
@@ -545,7 +553,7 @@ class AgentBase(DataclassJSONSerializable):
545
553
  session_to_use = session if session is not None else self._session
546
554
  try:
547
555
  return run_sync(
548
- agent=self.get_agent(),
556
+ agent=self.get_agent(output_structure=output_structure),
549
557
  input=input,
550
558
  context=context,
551
559
  output_structure=output_structure,