mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-16 08:06:14 +00:00
feat(docs): enhance ResponseMetadata
documentation with provider field usage notes (#32472)
This commit is contained in:
parent
13d67cf37e
commit
23c3fa65d4
@ -110,6 +110,22 @@ class ResponseMetadata(TypedDict, total=False):
|
|||||||
The common fields (``model_provider``, ``model_name``) provide a baseline
|
The common fields (``model_provider``, ``model_name``) provide a baseline
|
||||||
contract while preserving flexibility for provider innovations.
|
contract while preserving flexibility for provider innovations.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Not all providers will return the metadata required by this class. In this case,
|
||||||
|
it is acceptable to inject these fields with values at invocation.
|
||||||
|
|
||||||
|
For instance, requests to OpenAI's responses API will not return a provider
|
||||||
|
field in the raw response, as it can be inferred that by making the request, the
|
||||||
|
provider responding is OpenAI. In this case, it is safe to set the
|
||||||
|
``model_provider`` field to ``'openai'`` when creating the message.
|
||||||
|
|
||||||
|
On the other hand, ``model_name`` is often returned, and in such cases it is
|
||||||
|
expected that you populate this field with the unmodified model name (such as
|
||||||
|
``'o1-2024-12-17'``). Only in situations where the provider does not return a
|
||||||
|
model name should you artifically set this field - in which case, the value
|
||||||
|
should be set to the ``model`` or ``model_name`` parameter passed in during
|
||||||
|
invocation.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
model_provider: str
|
model_provider: str
|
||||||
|
@ -1450,6 +1450,22 @@
|
|||||||
|
|
||||||
The common fields (``model_provider``, ``model_name``) provide a baseline
|
The common fields (``model_provider``, ``model_name``) provide a baseline
|
||||||
contract while preserving flexibility for provider innovations.
|
contract while preserving flexibility for provider innovations.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Not all providers will return the metadata required by this class. In this case,
|
||||||
|
it is acceptable to inject these fields with values at invocation.
|
||||||
|
|
||||||
|
For instance, requests to OpenAI's responses API will not return a provider
|
||||||
|
field in the raw response, as it can be inferred that by making the request, the
|
||||||
|
provider responding is OpenAI. In this case, it is safe to set the
|
||||||
|
``model_provider`` field to ``'openai'`` when creating the message.
|
||||||
|
|
||||||
|
On the other hand, ``model_name`` is often returned, and in such cases it is
|
||||||
|
expected that you populate this field with the unmodified model name (such as
|
||||||
|
``'o1-2024-12-17'``). Only in situations where the provider does not return a
|
||||||
|
model name should you artifically set this field - in which case, the value
|
||||||
|
should be set to the ``model`` or ``model_name`` parameter passed in during
|
||||||
|
invocation.
|
||||||
''',
|
''',
|
||||||
'properties': dict({
|
'properties': dict({
|
||||||
'model_name': dict({
|
'model_name': dict({
|
||||||
|
@ -10455,6 +10455,22 @@
|
|||||||
|
|
||||||
The common fields (``model_provider``, ``model_name``) provide a baseline
|
The common fields (``model_provider``, ``model_name``) provide a baseline
|
||||||
contract while preserving flexibility for provider innovations.
|
contract while preserving flexibility for provider innovations.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Not all providers will return the metadata required by this class. In this case,
|
||||||
|
it is acceptable to inject these fields with values at invocation.
|
||||||
|
|
||||||
|
For instance, requests to OpenAI's responses API will not return a provider
|
||||||
|
field in the raw response, as it can be inferred that by making the request, the
|
||||||
|
provider responding is OpenAI. In this case, it is safe to set the
|
||||||
|
``model_provider`` field to ``'openai'`` when creating the message.
|
||||||
|
|
||||||
|
On the other hand, ``model_name`` is often returned, and in such cases it is
|
||||||
|
expected that you populate this field with the unmodified model name (such as
|
||||||
|
``'o1-2024-12-17'``). Only in situations where the provider does not return a
|
||||||
|
model name should you artifically set this field - in which case, the value
|
||||||
|
should be set to the ``model`` or ``model_name`` parameter passed in during
|
||||||
|
invocation.
|
||||||
''',
|
''',
|
||||||
'properties': dict({
|
'properties': dict({
|
||||||
'model_name': dict({
|
'model_name': dict({
|
||||||
|
Loading…
Reference in New Issue
Block a user