Skip to content
Draft
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions dev-packages/node-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"ioredis": "^5.4.1",
"kafkajs": "2.2.4",
"knex": "^2.5.1",
"langchain": "^0.3.28",
"lru-memoizer": "2.3.0",
"mongodb": "^3.7.3",
"mongodb-memory-server-global": "^10.1.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ChatAnthropic } from '@langchain/anthropic';
import { LLMChain } from 'langchain/chains';
import { PromptTemplate } from '@langchain/core/prompts';
import * as Sentry from '@sentry/node';
import express from 'express';

Expand Down Expand Up @@ -100,6 +102,25 @@ async function run() {
} catch {
// Expected error
}

// Test 4: LLMChain
const chainModel = new ChatAnthropic({
model: 'claude-3-5-sonnet-20241022',
temperature: 0,
apiKey: 'mock-api-key',
clientOptions: {
baseURL: baseUrl,
},
});

const prompt = PromptTemplate.fromTemplate('Answer the following question: {question}');

const chain = new LLMChain({
llm: chainModel,
prompt: prompt,
});

await chain.call({ question: 'What is 2+2?' });
});

await Sentry.flush(2000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ describe('LangChain integration', () => {
origin: 'auto.ai.langchain',
status: 'internal_error',
}),
// Fourth span - agent executor
expect.objectContaining({
op: 'gen_ai.invoke_agent',
}),
]),
};

Expand Down Expand Up @@ -179,7 +183,7 @@ describe('LangChain integration', () => {
'gen_ai.response.id': expect.any(String),
'gen_ai.response.model': expect.any(String),
'gen_ai.response.stop_reason': 'tool_use',
'gen_ai.response.tool_calls': expect.any(String),
'gen_ai.response.tool_calls': expect.stringContaining('get_weather'),
}),
description: 'chat claude-3-5-sonnet-20241022',
op: 'gen_ai.chat',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ describe('Vercel AI integration', () => {
'vercel.ai.prompt': '{"prompt":"What is the weather in San Francisco?"}',
'vercel.ai.response.finishReason': 'tool-calls',
'gen_ai.response.text': 'Tool call completed!',
'gen_ai.response.tool_calls': expect.any(String),
'gen_ai.response.tool_calls': expect.stringContaining('getWeather'),
'vercel.ai.settings.maxRetries': 2,
'vercel.ai.settings.maxSteps': 1,
'vercel.ai.streaming': false,
Expand Down Expand Up @@ -364,7 +364,7 @@ describe('Vercel AI integration', () => {
'vercel.ai.response.model': 'mock-model-id',
'gen_ai.response.text': 'Tool call completed!',
'vercel.ai.response.timestamp': expect.any(String),
'gen_ai.response.tool_calls': expect.any(String),
'gen_ai.response.tool_calls': expect.stringContaining('getWeather'),
'vercel.ai.settings.maxRetries': 2,
'vercel.ai.streaming': false,
'gen_ai.request.model': 'mock-model-id',
Expand Down
53 changes: 53 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4931,6 +4931,22 @@
zod "^3.25.32"
zod-to-json-schema "^3.22.3"

"@langchain/openai@>=0.1.0 <0.7.0":
version "0.6.16"
resolved "https://registry.yarnpkg.com/@langchain/openai/-/openai-0.6.16.tgz#fed8bc90127d15255e0e4ee527c7eadb75b21e9c"
integrity sha512-v9INBOjE0w6ZrUE7kP9UkRyNsV7daH7aPeSOsPEJ35044UI3udPHwNduQ8VmaOUsD26OvSdg1b1GDhrqWLMaRw==
dependencies:
js-tiktoken "^1.0.12"
openai "5.12.2"
zod "^3.25.32"

"@langchain/textsplitters@>=0.0.0 <0.2.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@langchain/textsplitters/-/textsplitters-0.1.0.tgz#f37620992192df09ecda3dfbd545b36a6bcbae46"
integrity sha512-djI4uw9rlkAb5iMhtLED+xJebDdAG935AdP4eRTB02R7OB/act55Bj9wsskhZsvuyQRpO4O1wQOp85s6T6GWmw==
dependencies:
js-tiktoken "^1.0.12"

"@leichtgewicht/ip-codec@^2.0.1":
version "2.0.4"
resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b"
Expand Down Expand Up @@ -20296,6 +20312,11 @@ jsonparse@^1.2.0, jsonparse@^1.3.1:
resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280"
integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==

jsonpointer@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-5.0.1.tgz#2110e0af0900fd37467b5907ecd13a7884a1b559"
integrity sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==

jsonwebtoken@^9.0.0:
version "9.0.2"
resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz#65ff91f4abef1784697d40952bb1998c504caaf3"
Expand Down Expand Up @@ -20474,6 +20495,23 @@ lambda-local@^2.2.0:
dotenv "^16.3.1"
winston "^3.10.0"

langchain@^0.3.28:
version "0.3.36"
resolved "https://registry.yarnpkg.com/langchain/-/langchain-0.3.36.tgz#6ab7f4028adae16bf74538aa2127df9fe2fddf02"
integrity sha512-PqC19KChFF0QlTtYDFgfEbIg+SCnCXox29G8tY62QWfj9bOW7ew2kgWmPw5qoHLOTKOdQPvXET20/1Pdq8vAtQ==
dependencies:
"@langchain/openai" ">=0.1.0 <0.7.0"
"@langchain/textsplitters" ">=0.0.0 <0.2.0"
js-tiktoken "^1.0.12"
js-yaml "^4.1.0"
jsonpointer "^5.0.1"
langsmith "^0.3.67"
openapi-types "^12.1.3"
p-retry "4"
uuid "^10.0.0"
yaml "^2.2.1"
zod "^3.25.32"

langsmith@^0.3.67:
version "0.3.74"
resolved "https://registry.npmjs.org/langsmith/-/langsmith-0.3.74.tgz#014d31a9ff7530b54f0d797502abd512ce8fb6fb"
Expand Down Expand Up @@ -23934,11 +23972,21 @@ open@^9.1.0:
is-inside-container "^1.0.0"
is-wsl "^2.2.0"

openai@5.12.2:
version "5.12.2"
resolved "https://registry.yarnpkg.com/openai/-/openai-5.12.2.tgz#512ab6b80eb8414837436e208f1b951442b97761"
integrity sha512-xqzHHQch5Tws5PcKR2xsZGX9xtch+JQFz5zb14dGqlshmmDAFBFEWmeIpf7wVqWV+w7Emj7jRgkNJakyKE0tYQ==

openai@5.18.1:
version "5.18.1"
resolved "https://registry.yarnpkg.com/openai/-/openai-5.18.1.tgz#1c4884aefcada7ec684771e03c860c381f1902c1"
integrity sha512-iXSOfLlOL+jgnFr5CGrB2SEZw5C92o1nrFW2SasoAXj4QxGhfeJPgg8zkX+vaCfX80cT6CWjgaGnq7z9XzbyRw==

openapi-types@^12.1.3:
version "12.1.3"
resolved "https://registry.yarnpkg.com/openapi-types/-/openapi-types-12.1.3.tgz#471995eb26c4b97b7bd356aacf7b91b73e777dd3"
integrity sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==

opener@^1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598"
Expand Down Expand Up @@ -31796,6 +31844,11 @@ yaml@^1.10.0, yaml@^1.10.2:
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==

yaml@^2.2.1:
version "2.8.1"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.8.1.tgz#1870aa02b631f7e8328b93f8bc574fac5d6c4d79"
integrity sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==

yaml@^2.5.0:
version "2.5.1"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.1.tgz#c9772aacf62cb7494a95b0c4f1fb065b563db130"
Expand Down
Loading