You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Overview
- Fix link on Deep Agents overview DOC-427
- Fix "structured outputs" terminology (no s) and anchor link DOC-412
- Add Streaming usage metadata section to AzureChatOpenAI docs DOC-428
- Fix mermaid dark mode on Tools docs DOC-430
- Fix broken link on Persistence page DOC-387
## Type of change
**Type:** Fixes
## Related issues/PRs
- Linear issue: Closes DOC-427, DOC-412, DOC-428, DOC-430, DOC387
## Checklist
<!-- Put an 'x' in all boxes that apply -->
- [x] I have read the [contributing guidelines](README.md)
- [x] I have tested my changes locally using `docs dev`
- [x] All code examples have been tested and work correctly
- [x] I have used **root relative** paths for internal links
- [x] I have updated navigation in `src/docs.json` if needed
- I have gotten approval from the relevant reviewers
- (Internal team members only / optional) I have created a preview
deployment using the [Create Preview Branch
workflow](https://github.com/langchain-ai/docs/actions/workflows/create-preview-branch.yml)
## Additional notes
<!-- Any other information that would be helpful for reviewers -->
Copy file name to clipboardExpand all lines: src/langsmith/prompt-engineering-concepts.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ Tools are interfaces the LLM can use to interact with the outside world. Tools c
77
77
Structured output is a feature of most state of the art LLMs, wherein instead of producing raw text as output they stick to a specified schema. This may or may not use [Tools](#tools) under the hood.
78
78
79
79
<Check>
80
-
Structured outputs are similar to tools, but different in a few key ways. With tools, the LLM choose which tool to call (or may choose not to call any); with structured output, the LLM**always** responds in this format. With tools, the LLM may select **multiple** tools; with structured output, only one response is generate.
80
+
Structured output is similar to tools, but different in a few key ways. With tools, the LLM choose which tool to call (or may choose not to call any); with structured output, the LLM**always** responds in this format. With tools, the LLM may select **multiple** tools; with structured output, only one response is generate.
Copy file name to clipboardExpand all lines: src/langsmith/trace-with-instructor.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Trace with Instructor
3
3
sidebarTitle: Instructor (Python only)
4
4
---
5
5
6
-
LangSmith provides a convenient integration with [Instructor](https://python.useinstructor.com/), a popular open-source library for generating structured outputs with LLMs.
6
+
LangSmith provides a convenient integration with [Instructor](https://python.useinstructor.com/), a popular open-source library for generating structured output with LLMs.
7
7
8
8
In order to use, you first need to set your LangSmith API key.
Copy file name to clipboardExpand all lines: src/oss/langchain/models.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ import ChatModelTabsJS from '/snippets/chat-model-tabs-js.mdx';
10
10
In addition to text generation, many models support:
11
11
12
12
* <Iconicon="hammer"size={16} /> [Tool calling](#tool-calling) - calling external tools (like databases queries or API calls) and use results in their responses.
13
-
* <Iconicon="shapes"size={16} /> [Structured output](#structured-outputs) - where the model's response is constrained to follow a defined format.
13
+
* <Iconicon="shapes"size={16} /> [Structured output](#structured-output) - where the model's response is constrained to follow a defined format.
14
14
* <Iconicon="image"size={16} /> [Multimodality](#multimodal) - process and return data other than text, such as images, audio, and video.
15
15
* <Iconicon="brain"size={16} /> [Reasoning](#reasoning) - models perform multi-step reasoning to arrive at a conclusion.
16
16
@@ -889,9 +889,9 @@ Below, we show some common ways you can use tool calling.
889
889
890
890
---
891
891
892
-
## Structured outputs
892
+
## Structured output
893
893
894
-
Models can be requested to provide their response in a format matching a given schema. This is useful for ensuring the output can be easily parsed and used in subsequent processing. LangChain supports multiple schema types and methods for enforcing structured outputs.
894
+
Models can be requested to provide their response in a format matching a given schema. This is useful for ensuring the output can be easily parsed and used in subsequent processing. LangChain supports multiple schema types and methods for enforcing structured output.
895
895
896
896
:::python
897
897
<Tabs>
@@ -1043,7 +1043,7 @@ Models can be requested to provide their response in a format matching a given s
1043
1043
1044
1044
:::python
1045
1045
<Note>
1046
-
**Key considerations for structured outputs:**
1046
+
**Key considerations for structured output:**
1047
1047
1048
1048
-**Method parameter**: Some providers support different methods (`'json_schema'`, `'function_calling'`, `'json_mode'`)
1049
1049
- `'json_schema'` typically refers to dedicated structured output features offered by a provider
@@ -1056,7 +1056,7 @@ Models can be requested to provide their response in a format matching a given s
1056
1056
1057
1057
:::js
1058
1058
<Note>
1059
-
**Key considerations for structured outputs:**
1059
+
**Key considerations for structured output:**
1060
1060
1061
1061
-**Method parameter**: Some providers support different methods (`'jsonSchema'`, `'functionCalling'`, `'jsonMode'`)
1062
1062
-**Include raw**: Use @[`includeRaw: true`][BaseChatModel.with_structured_output(include_raw)] to get both the parsed output and the raw @[`AIMessage`]
Copy file name to clipboardExpand all lines: src/oss/langgraph/persistence.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -600,7 +600,7 @@ A [state schema](/oss/langgraph/graph-api#schema) specifies a set of keys that a
600
600
601
601
But, what if we want to retain some information _across threads_? Consider the case of a chatbot where we want to retain specific information about the user across _all_ chat conversations (e.g., threads) with that user!
602
602
603
-
With checkpointers alone, we cannot share information across threads. This motivates the need for the [`Store`](https://python.langchain.com/api_reference/langgraph/index.html#module-langgraph.store) interface. As an illustration, we can define an `InMemoryStore` to store information about a user across threads. We simply compile our graph with a checkpointer, as before, and with our new `in_memory_store` variable.
603
+
With checkpointers alone, we cannot share information across threads. This motivates the need for the [`Store`](https://reference.langchain.com/python/langgraph/store/) interface. As an illustration, we can define an `InMemoryStore` to store information about a user across threads. We simply compile our graph with a checkpointer, as before, and with our new `in_memory_store` variable.
Copy file name to clipboardExpand all lines: src/oss/python/integrations/chat/azure_chat_openai.mdx
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,6 +135,18 @@ print(ai_msg.content)
135
135
J'adore la programmation.
136
136
```
137
137
138
+
## Streaming usage metadata
139
+
140
+
OpenAI's Chat Completions API does not stream token usage statistics by default (see API reference [here](https://platform.openai.com/docs/api-reference/completions/create#completions-create-stream_options)).
141
+
142
+
To recover token counts when streaming with @[`ChatOpenAI`] or `AzureChatOpenAI`, set `stream_usage=True` as an initialization parameter or on invocation:
Azure OpenAI responses contain `model_name` response metadata property, which is name of the model used to generate the response. However unlike native OpenAI responses, it does not contain the specific version of the model, which is set on the deployment in Azure. e.g. it does not distinguish between `gpt-35-turbo-0125` and `gpt-35-turbo-0301`. This makes it tricky to know which version of the model was used to generate the response, which as result can lead to e.g. wrong total cost calculation with `OpenAICallbackHandler`.
0 commit comments