mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
docs: more fixes for refs (#33554)
This commit is contained in:
@@ -49,30 +49,30 @@ class AzureChatOpenAI(BaseChatOpenAI):
|
||||
```
|
||||
|
||||
Key init args — completion params:
|
||||
azure_deployment: str
|
||||
azure_deployment:
|
||||
Name of Azure OpenAI deployment to use.
|
||||
temperature: float
|
||||
temperature:
|
||||
Sampling temperature.
|
||||
max_tokens: int | None
|
||||
max_tokens:
|
||||
Max number of tokens to generate.
|
||||
logprobs: bool | None
|
||||
logprobs:
|
||||
Whether to return logprobs.
|
||||
|
||||
Key init args — client params:
|
||||
api_version: str
|
||||
api_version:
|
||||
Azure OpenAI REST API version to use (distinct from the version of the
|
||||
underlying model). [See more on the different versions.](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#rest-api-versioning)
|
||||
timeout: Union[float, Tuple[float, float], Any, None]
|
||||
timeout:
|
||||
Timeout for requests.
|
||||
max_retries: int | None
|
||||
max_retries:
|
||||
Max number of retries.
|
||||
organization: str | None
|
||||
organization:
|
||||
OpenAI organization ID. If not passed in will be read from env
|
||||
var `OPENAI_ORG_ID`.
|
||||
model: str | None
|
||||
model:
|
||||
The name of the underlying OpenAI model. Used for tracing and token
|
||||
counting. Does not affect completion. E.g. `'gpt-4'`, `'gpt-35-turbo'`, etc.
|
||||
model_version: str | None
|
||||
model_version:
|
||||
The version of the underlying OpenAI model. Used for tracing and token
|
||||
counting. Does not affect completion. E.g., `'0125'`, `'0125-preview'`, etc.
|
||||
|
||||
@@ -835,15 +835,17 @@ class AzureChatOpenAI(BaseChatOpenAI):
|
||||
|
||||
- a JSON Schema,
|
||||
- a `TypedDict` class,
|
||||
- or a Pydantic class,
|
||||
- an OpenAI function/tool schema.
|
||||
- a Pydantic class,
|
||||
- or an OpenAI function/tool schema.
|
||||
|
||||
If `schema` is a Pydantic class then the model output will be a
|
||||
Pydantic instance of that class, and the model-generated fields will be
|
||||
validated by the Pydantic class. Otherwise the model output will be a
|
||||
dict and will not be validated. See `langchain_core.utils.function_calling.convert_to_openai_tool`
|
||||
for more on how to properly specify types and descriptions of
|
||||
schema fields when specifying a Pydantic or `TypedDict` class.
|
||||
dict and will not be validated.
|
||||
|
||||
See `langchain_core.utils.function_calling.convert_to_openai_tool` for
|
||||
more on how to properly specify types and descriptions of schema fields
|
||||
when specifying a Pydantic or `TypedDict` class.
|
||||
|
||||
method: The method for steering model generation, one of:
|
||||
|
||||
@@ -867,8 +869,10 @@ class AzureChatOpenAI(BaseChatOpenAI):
|
||||
an error occurs during model output parsing it will be raised. If `True`
|
||||
then both the raw model response (a `BaseMessage`) and the parsed model
|
||||
response will be returned. If an error occurs during output parsing it
|
||||
will be caught and returned as well. The final output is always a dict
|
||||
with keys `'raw'`, `'parsed'`, and `'parsing_error'`.
|
||||
will be caught and returned as well.
|
||||
|
||||
The final output is always a `dict` with keys `'raw'`, `'parsed'`, and
|
||||
`'parsing_error'`.
|
||||
strict:
|
||||
|
||||
- True:
|
||||
@@ -934,16 +938,18 @@ class AzureChatOpenAI(BaseChatOpenAI):
|
||||
kwargs: Additional keyword args are passed through to the model.
|
||||
|
||||
Returns:
|
||||
A Runnable that takes same inputs as a `langchain_core.language_models.chat.BaseChatModel`.
|
||||
A `Runnable` that takes same inputs as a
|
||||
`langchain_core.language_models.chat.BaseChatModel`. If `include_raw` is
|
||||
`False` and `schema` is a Pydantic class, `Runnable` outputs an instance
|
||||
of `schema` (i.e., a Pydantic object). Otherwise, if `include_raw` is
|
||||
`False` then `Runnable` outputs a `dict`.
|
||||
|
||||
If `include_raw` is False and `schema` is a Pydantic class, Runnable outputs
|
||||
an instance of `schema` (i.e., a Pydantic object). Otherwise, if `include_raw` is False then Runnable outputs a dict.
|
||||
If `include_raw` is `True`, then `Runnable` outputs a `dict` with keys:
|
||||
|
||||
If `include_raw` is True, then Runnable outputs a dict with keys:
|
||||
|
||||
- `'raw'`: BaseMessage
|
||||
- `'parsed'`: None if there was a parsing error, otherwise the type depends on the `schema` as described above.
|
||||
- `'parsing_error'`: BaseException | None
|
||||
- `'raw'`: `BaseMessage`
|
||||
- `'parsed'`: `None` if there was a parsing error, otherwise the type
|
||||
depends on the `schema` as described above.
|
||||
- `'parsing_error'`: `BaseException | None`
|
||||
|
||||
!!! warning "Behavior changed in 0.3.0"
|
||||
`method` default changed from "function_calling" to "json_schema".
|
||||
|
||||
@@ -1744,9 +1744,11 @@ class BaseChatOpenAI(BaseChatModel):
|
||||
If `schema` is a Pydantic class then the model output will be a
|
||||
Pydantic instance of that class, and the model-generated fields will be
|
||||
validated by the Pydantic class. Otherwise the model output will be a
|
||||
dict and will not be validated. See `langchain_core.utils.function_calling.convert_to_openai_tool`
|
||||
for more on how to properly specify types and descriptions of
|
||||
schema fields when specifying a Pydantic or `TypedDict` class.
|
||||
dict and will not be validated.
|
||||
|
||||
See `langchain_core.utils.function_calling.convert_to_openai_tool` for
|
||||
more on how to properly specify types and descriptions of schema fields
|
||||
when specifying a Pydantic or `TypedDict` class.
|
||||
|
||||
method: The method for steering model generation, one of:
|
||||
|
||||
@@ -1765,8 +1767,10 @@ class BaseChatOpenAI(BaseChatModel):
|
||||
an error occurs during model output parsing it will be raised. If `True`
|
||||
then both the raw model response (a `BaseMessage`) and the parsed model
|
||||
response will be returned. If an error occurs during output parsing it
|
||||
will be caught and returned as well. The final output is always a dict
|
||||
with keys `'raw'`, `'parsed'`, and `'parsing_error'`.
|
||||
will be caught and returned as well.
|
||||
|
||||
The final output is always a `dict` with keys `'raw'`, `'parsed'`, and
|
||||
`'parsing_error'`.
|
||||
strict:
|
||||
|
||||
- `True`:
|
||||
@@ -1827,25 +1831,25 @@ class BaseChatOpenAI(BaseChatModel):
|
||||
kwargs: Additional keyword args are passed through to the model.
|
||||
|
||||
Returns:
|
||||
A `Runnable` that takes same inputs as a `BaseChatModel`.
|
||||
A `Runnable` that takes same inputs as a
|
||||
`langchain_core.language_models.chat.BaseChatModel`. If `include_raw` is
|
||||
`False` and `schema` is a Pydantic class, `Runnable` outputs an instance
|
||||
of `schema` (i.e., a Pydantic object). Otherwise, if `include_raw` is
|
||||
`False` then `Runnable` outputs a `dict`.
|
||||
|
||||
If `include_raw` is `False` and `schema` is a Pydantic class, `Runnable`
|
||||
outputs an instance of `schema` (i.e., a Pydantic object). Otherwise, if
|
||||
`include_raw` is `False` then `Runnable` outputs a `dict`.
|
||||
If `include_raw` is `True`, then `Runnable` outputs a `dict` with keys:
|
||||
|
||||
If `include_raw` is `True`, then `Runnable` outputs a dict with keys:
|
||||
|
||||
- `'raw'`: `BaseMessage`
|
||||
- `'parsed'`: `None` if there was a parsing error, otherwise the type depends
|
||||
on the `schema` as described above.
|
||||
- `'parsing_error'`: `BaseException` or `None`
|
||||
- `'raw'`: `BaseMessage`
|
||||
- `'parsed'`: `None` if there was a parsing error, otherwise the type
|
||||
depends on the `schema` as described above.
|
||||
- `'parsing_error'`: `BaseException | None`
|
||||
|
||||
!!! warning "Behavior changed in 0.3.12"
|
||||
Support for `tools` added.
|
||||
|
||||
!!! warning "Behavior changed in 0.3.21"
|
||||
Pass `kwargs` through to the model.
|
||||
""" # noqa: E501
|
||||
"""
|
||||
if strict is not None and method == "json_mode":
|
||||
msg = "Argument `strict` is not supported with `method`='json_mode'"
|
||||
raise ValueError(msg)
|
||||
@@ -2832,17 +2836,19 @@ class ChatOpenAI(BaseChatOpenAI): # type: ignore[override]
|
||||
Args:
|
||||
schema: The output schema. Can be passed in as:
|
||||
|
||||
- an OpenAI function/tool schema,
|
||||
- a JSON Schema,
|
||||
- a `TypedDict` class,
|
||||
- or a Pydantic class,
|
||||
- an OpenAI function/tool schema.
|
||||
- or a Pydantic class.
|
||||
|
||||
If `schema` is a Pydantic class then the model output will be a
|
||||
Pydantic instance of that class, and the model-generated fields will be
|
||||
validated by the Pydantic class. Otherwise the model output will be a
|
||||
dict and will not be validated. See `langchain_core.utils.function_calling.convert_to_openai_tool`
|
||||
for more on how to properly specify types and descriptions of
|
||||
schema fields when specifying a Pydantic or `TypedDict` class.
|
||||
dict and will not be validated.
|
||||
|
||||
See `langchain_core.utils.function_calling.convert_to_openai_tool` for
|
||||
more on how to properly specify types and descriptions of schema fields
|
||||
when specifying a Pydantic or `TypedDict` class.
|
||||
|
||||
method: The method for steering model generation, one of:
|
||||
|
||||
@@ -2864,8 +2870,10 @@ class ChatOpenAI(BaseChatOpenAI): # type: ignore[override]
|
||||
an error occurs during model output parsing it will be raised. If `True`
|
||||
then both the raw model response (a `BaseMessage`) and the parsed model
|
||||
response will be returned. If an error occurs during output parsing it
|
||||
will be caught and returned as well. The final output is always a dict
|
||||
with keys `'raw'`, `'parsed'`, and `'parsing_error'`.
|
||||
will be caught and returned as well.
|
||||
|
||||
The final output is always a `dict` with keys `'raw'`, `'parsed'`, and
|
||||
`'parsing_error'`.
|
||||
strict:
|
||||
|
||||
- `True`:
|
||||
@@ -2931,16 +2939,18 @@ class ChatOpenAI(BaseChatOpenAI): # type: ignore[override]
|
||||
kwargs: Additional keyword args are passed through to the model.
|
||||
|
||||
Returns:
|
||||
A Runnable that takes same inputs as a `langchain_core.language_models.chat.BaseChatModel`.
|
||||
A `Runnable` that takes same inputs as a
|
||||
`langchain_core.language_models.chat.BaseChatModel`. If `include_raw` is
|
||||
`False` and `schema` is a Pydantic class, `Runnable` outputs an instance
|
||||
of `schema` (i.e., a Pydantic object). Otherwise, if `include_raw` is
|
||||
`False` then `Runnable` outputs a `dict`.
|
||||
|
||||
If `include_raw` is `False` and `schema` is a Pydantic class, Runnable outputs
|
||||
an instance of `schema` (i.e., a Pydantic object). Otherwise, if `include_raw` is `False` then `Runnable` outputs a `dict`.
|
||||
If `include_raw` is `True`, then `Runnable` outputs a `dict` with keys:
|
||||
|
||||
If `include_raw` is `True`, then `Runnable` outputs a `dict` with keys:
|
||||
|
||||
- `'raw'`: `BaseMessage`
|
||||
- `'parsed'`: `None` if there was a parsing error, otherwise the type depends on the `schema` as described above.
|
||||
- `'parsing_error'`: `BaseException` or `None`
|
||||
- `'raw'`: `BaseMessage`
|
||||
- `'parsed'`: `None` if there was a parsing error, otherwise the type
|
||||
depends on the `schema` as described above.
|
||||
- `'parsing_error'`: `BaseException | None`
|
||||
|
||||
!!! warning "Behavior changed in 0.3.0"
|
||||
`method` default changed from `"function_calling"` to `"json_schema"`.
|
||||
|
||||
@@ -38,14 +38,11 @@ class AzureOpenAIEmbeddings(OpenAIEmbeddings): # type: ignore[override]
|
||||
```
|
||||
|
||||
Key init args — completion params:
|
||||
model: str
|
||||
Name of AzureOpenAI model to use.
|
||||
dimensions: int | None
|
||||
Number of dimensions for the embeddings. Can be specified only
|
||||
if the underlying model supports it.
|
||||
|
||||
Key init args — client params:
|
||||
api_key: SecretStr | None
|
||||
model:
|
||||
Name of `AzureOpenAI` model to use.
|
||||
dimensions:
|
||||
Number of dimensions for the embeddings. Can be specified only if the
|
||||
underlying model supports it.
|
||||
|
||||
See full list of supported init args and their descriptions in the params section.
|
||||
|
||||
|
||||
@@ -90,21 +90,21 @@ class OpenAIEmbeddings(BaseModel, Embeddings):
|
||||
```
|
||||
|
||||
Key init args — embedding params:
|
||||
model: str
|
||||
model:
|
||||
Name of OpenAI model to use.
|
||||
dimensions: int | None = None
|
||||
dimensions:
|
||||
The number of dimensions the resulting output embeddings should have.
|
||||
Only supported in `'text-embedding-3'` and later models.
|
||||
|
||||
Key init args — client params:
|
||||
api_key: SecretStr | None = None
|
||||
api_key:
|
||||
OpenAI API key.
|
||||
organization: str | None = None
|
||||
organization:
|
||||
OpenAI organization ID. If not passed in will be read
|
||||
from env var `OPENAI_ORG_ID`.
|
||||
max_retries: int = 2
|
||||
max_retries:
|
||||
Maximum number of retries to make when generating.
|
||||
request_timeout: float | Tuple[float, float] | Any | None = None
|
||||
request_timeout:
|
||||
Timeout for requests to OpenAI completion API
|
||||
|
||||
See full list of supported init args and their descriptions in the params section.
|
||||
|
||||
@@ -62,46 +62,46 @@ class BaseOpenAI(BaseLLM):
|
||||
```
|
||||
|
||||
Key init args — completion params:
|
||||
model_name: str
|
||||
model_name:
|
||||
Name of OpenAI model to use.
|
||||
temperature: float
|
||||
temperature:
|
||||
Sampling temperature.
|
||||
max_tokens: int
|
||||
max_tokens:
|
||||
Max number of tokens to generate.
|
||||
top_p: float
|
||||
top_p:
|
||||
Total probability mass of tokens to consider at each step.
|
||||
frequency_penalty: float
|
||||
frequency_penalty:
|
||||
Penalizes repeated tokens according to frequency.
|
||||
presence_penalty: float
|
||||
presence_penalty:
|
||||
Penalizes repeated tokens.
|
||||
n: int
|
||||
n:
|
||||
How many completions to generate for each prompt.
|
||||
best_of: int
|
||||
best_of:
|
||||
Generates best_of completions server-side and returns the "best".
|
||||
logit_bias: dict[str, float] | None
|
||||
logit_bias:
|
||||
Adjust the probability of specific tokens being generated.
|
||||
seed: int | None
|
||||
seed:
|
||||
Seed for generation.
|
||||
logprobs: int | None
|
||||
logprobs:
|
||||
Include the log probabilities on the logprobs most likely output tokens.
|
||||
streaming: bool
|
||||
streaming:
|
||||
Whether to stream the results or not.
|
||||
|
||||
Key init args — client params:
|
||||
openai_api_key: SecretStr | None
|
||||
openai_api_key:
|
||||
OpenAI API key. If not passed in will be read from env var
|
||||
`OPENAI_API_KEY`.
|
||||
openai_api_base: str | None
|
||||
openai_api_base:
|
||||
Base URL path for API requests, leave blank if not using a proxy or
|
||||
service emulator.
|
||||
openai_organization: str | None
|
||||
openai_organization:
|
||||
OpenAI organization ID. If not passed in will be read from env
|
||||
var `OPENAI_ORG_ID`.
|
||||
request_timeout: Union[float, tuple[float, float], Any, None]
|
||||
request_timeout:
|
||||
Timeout for requests to OpenAI completion API.
|
||||
max_retries: int
|
||||
max_retries:
|
||||
Maximum number of retries to make when generating.
|
||||
batch_size: int
|
||||
batch_size:
|
||||
Batch size to use when passing multiple documents to generate.
|
||||
|
||||
See full list of supported init args and their descriptions in the params section.
|
||||
@@ -707,29 +707,29 @@ class OpenAI(BaseOpenAI):
|
||||
```
|
||||
|
||||
Key init args — completion params:
|
||||
model: str
|
||||
model:
|
||||
Name of OpenAI model to use.
|
||||
temperature: float
|
||||
temperature:
|
||||
Sampling temperature.
|
||||
max_tokens: int | None
|
||||
max_tokens:
|
||||
Max number of tokens to generate.
|
||||
logprobs: bool | None
|
||||
logprobs:
|
||||
Whether to return logprobs.
|
||||
stream_options: Dict
|
||||
stream_options:
|
||||
Configure streaming outputs, like whether to return token usage when
|
||||
streaming (`{"include_usage": True}`).
|
||||
|
||||
Key init args — client params:
|
||||
timeout: Union[float, Tuple[float, float], Any, None]
|
||||
timeout:
|
||||
Timeout for requests.
|
||||
max_retries: int
|
||||
max_retries:
|
||||
Max number of retries.
|
||||
api_key: str | None
|
||||
api_key:
|
||||
OpenAI API key. If not passed in will be read from env var `OPENAI_API_KEY`.
|
||||
base_url: str | None
|
||||
base_url:
|
||||
Base URL for API requests. Only specify if using a proxy or service
|
||||
emulator.
|
||||
organization: str | None
|
||||
organization:
|
||||
OpenAI organization ID. If not passed in will be read from env
|
||||
var `OPENAI_ORG_ID`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user