@@ -16,6 +16,12 @@ import {
16
16
// AIMessageChunk,
17
17
// } from "@langchain/core/messages";
18
18
19
+ // Uncomment if implementing tool calling
20
+
21
+ // import {
22
+ // type BindToolsInput,
23
+ // } from "@langchain/core/language_models/chat_models";
24
+
19
25
/**
20
26
* Input to chat model class.
21
27
*/
@@ -24,10 +30,10 @@ export interface ChatIntegrationInput extends BaseChatModelParams {}
24
30
/**
25
31
* Integration with a chat model.
26
32
*/
27
- export class ChatIntegration <
28
- CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions
29
- >
30
- extends SimpleChatModel < CallOptions >
33
+ export class ChatIntegration
34
+ // Extend BaseLanguageModelCallOptions and pass it as the generic here
35
+ // to support typing for additional runtime parameters for your integration
36
+ extends SimpleChatModel < BaseLanguageModelCallOptions >
31
37
implements ChatIntegrationInput
32
38
{
33
39
// Used for tracing, replace with the same name as your class
@@ -98,6 +104,22 @@ export class ChatIntegration<
98
104
// }
99
105
// }
100
106
107
+ /**
108
+ * Implement to support tool calling.
109
+ * You must also pass the bound tools into your actual chat completion call.
110
+ * See {@link ../../langchain-cerberas/src/chat_model.ts} for
111
+ * an example.
112
+ */
113
+ // override bindTools(
114
+ // tools: BindToolsInput[],
115
+ // kwargs?: Partial<this["ParsedCallOptions"]>
116
+ // ): Runnable<BaseLanguageModelInput, AIMessageChunk, BaseLanguageModelCallOptions> {
117
+ // return this.bind({
118
+ // tools: tools.map((tool) => convertToIntegrationFormat(tool)),
119
+ // ...kwargs,
120
+ // });
121
+ // }
122
+
101
123
/** @ignore */
102
124
_combineLLMOutput ( ) {
103
125
return [ ] ;
0 commit comments