OpenAIModelConfig
Base classes¶
| Name | Children | Inherits |
|---|---|---|
| BaseModelConfig llmling_models_config.configs Base for model configurations. |
â‹” Inheritance diagram¶
graph TD
2777737789["configs.OpenAIModelConfig"]
3497727833["configs.BaseModelConfig"]
330168112["schema.Schema"]
3879467795["main.BaseModel"]
2751680898["builtins.object"]
3497727833 --> 2777737789
330168112 --> 3497727833
3879467795 --> 330168112
2751680898 --> 3879467795
🛈 DocStrings¶
Bases: BaseModelConfig
Configuration for OpenAI models.
Source code in src/llmling_models_config/configs.py
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | |
builtin_tools
class-attribute
instance-attribute
¶
The provided OpenAI built-in tools to use (file_search, web_search, computer).
See OpenAI's built-in tools for more details.
extra_body
class-attribute
instance-attribute
¶
Extra body to send to the model.
extra_headers
class-attribute
instance-attribute
¶
extra_headers: dict[str, str] | None = Field(
default=None, examples=[{"Custom-Header": "value"}], title="Extra headers"
)
Extra headers to send to the model.
frequency_penalty
class-attribute
instance-attribute
¶
frequency_penalty: float | None = Field(
default=None, ge=-2.0, le=2.0, examples=[-1.0, 0.0, 0.5, 1.0], title="Frequency penalty"
)
Penalize new tokens based on their existing frequency in the text so far.
identifier
class-attribute
instance-attribute
¶
identifier: OpenaiModelName | str = Field(
examples=["gpt-4", "gpt-4-turbo"], title="Model identifier"
)
String identifier for the model.
include_code_execution_outputs
class-attribute
instance-attribute
¶
include_code_execution_outputs: bool | None = Field(
default=None, title="Include code execution outputs"
)
Whether to include the code execution results in the response.
include_file_search_results
class-attribute
instance-attribute
¶
Whether to include the file search results in the response.
include_web_search_sources
class-attribute
instance-attribute
¶
Whether to include the web search results in the response.
logit_bias
class-attribute
instance-attribute
¶
logit_bias: dict[str, int] | None = Field(
default=None, title="Logit bias", examples=[{"5678": -100}, {"1234": 100}]
)
Modify the likelihood of specified tokens appearing in the completion.
logprobs
class-attribute
instance-attribute
¶
Include log probabilities in the response.
max_tokens
class-attribute
instance-attribute
¶
max_tokens: int | None = Field(
default=None, ge=1, examples=[1024, 2048, 4096], title="Maximum tokens"
)
The maximum number of tokens to generate before stopping.
parallel_tool_calls
class-attribute
instance-attribute
¶
Whether to allow parallel tool calls.
prediction
class-attribute
instance-attribute
¶
prediction: dict[str, Any] | None = Field(
default=None,
title="Predicted output",
examples=[{"type": "content", "content": "predicted response text"}],
)
Predicted output for the model to use as a starting point.
Can be a simple string content or structured with text parts: - Simple: {"type": "content", "content": "predicted text"} - Parts: {"type": "content", "content": [{"type": "text", "text": "predicted"}]}
presence_penalty
class-attribute
instance-attribute
¶
presence_penalty: float | None = Field(
default=None, ge=-2.0, le=2.0, examples=[-1.0, 0.0, 0.5, 1.0], title="Presence penalty"
)
Penalize new tokens based on whether they have appeared in the text so far.
previous_response_id
class-attribute
instance-attribute
¶
previous_response_id: Literal["auto"] | str | None = Field(
default=None, title="Previous response ID"
)
The ID of a previous response to use as the starting point for a continued conversation.
When set to 'auto', the request automatically uses the most recent provider_response_id.
prompt_cache_key
class-attribute
instance-attribute
¶
Used by OpenAI to cache responses for similar requests to optimize your cache hit rates.
See the OpenAI Prompt Caching documentation for more information.
prompt_cache_retention
class-attribute
instance-attribute
¶
prompt_cache_retention: Literal["in-memory", "24h"] | None = Field(
default=None, title="Prompt cache retention"
)
The retention policy for the prompt cache. Set to 24h to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours.
See the OpenAI Prompt Caching documentation for more information.
reasoning_effort
class-attribute
instance-attribute
¶
reasoning_effort: Literal["none", "minimal", "low", "medium", "high", "xhigh"] | None = Field(
default=None, title="Reasoning effort"
)
Constrains effort on reasoning for reasoning models.
reasoning_summary
class-attribute
instance-attribute
¶
reasoning_summary: Literal["detailed", "concise", "auto"] | None = Field(
default=None, title="Reasoning summary"
)
A summary of the reasoning performed by the model.
This can be useful for debugging and understanding the model's reasoning process.
One of concise, detailed, or auto.
seed
class-attribute
instance-attribute
¶
The random seed to use for the model, theoretically allowing for deterministic results.
send_reasoning_ids
class-attribute
instance-attribute
¶
Whether to send the unique IDs of reasoning, text, and function call parts from the message history to the model.
Enabled by default for reasoning models. Disable if you get errors about items not matching.
service_tier
class-attribute
instance-attribute
¶
service_tier: Literal["auto", "default", "flex", "priority"] | None = Field(
default=None, title="Service tier"
)
The service tier to use for the model request.
stop_sequences
class-attribute
instance-attribute
¶
stop_sequences: list[str] | None = Field(
default=None, examples=[["STOP", "END"], ["\n\n"]], title="Stop sequences"
)
Sequences that will cause the model to stop generating.
temperature
class-attribute
instance-attribute
¶
temperature: float | None = Field(
default=None, ge=0.0, examples=[0.0, 0.7, 1.0, 2.0], title="Temperature"
)
Amount of randomness injected into the response.
text_verbosity
class-attribute
instance-attribute
¶
text_verbosity: Literal["low", "medium", "high"] | None = Field(
default=None, title="Text verbosity"
)
Constrains the verbosity of the model's text response.
Lower values will result in more concise responses, while higher values will result in more verbose responses.
timeout
class-attribute
instance-attribute
¶
Override the client-level default timeout for a request, in seconds.
top_logprobs
class-attribute
instance-attribute
¶
Include log probabilities of the top n tokens in the response.
top_p
class-attribute
instance-attribute
¶
top_p: float | None = Field(
default=None, ge=0.0, le=1.0, examples=[0.1, 0.9, 1.0], title="Top-p (nucleus sampling)"
)
An alternative to sampling with temperature, called nucleus sampling.
truncation
class-attribute
instance-attribute
¶
The truncation strategy to use for the model response.
disabled(default): Request fails if response exceeds context window.auto: Model truncates by dropping input items in the middle of the conversation.
type
class-attribute
instance-attribute
¶
Type identifier for OpenAI model.
user
class-attribute
instance-attribute
¶
A unique identifier representing the end-user.
get_model_settings
¶
Get model settings in pydantic-ai format.