Skip to content

Commit 091673e

Browse files
feat(component): add ChatLLM binding for chat conversations
- Add ChatLLM binding to support separate LLM model for chat - Update CallLLMNode to use ChatLLM instead of CheapLLM - Update test fixtures to bind ChatLLM in all configurations - Update unit tests to include ChatLLM binding This enables 3 distinct LLM models: - SmartLLM: Query generation from scratch - CheapLLM: Query generation from cached samples - ChatLLM: Chat conversations
1 parent 6151729 commit 091673e

4 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/__tests__/fixtures/test-app.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,23 @@ export class TestApp extends BootMixin(
4444
this.bind(AiIntegrationBindings.CheapLLM).toProvider(Ollama);
4545
this.bind(AiIntegrationBindings.SmartLLM).toProvider(Ollama);
4646
this.bind(AiIntegrationBindings.FileLLM).toProvider(Ollama);
47+
this.bind(AiIntegrationBindings.ChatLLM).toProvider(Ollama);
4748
this.bind(AiIntegrationBindings.EmbeddingModel).toProvider(
4849
OllamaEmbedding,
4950
);
5051
} else if (process.env.CEREBRAS === '1') {
5152
this.bind(AiIntegrationBindings.CheapLLM).toProvider(Cerebras);
5253
this.bind(AiIntegrationBindings.SmartLLM).toProvider(Cerebras);
5354
this.bind(AiIntegrationBindings.FileLLM).toProvider(Cerebras);
55+
this.bind(AiIntegrationBindings.ChatLLM).toProvider(Cerebras);
5456
this.bind(AiIntegrationBindings.EmbeddingModel).toProvider(
5557
OllamaEmbedding,
5658
);
5759
} else if (options.llmStub) {
5860
this.bind(AiIntegrationBindings.CheapLLM).to(options.llmStub);
5961
this.bind(AiIntegrationBindings.SmartLLM).to(options.llmStub);
6062
this.bind(AiIntegrationBindings.FileLLM).to(options.llmStub);
63+
this.bind(AiIntegrationBindings.ChatLLM).to(options.llmStub);
6164
this.bind(AiIntegrationBindings.EmbeddingModel).to(options.llmStub);
6265
}
6366
this.bind('datasources.readerdb').to(

src/__tests__/unit/nodes/call-llm.node.unit.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ describe('CallLLMNode Unit', function () {
3737
context.bind(AuthenticationBindings.CURRENT_USER).to(stubUser());
3838
context.bind(AiIntegrationBindings.SmartLLM).to(llmProvider);
3939
context.bind(AiIntegrationBindings.CheapLLM).to(llmProvider);
40+
context.bind(AiIntegrationBindings.ChatLLM).to(llmProvider);
4041
context.bind('datasources.readerdb').to(
4142
new juggler.DataSource({
4243
connector: 'sqlite3',

src/graphs/chat/nodes/call-llm.node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const debug = require('debug')('ai-integration:chat:call-llm.node');
1717
@graphNode(ChatNodes.CallLLM)
1818
export class CallLLMNode implements IGraphNode<ChatState> {
1919
constructor(
20-
@inject(AiIntegrationBindings.CheapLLM)
20+
@inject(AiIntegrationBindings.ChatLLM)
2121
private readonly llm: LLMProvider,
2222
@inject(AiIntegrationBindings.Tools)
2323
private readonly tools: ToolStore,

src/keys.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export namespace AiIntegrationBindings {
2424
export const FileLLM = BindingKey.create<LLMProvider>(
2525
'services.ai-reporting.fileLLMProvider',
2626
);
27+
export const ChatLLM = BindingKey.create<LLMProvider>(
28+
'services.ai-reporting.chatLLMProvider',
29+
);
2730
export const EmbeddingModel = BindingKey.create<EmbeddingProvider>(
2831
'services.ai-reporting.embeddingModel',
2932
);

0 commit comments

Comments
 (0)