Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions rag/cdk/lambda/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ export async function handle(
'あなたは文書からコンテキストを取得する専門家です。ツールを使用してユーザーの質問に答える手助けをしてください。必ずユーザーの質問と同じ言語で答えてください。';

const { platform, model, modelName } = selectLlm(modelType);

const agent = createAgent({ model, tools: [tool], systemPrompt });
Comment thread
poad marked this conversation as resolved.

// Initialize Langfuse callback handler
const langfuseHandler = langfuse.publicKey && langfuse.secretKey ? new CallbackHandler({
sessionId,
Expand All @@ -43,6 +40,12 @@ export async function handle(
tags: [modelName],
}) : undefined;

const agent = createAgent({
model,
tools: [tool],
systemPrompt,
});
Comment thread
poad marked this conversation as resolved.

logger.debug(`Langfuse: ${langfuseHandler ? 'enable' : 'disable'}`);

const threadId = uuidv7();
Expand All @@ -54,8 +57,9 @@ export async function handle(
configurable: {
sessionId,
thread_id: threadId,
callbacks: langfuseHandler ? [langfuseHandler] : [],
},
//@ts-expect-error LangChain.js の型定義誤り?
callbacks: langfuseHandler ? [langfuseHandler] : [],
Comment thread
poad marked this conversation as resolved.
},
);
for await (const sEvent of stream) {
Expand Down