Skip to content

Commit 48ca001

Browse files
committed
Try to trigger gen_ai.invoke_agent spans but doesn't work so far
1 parent 53fa154 commit 48ca001

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

dev-packages/node-integration-tests/suites/tracing/langchain/scenario.mjs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ChatAnthropic } from '@langchain/anthropic';
2-
import * as langchain from 'langchain';
2+
import { LLMChain } from 'langchain/chains';
3+
import { PromptTemplate } from '@langchain/core/prompts';
34
import * as Sentry from '@sentry/node';
45
import express from 'express';
56

@@ -101,6 +102,25 @@ async function run() {
101102
} catch {
102103
// Expected error
103104
}
105+
106+
// Test 4: LLMChain
107+
const chainModel = new ChatAnthropic({
108+
model: 'claude-3-5-sonnet-20241022',
109+
temperature: 0,
110+
apiKey: 'mock-api-key',
111+
clientOptions: {
112+
baseURL: baseUrl,
113+
},
114+
});
115+
116+
const prompt = PromptTemplate.fromTemplate('Answer the following question: {question}');
117+
118+
const chain = new LLMChain({
119+
llm: chainModel,
120+
prompt: prompt,
121+
});
122+
123+
await chain.call({ question: 'What is 2+2?' });
104124
});
105125

106126
await Sentry.flush(2000);

dev-packages/node-integration-tests/suites/tracing/langchain/test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ describe('LangChain integration', () => {
6868
origin: 'auto.ai.langchain',
6969
status: 'internal_error',
7070
}),
71+
// Fourth span - agent executor
72+
expect.objectContaining({
73+
op: 'gen_ai.invoke_agent',
74+
}),
7175
]),
7276
};
7377

0 commit comments

Comments
 (0)