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
Copy file name to clipboardExpand all lines: content/en/docs/eino/core_modules/components/chat_model_guide.md
+42-42Lines changed: 42 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,18 +3,18 @@ Description: ""
3
3
date: "2026-01-20"
4
4
lastmod: ""
5
5
tags: []
6
-
title: 'Eino: ChatModel Guide'
7
-
weight: 1
6
+
title: 'Eino: ChatModel User Guide'
7
+
weight: 8
8
8
---
9
9
10
-
## Overview
10
+
## Introduction
11
11
12
-
The Model component is used to interact with large language models. Its main purpose is to send user input messages to the language model and obtain the model's response. This component plays an important role in the following scenarios:
12
+
The Model component is a component for interacting with large language models. Its main purpose is to send user input messages to the language model and obtain the model's response. This component plays an important role in the following scenarios:
When implementing a custom ChatModel component, pay attention to the following points:
346
+
When implementing a custom ChatModel component, note the following:
347
347
348
348
1. Make sure to implement common options
349
-
2. Make sure to implement the callback mechanism
350
-
3. Remember to close the writer after streaming output is complete
349
+
2. Make sure to implement callback mechanism
350
+
3. Remember to close the writer after completing output in streaming mode
351
351
352
352
### Option Mechanism
353
353
354
-
If a custom ChatModel needs Options beyond the common Options, you can use the component abstraction utility functions to implement custom Options, for example:
354
+
Custom ChatModel can use the component abstraction utility function to implement custom Options if Options beyond common Options are needed, for example:
// Pipe produces a StreamReader and a StreamWriter; writing to StreamWriter can be read from StreamReader, both are concurrency-safe.
505
-
//The implementation asynchronously writes generated content to StreamWriter and returns StreamReader as the return value
506
-
// ***StreamReader is a data stream that can only be read once. When implementing Callback yourself, you need to pass the data stream to callback via OnEndWithCallbackOutput and also return a data stream, requiring a copy of the data stream
507
-
// Considering this scenario always requires copying the data stream, the OnEndWithStreamOutput function will copy internally and return an unread stream
508
-
// The following code demonstrates one stream processing approach; the processing method is not unique
504
+
// Pipe produces a StreamReader and StreamWriter. Writing to StreamWriter can be read from StreamReader, both are concurrency-safe.
505
+
//In implementation, write generated content to StreamWriter asynchronously and return StreamReader as return value
506
+
// ***StreamReader is a data stream that can only be read once. When implementing Callback yourself, you need to pass the data stream to callback via OnEndWithCallbackOutput and also return a data stream, requiring copying the data stream.
507
+
// Considering this scenario always requires copying the data stream, the OnEndWithCallbackOutput function copies internally and returns an unread stream.
508
+
// The following code demonstrates one stream handling approach; handling approaches are not unique.
0 commit comments