File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
dev-packages/node-integration-tests/suites/tracing/langchain Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 11import { ChatAnthropic } from '@langchain/anthropic' ;
2- import * as langchain from 'langchain' ;
2+ import { LLMChain } from 'langchain/chains' ;
3+ import { PromptTemplate } from '@langchain/core/prompts' ;
34import * as Sentry from '@sentry/node' ;
45import 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 ) ;
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments