From a3303533c17f45d3607c9ff9ce81751f56906f2e Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Tue, 23 Jul 2024 14:35:16 -0700 Subject: [PATCH 01/10] genai[patch],standard-tests[patch]: Fix flaky tests/deprecated model (#6185) * genai[patch],standard-tests[patch]: Fix flaky tests/deprecated model * chore: lint files --- .../src/tests/chat_models.int.test.ts | 25 ++----------------- .../src/integration_tests/chat_models.ts | 10 +++++--- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/libs/langchain-google-genai/src/tests/chat_models.int.test.ts b/libs/langchain-google-genai/src/tests/chat_models.int.test.ts index bd532c0bbcf6..4e4791495759 100644 --- a/libs/langchain-google-genai/src/tests/chat_models.int.test.ts +++ b/libs/langchain-google-genai/src/tests/chat_models.int.test.ts @@ -28,7 +28,6 @@ const dummyToolResponse = `[{"title":"Weather in New York City","url":"https://w test("Test Google AI", async () => { const model = new ChatGoogleGenerativeAI({}); const res = await model.invoke("what is 1 + 1?"); - console.log({ res }); expect(res).toBeTruthy(); }); @@ -37,7 +36,6 @@ test("Test Google AI generation", async () => { const res = await model.generate([ [["human", `Translate "I love programming" into Korean.`]], ]); - console.log(JSON.stringify(res, null, 2)); expect(res).toBeTruthy(); }); @@ -48,7 +46,6 @@ test("Test Google AI generation with a stop sequence", async () => { const res = await model.invoke([ ["human", `What are the first three positive whole numbers?`], ]); - console.log(JSON.stringify(res, null, 2)); expect(res).toBeTruthy(); expect(res.additional_kwargs.finishReason).toBe("STOP"); expect(res.content).not.toContain("2"); @@ -63,7 +60,6 @@ test("Test Google AI generation with a system message", async () => { ["human", `Translate "I love programming" into Korean.`], ], ]); - console.log(JSON.stringify(res, null, 2)); expect(res).toBeTruthy(); }); @@ -74,7 +70,7 @@ test("Test Google AI multimodal generation", async () => { await fs.readFile(path.join(__dirname, "/data/hotdog.jpg")) ).toString("base64"); const model = new ChatGoogleGenerativeAI({ - modelName: "gemini-pro-vision", + modelName: "gemini-1.5-flash", }); const res = await model.invoke([ new HumanMessage({ @@ -90,7 +86,6 @@ test("Test Google AI multimodal generation", async () => { ], }), ]); - console.log(JSON.stringify(res, null, 2)); expect(res).toBeTruthy(); }); @@ -114,7 +109,6 @@ test("Test Google AI handleLLMNewToken callback", async () => { }, ] ); - console.log({ tokens }); const responseContent = typeof res.content === "string" ? res.content : ""; expect(tokens).toBe(responseContent); } finally { @@ -141,12 +135,10 @@ test("Test Google AI handleLLMNewToken callback with streaming", async () => { }, ], }); - console.log({ tokens }); let responseContent = ""; for await (const streamItem of res) { responseContent += streamItem.content; } - console.log({ tokens }); expect(tokens).toBe(responseContent); } finally { // Reset the environment variable @@ -174,8 +166,7 @@ test("Test Google AI in streaming mode", async () => { }, ], }); - console.log({ tokens, nrNewTokens }); - expect(nrNewTokens).toBeGreaterThan(1); + expect(nrNewTokens).toBeGreaterThanOrEqual(1); expect(res.content).toBe(tokens); } finally { // Reset the environment variable @@ -223,7 +214,6 @@ test.skip("Gemini can understand audio", async () => { }), }); - console.log(response.content); expect(typeof response.content).toBe("string"); expect((response.content as string).length).toBeGreaterThan(15); }); @@ -276,7 +266,6 @@ test("ChatGoogleGenerativeAI can bind and invoke langchain tools", async () => { }); const res = await modelWithTools.invoke([prompt]); const toolCalls = res.tool_calls; - console.log(toolCalls); expect(toolCalls).toBeDefined(); if (!toolCalls) { throw new Error("tool_calls not in response"); @@ -306,7 +295,6 @@ test("ChatGoogleGenerativeAI can bind and stream langchain tools", async () => { throw new Error("finalChunk is undefined"); } const toolCalls = finalChunk.tool_calls; - console.log(toolCalls); expect(toolCalls).toBeDefined(); if (!toolCalls) { throw new Error("tool_calls not in response"); @@ -393,7 +381,6 @@ test("ChatGoogleGenerativeAI can handle invoking tool messages.", async () => { new ToolMessage(dummyToolResponse, "id", browserTool.name), ]; const response = await modelWithTools.invoke(fullPrompt); - console.log(response); expect(typeof response.content).toBe("string"); expect(response.content.length).toBeGreaterThan(1); expect(response.tool_calls).toHaveLength(0); @@ -407,7 +394,6 @@ test("ChatGoogleGenerativeAI can bind and invoke genai tools", async () => { }); const res = await modelWithTools.invoke([prompt]); const toolCalls = res.tool_calls; - console.log(toolCalls); expect(toolCalls).toBeDefined(); if (!toolCalls) { throw new Error("tool_calls not in response"); @@ -423,7 +409,6 @@ test("ChatGoogleGenerativeAI can bindTools with langchain tools and invoke", asy const modelWithTools = model.bindTools([new FakeBrowserTool()]); const res = await modelWithTools.invoke([prompt]); const toolCalls = res.tool_calls; - console.log(toolCalls); expect(toolCalls).toBeDefined(); if (!toolCalls) { throw new Error("tool_calls not in response"); @@ -439,7 +424,6 @@ test("ChatGoogleGenerativeAI can bindTools with genai tools and invoke", async ( const modelWithTools = model.bindTools([googleGenAITool]); const res = await modelWithTools.invoke([prompt]); const toolCalls = res.tool_calls; - console.log(toolCalls); expect(toolCalls).toBeDefined(); if (!toolCalls) { throw new Error("tool_calls not in response"); @@ -457,7 +441,6 @@ test("ChatGoogleGenerativeAI can call withStructuredOutput langchain tools and i z.infer >(tool.schema); const res = await modelWithTools.invoke([prompt]); - console.log(res); expect(typeof res.url === "string").toBe(true); }); @@ -473,7 +456,6 @@ test("ChatGoogleGenerativeAI can call withStructuredOutput genai tools and invok googleGenAITool.functionDeclarations[0].parameters ); const res = await modelWithTools.invoke([prompt]); - console.log(res); expect(typeof res.url === "string").toBe(true); }); @@ -492,7 +474,6 @@ test("Stream token count usage_metadata", async () => { res = res.concat(chunk); } } - console.log(res); expect(res?.usage_metadata).toBeDefined(); if (!res?.usage_metadata) { return; @@ -519,7 +500,6 @@ test("streamUsage excludes token usage", async () => { res = res.concat(chunk); } } - console.log(res); expect(res?.usage_metadata).not.toBeDefined(); }); @@ -529,7 +509,6 @@ test("Invoke token count usage_metadata", async () => { maxOutputTokens: 10, }); const res = await model.invoke("Why is the sky blue? Be concise."); - console.log(res); expect(res?.usage_metadata).toBeDefined(); if (!res?.usage_metadata) { return; diff --git a/libs/langchain-standard-tests/src/integration_tests/chat_models.ts b/libs/langchain-standard-tests/src/integration_tests/chat_models.ts index ae28dc477bc0..f3151ed32b59 100644 --- a/libs/langchain-standard-tests/src/integration_tests/chat_models.ts +++ b/libs/langchain-standard-tests/src/integration_tests/chat_models.ts @@ -432,8 +432,9 @@ export abstract class ChatModelIntegrationTests< ).invoke({ toolName: "math_addition", }); - expect(result.tool_calls).toHaveLength(1); - if (!result.tool_calls) { + + expect(result.tool_calls?.[0]).toBeDefined(); + if (!result.tool_calls?.[0]) { throw new Error("result.tool_calls is undefined"); } const { tool_calls } = result; @@ -468,8 +469,9 @@ export abstract class ChatModelIntegrationTests< ).invoke({ toolName: "math_addition", }); - expect(result.tool_calls).toHaveLength(1); - if (!result.tool_calls) { + + expect(result.tool_calls?.[0]).toBeDefined(); + if (!result.tool_calls?.[0]) { throw new Error("result.tool_calls is undefined"); } const { tool_calls } = result; From 4d2b5b7a543cce56ca08ea486b7aec4eb7f9b254 Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Tue, 23 Jul 2024 15:10:37 -0700 Subject: [PATCH 02/10] core[minor]: Add FakeVectorStore to core testing utils (#6186) * core[minor]: Add FakeVectorStore to core testing utils * chore: lint files --- langchain-core/src/utils/testing/index.ts | 196 +++++++++++++++++++++- 1 file changed, 195 insertions(+), 1 deletion(-) diff --git a/langchain-core/src/utils/testing/index.ts b/langchain-core/src/utils/testing/index.ts index 6591b67f26c9..73e79f892fc1 100644 --- a/langchain-core/src/utils/testing/index.ts +++ b/langchain-core/src/utils/testing/index.ts @@ -2,6 +2,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-unused-vars */ +import { similarity as ml_distance_similarity } from "ml-distance"; import { z } from "zod"; import { BaseCallbackConfig, @@ -34,12 +35,17 @@ import { BaseRetriever } from "../../retrievers/index.js"; import { Runnable, RunnableLambda } from "../../runnables/base.js"; import { StructuredTool, ToolParams } from "../../tools/index.js"; import { BaseTracer, Run } from "../../tracers/base.js"; -import { Embeddings, EmbeddingsParams } from "../../embeddings.js"; +import { + Embeddings, + EmbeddingsInterface, + EmbeddingsParams, +} from "../../embeddings.js"; import { StructuredOutputMethodParams, BaseLanguageModelInput, StructuredOutputMethodOptions, } from "../../language_models/base.js"; +import { VectorStore } from "../../vectorstores.js"; /** * Parser for comma-separated values. It splits the input text by commas @@ -709,3 +715,191 @@ export class SingleRunExtractor extends BaseTracer { return this.runPromise; } } + +/** + * Interface representing a vector in memory. It includes the content + * (text), the corresponding embedding (vector), and any associated + * metadata. + */ +interface MemoryVector { + content: string; + embedding: number[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + metadata: Record; +} + +/** + * Interface for the arguments that can be passed to the + * `FakeVectorStore` constructor. It includes an optional `similarity` + * function. + */ +export interface FakeVectorStoreArgs { + similarity?: typeof ml_distance_similarity.cosine; +} + +/** + * Class that extends `VectorStore` to store vectors in memory. Provides + * methods for adding documents, performing similarity searches, and + * creating instances from texts, documents, or an existing index. + */ +export class FakeVectorStore extends VectorStore { + declare FilterType: (doc: Document) => boolean; + + memoryVectors: MemoryVector[] = []; + + similarity: typeof ml_distance_similarity.cosine; + + _vectorstoreType(): string { + return "memory"; + } + + constructor( + embeddings: EmbeddingsInterface, + { similarity, ...rest }: FakeVectorStoreArgs = {} + ) { + super(embeddings, rest); + + this.similarity = similarity ?? ml_distance_similarity.cosine; + } + + /** + * Method to add documents to the memory vector store. It extracts the + * text from each document, generates embeddings for them, and adds the + * resulting vectors to the store. + * @param documents Array of `Document` instances to be added to the store. + * @returns Promise that resolves when all documents have been added. + */ + async addDocuments(documents: Document[]): Promise { + const texts = documents.map(({ pageContent }) => pageContent); + return this.addVectors( + await this.embeddings.embedDocuments(texts), + documents + ); + } + + /** + * Method to add vectors to the memory vector store. It creates + * `MemoryVector` instances for each vector and document pair and adds + * them to the store. + * @param vectors Array of vectors to be added to the store. + * @param documents Array of `Document` instances corresponding to the vectors. + * @returns Promise that resolves when all vectors have been added. + */ + async addVectors(vectors: number[][], documents: Document[]): Promise { + const memoryVectors = vectors.map((embedding, idx) => ({ + content: documents[idx].pageContent, + embedding, + metadata: documents[idx].metadata, + })); + + this.memoryVectors = this.memoryVectors.concat(memoryVectors); + } + + /** + * Method to perform a similarity search in the memory vector store. It + * calculates the similarity between the query vector and each vector in + * the store, sorts the results by similarity, and returns the top `k` + * results along with their scores. + * @param query Query vector to compare against the vectors in the store. + * @param k Number of top results to return. + * @param filter Optional filter function to apply to the vectors before performing the search. + * @returns Promise that resolves with an array of tuples, each containing a `Document` and its similarity score. + */ + async similaritySearchVectorWithScore( + query: number[], + k: number, + filter?: this["FilterType"] + ): Promise<[Document, number][]> { + const filterFunction = (memoryVector: MemoryVector) => { + if (!filter) { + return true; + } + + const doc = new Document({ + metadata: memoryVector.metadata, + pageContent: memoryVector.content, + }); + return filter(doc); + }; + const filteredMemoryVectors = this.memoryVectors.filter(filterFunction); + const searches = filteredMemoryVectors + .map((vector, index) => ({ + similarity: this.similarity(query, vector.embedding), + index, + })) + .sort((a, b) => (a.similarity > b.similarity ? -1 : 0)) + .slice(0, k); + + const result: [Document, number][] = searches.map((search) => [ + new Document({ + metadata: filteredMemoryVectors[search.index].metadata, + pageContent: filteredMemoryVectors[search.index].content, + }), + search.similarity, + ]); + + return result; + } + + /** + * Static method to create a `FakeVectorStore` instance from an array of + * texts. It creates a `Document` for each text and metadata pair, and + * adds them to the store. + * @param texts Array of texts to be added to the store. + * @param metadatas Array or single object of metadata corresponding to the texts. + * @param embeddings `Embeddings` instance used to generate embeddings for the texts. + * @param dbConfig Optional `FakeVectorStoreArgs` to configure the `FakeVectorStore` instance. + * @returns Promise that resolves with a new `FakeVectorStore` instance. + */ + static async fromTexts( + texts: string[], + metadatas: object[] | object, + embeddings: EmbeddingsInterface, + dbConfig?: FakeVectorStoreArgs + ): Promise { + const docs: Document[] = []; + for (let i = 0; i < texts.length; i += 1) { + const metadata = Array.isArray(metadatas) ? metadatas[i] : metadatas; + const newDoc = new Document({ + pageContent: texts[i], + metadata, + }); + docs.push(newDoc); + } + return FakeVectorStore.fromDocuments(docs, embeddings, dbConfig); + } + + /** + * Static method to create a `FakeVectorStore` instance from an array of + * `Document` instances. It adds the documents to the store. + * @param docs Array of `Document` instances to be added to the store. + * @param embeddings `Embeddings` instance used to generate embeddings for the documents. + * @param dbConfig Optional `FakeVectorStoreArgs` to configure the `FakeVectorStore` instance. + * @returns Promise that resolves with a new `FakeVectorStore` instance. + */ + static async fromDocuments( + docs: Document[], + embeddings: EmbeddingsInterface, + dbConfig?: FakeVectorStoreArgs + ): Promise { + const instance = new this(embeddings, dbConfig); + await instance.addDocuments(docs); + return instance; + } + + /** + * Static method to create a `FakeVectorStore` instance from an existing + * index. It creates a new `FakeVectorStore` instance without adding any + * documents or vectors. + * @param embeddings `Embeddings` instance used to generate embeddings for the documents. + * @param dbConfig Optional `FakeVectorStoreArgs` to configure the `FakeVectorStore` instance. + * @returns Promise that resolves with a new `FakeVectorStore` instance. + */ + static async fromExistingIndex( + embeddings: EmbeddingsInterface, + dbConfig?: FakeVectorStoreArgs + ): Promise { + const instance = new this(embeddings, dbConfig); + return instance; + } +} From a8e74c1d1def9ca170518851f23e770bae98f9fc Mon Sep 17 00:00:00 2001 From: Bagatur <22008038+baskaryan@users.noreply.github.com> Date: Tue, 23 Jul 2024 16:04:50 -0700 Subject: [PATCH 03/10] docs: Update ChatModelTabs defaults (#6187) --- docs/core_docs/src/theme/ChatModelTabs.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/core_docs/src/theme/ChatModelTabs.js b/docs/core_docs/src/theme/ChatModelTabs.js index d09a6de082a9..5f57b3153649 100644 --- a/docs/core_docs/src/theme/ChatModelTabs.js +++ b/docs/core_docs/src/theme/ChatModelTabs.js @@ -25,12 +25,12 @@ function InstallationInfo({ children }) { } const DEFAULTS = { - openaiParams: `{\n model: "gpt-3.5-turbo",\n temperature: 0\n}`, + openaiParams: `{\n model: "gpt-4o-mini",\n temperature: 0\n}`, anthropicParams: `{\n model: "claude-3-5-sonnet-20240620",\n temperature: 0\n}`, - fireworksParams: `{\n model: "accounts/fireworks/models/firefunction-v1",\n temperature: 0\n}`, + fireworksParams: `{\n model: "accounts/fireworks/models/llama-v3p1-70b-instruct",\n temperature: 0\n}`, mistralParams: `{\n model: "mistral-large-latest",\n temperature: 0\n}`, groqParams: `{\n model: "mixtral-8x7b-32768",\n temperature: 0\n}`, - vertexParams: `{\n model: "gemini-1.5-pro",\n temperature: 0\n}`, + vertexParams: `{\n model: "gemini-1.5-flash",\n temperature: 0\n}`, }; const MODELS_WSO = ["openai", "anthropic", "mistral", "groq", "vertex"]; From cc76721d86510da79344a074f17a9c64d78c9482 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Thu, 25 Jul 2024 00:12:19 +0800 Subject: [PATCH 04/10] fix typo of tutorials (#6191) --- docs/core_docs/docs/tutorials/llm_chain.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core_docs/docs/tutorials/llm_chain.ipynb b/docs/core_docs/docs/tutorials/llm_chain.ipynb index d5a83e50d681..59791535b5e8 100644 --- a/docs/core_docs/docs/tutorials/llm_chain.ipynb +++ b/docs/core_docs/docs/tutorials/llm_chain.ipynb @@ -76,7 +76,7 @@ "```{=mdx}\n", "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", "\n", - "\n", + "\n", "```" ] }, From 02314656bb20761df89b8ceaa096175e25ed434e Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Wed, 24 Jul 2024 10:34:09 -0700 Subject: [PATCH 05/10] core[patch]: Use console.warn for swallowed errors in a callback handler (#6192) * Use console.warn for swallowed errors in a callback handler * Fix typo --- langchain-core/src/callbacks/manager.ts | 93 +++++++++++++++---- .../src/callbacks/tests/callbacks.test.ts | 18 ++++ 2 files changed, 92 insertions(+), 19 deletions(-) diff --git a/langchain-core/src/callbacks/manager.ts b/langchain-core/src/callbacks/manager.ts index 6e784c0f90f0..9a6cbe9405cf 100644 --- a/langchain-core/src/callbacks/manager.ts +++ b/langchain-core/src/callbacks/manager.ts @@ -140,7 +140,10 @@ export class BaseRunManager { this.tags ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleText: ${err}` ); if (handler.raiseError) { @@ -185,7 +188,10 @@ export class CallbackManagerForRetrieverRun this.tags ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleRetriever` ); if (handler.raiseError) { @@ -211,7 +217,10 @@ export class CallbackManagerForRetrieverRun this.tags ); } catch (error) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleRetrieverError: ${error}` ); if (handler.raiseError) { @@ -251,7 +260,10 @@ export class CallbackManagerForLLMRun fields ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleLLMNewToken: ${err}` ); if (handler.raiseError) { @@ -277,7 +289,10 @@ export class CallbackManagerForLLMRun this.tags ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleLLMError: ${err}` ); if (handler.raiseError) { @@ -303,7 +318,10 @@ export class CallbackManagerForLLMRun this.tags ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleLLMEnd: ${err}` ); if (handler.raiseError) { @@ -353,7 +371,10 @@ export class CallbackManagerForChainRun kwargs ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleChainError: ${err}` ); if (handler.raiseError) { @@ -386,7 +407,10 @@ export class CallbackManagerForChainRun kwargs ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleChainEnd: ${err}` ); if (handler.raiseError) { @@ -412,7 +436,10 @@ export class CallbackManagerForChainRun this.tags ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleAgentAction: ${err}` ); if (handler.raiseError) { @@ -438,7 +465,10 @@ export class CallbackManagerForChainRun this.tags ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleAgentEnd: ${err}` ); if (handler.raiseError) { @@ -481,7 +511,10 @@ export class CallbackManagerForToolRun this.tags ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleToolError: ${err}` ); if (handler.raiseError) { @@ -508,7 +541,10 @@ export class CallbackManagerForToolRun this.tags ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleToolEnd: ${err}` ); if (handler.raiseError) { @@ -640,7 +676,10 @@ export class CallbackManager runName ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleLLMStart: ${err}` ); if (handler.raiseError) { @@ -727,7 +766,10 @@ export class CallbackManager ); } } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleLLMStart: ${err}` ); if (handler.raiseError) { @@ -794,7 +836,10 @@ export class CallbackManager runName ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleChainStart: ${err}` ); if (handler.raiseError) { @@ -856,7 +901,10 @@ export class CallbackManager runName ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleToolStart: ${err}` ); if (handler.raiseError) { @@ -918,7 +966,10 @@ export class CallbackManager runName ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleRetrieverStart: ${err}` ); if (handler.raiseError) { @@ -963,7 +1014,10 @@ export class CallbackManager this.metadata ); } catch (err) { - console.error( + const logFunction = handler.raiseError + ? console.error + : console.warn; + logFunction( `Error in handler ${handler.constructor.name}, handleCustomEvent: ${err}` ); if (handler.raiseError) { @@ -1217,7 +1271,8 @@ export function ensureHandler( * ]; * * // Run the example - * processQuestions(questions).catch(console.error); +const logFunction = handler.raiseError ? console.error : console.warn; +* processQuestions(questions).catch(consolelogFunction; * * ``` */ diff --git a/langchain-core/src/callbacks/tests/callbacks.test.ts b/langchain-core/src/callbacks/tests/callbacks.test.ts index 58644caa40e1..37e9e5d84410 100644 --- a/langchain-core/src/callbacks/tests/callbacks.test.ts +++ b/langchain-core/src/callbacks/tests/callbacks.test.ts @@ -9,6 +9,7 @@ import type { ChainValues } from "../../utils/types/index.js"; import type { AgentAction, AgentFinish } from "../../agents.js"; import { BaseMessage, HumanMessage } from "../../messages/index.js"; import type { LLMResult } from "../../outputs.js"; +import { RunnableLambda } from "../../runnables/base.js"; class FakeCallbackHandler extends BaseCallbackHandler { name = `fake-${uuid.v4()}`; @@ -518,3 +519,20 @@ test("error handling in llm start", async () => { await manager.handleLLMStart(serialized, ["test"]); }).rejects.toThrowError(); }); + +test("chain should still run if a normal callback handler throws an error", async () => { + const chain = RunnableLambda.from(async () => "hello world"); + const res = await chain.invoke( + {}, + { + callbacks: [ + { + handleChainStart: () => { + throw new Error("Bad"); + }, + }, + ], + } + ); + expect(res).toEqual("hello world"); +}); From de0becdc65db748d4fb4e0998d2ac4515e8d8023 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Wed, 24 Jul 2024 10:34:54 -0700 Subject: [PATCH 06/10] Make legacy OpenAI path respect a passed model (#6193) --- libs/langchain-openai/src/legacy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain-openai/src/legacy.ts b/libs/langchain-openai/src/legacy.ts index 16e0452af2e2..f9c18f0f8cfb 100644 --- a/libs/langchain-openai/src/legacy.ts +++ b/libs/langchain-openai/src/legacy.ts @@ -191,7 +191,7 @@ export class OpenAIChat fields?.configuration?.organization ?? getEnvironmentVariable("OPENAI_ORGANIZATION"); - this.modelName = fields?.modelName ?? this.modelName; + this.modelName = fields?.model ?? fields?.modelName ?? this.modelName; this.prefixMessages = fields?.prefixMessages ?? this.prefixMessages; this.modelKwargs = fields?.modelKwargs ?? {}; this.timeout = fields?.timeout; From 29c08a3cca4a71bfaf8876d82bc71fd6e45fd026 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Wed, 24 Jul 2024 10:59:30 -0700 Subject: [PATCH 07/10] docs[patch]: Fix broken link (#6194) @bracesproul let's try not to prefix API refs --- docs/core_docs/docs/how_to/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core_docs/docs/how_to/index.mdx b/docs/core_docs/docs/how_to/index.mdx index 88e4a79e4e86..c728d251b54c 100644 --- a/docs/core_docs/docs/how_to/index.mdx +++ b/docs/core_docs/docs/how_to/index.mdx @@ -9,7 +9,7 @@ Here you'll find answers to “How do I….?” types of questions. These guides are _goal-oriented_ and _concrete_; they're meant to help you complete a specific task. For conceptual explanations see [Conceptual Guides](/docs/concepts/). For end-to-end walkthroughs see [Tutorials](/docs/tutorials). -For comprehensive descriptions of every class and function see [API Reference](https://v2.v02.api.js.langchain.com/). +For comprehensive descriptions of every class and function see [API Reference](https://api.js.langchain.com/). ## Installation From 63305a0c0edd67f3452af8befcf7ac87459ed6f4 Mon Sep 17 00:00:00 2001 From: Jorge Lanzarotti <94814971+jl4nz@users.noreply.github.com> Date: Thu, 25 Jul 2024 04:57:20 +0900 Subject: [PATCH 08/10] Update for AWS Bedrock knowledge bases to support filters and overrideSearchType, Update the KB to support other locations as sources (#6189) Co-authored-by: Brace Sproul --- libs/langchain-aws/package.json | 6 +- libs/langchain-aws/src/retrievers/bedrock.ts | 68 +- .../src/retrievers/tests/bedrock.int.test.ts | 2 + yarn.lock | 871 +++++++++++++++++- 4 files changed, 931 insertions(+), 16 deletions(-) diff --git a/libs/langchain-aws/package.json b/libs/langchain-aws/package.json index 14a206c3fa4b..5bfac18e5270 100644 --- a/libs/langchain-aws/package.json +++ b/libs/langchain-aws/package.json @@ -39,7 +39,7 @@ "author": "LangChain", "license": "MIT", "dependencies": { - "@aws-sdk/client-bedrock-agent-runtime": "^3.583.0", + "@aws-sdk/client-bedrock-agent-runtime": "^3.616.0", "@aws-sdk/client-bedrock-runtime": "^3.602.0", "@aws-sdk/client-kendra": "^3.352.0", "@aws-sdk/credential-provider-node": "^3.600.0", @@ -47,7 +47,7 @@ "zod-to-json-schema": "^3.22.5" }, "devDependencies": { - "@aws-sdk/types": "^3.598.0", + "@aws-sdk/types": "^3.609.0", "@jest/globals": "^29.5.0", "@langchain/scripts": "~0.0.14", "@langchain/standard-tests": "0.0.0", @@ -97,4 +97,4 @@ "index.d.ts", "index.d.cts" ] -} +} \ No newline at end of file diff --git a/libs/langchain-aws/src/retrievers/bedrock.ts b/libs/langchain-aws/src/retrievers/bedrock.ts index 65748566de12..a67528b0d5e5 100644 --- a/libs/langchain-aws/src/retrievers/bedrock.ts +++ b/libs/langchain-aws/src/retrievers/bedrock.ts @@ -2,6 +2,8 @@ import { RetrieveCommand, BedrockAgentRuntimeClient, type BedrockAgentRuntimeClientConfig, + type SearchType, + type RetrievalFilter, } from "@aws-sdk/client-bedrock-agent-runtime"; import { BaseRetriever } from "@langchain/core/retrievers"; @@ -16,6 +18,8 @@ export interface AmazonKnowledgeBaseRetrieverArgs { topK: number; region: string; clientOptions?: BedrockAgentRuntimeClientConfig; + filter?: RetrievalFilter; + overrideSearchType?: SearchType; } /** @@ -51,15 +55,23 @@ export class AmazonKnowledgeBaseRetriever extends BaseRetriever { bedrockAgentRuntimeClient: BedrockAgentRuntimeClient; + filter?: RetrievalFilter; + + overrideSearchType?: SearchType; + constructor({ knowledgeBaseId, topK = 10, clientOptions, region, + filter, + overrideSearchType, }: AmazonKnowledgeBaseRetrieverArgs) { super(); this.topK = topK; + this.filter = filter; + this.overrideSearchType = overrideSearchType; this.bedrockAgentRuntimeClient = new BedrockAgentRuntimeClient({ region, ...clientOptions, @@ -78,7 +90,12 @@ export class AmazonKnowledgeBaseRetriever extends BaseRetriever { return res; } - async queryKnowledgeBase(query: string, topK: number) { + async queryKnowledgeBase( + query: string, + topK: number, + filter?: RetrievalFilter, + overrideSearchType?: SearchType + ) { const retrieveCommand = new RetrieveCommand({ knowledgeBaseId: this.knowledgeBaseId, retrievalQuery: { @@ -87,6 +104,8 @@ export class AmazonKnowledgeBaseRetriever extends BaseRetriever { retrievalConfiguration: { vectorSearchConfiguration: { numberOfResults: topK, + overrideSearchType, + filter, }, }, }); @@ -96,19 +115,48 @@ export class AmazonKnowledgeBaseRetriever extends BaseRetriever { ); return ( - retrieveResponse.retrievalResults?.map((result) => ({ - pageContent: this.cleanResult(result.content?.text || ""), - metadata: { - source: result.location?.s3Location?.uri, - score: result.score, - ...result.metadata, - }, - })) ?? ([] as Array) + retrieveResponse.retrievalResults?.map((result) => { + let source; + switch (result.location?.type) { + case "CONFLUENCE": + source = result.location?.confluenceLocation?.url; + break; + case "S3": + source = result.location?.s3Location?.uri; + break; + case "SALESFORCE": + source = result.location?.salesforceLocation?.url; + break; + case "SHAREPOINT": + source = result.location?.sharePointLocation?.url; + break; + case "WEB": + source = result.location?.webLocation?.url; + break; + default: + source = result.location?.s3Location?.uri; + break; + } + + return { + pageContent: this.cleanResult(result.content?.text || ""), + metadata: { + source, + score: result.score, + ...result.metadata, + }, + }; + }) ?? ([] as Array) ); } async _getRelevantDocuments(query: string): Promise { - const docs = await this.queryKnowledgeBase(query, this.topK); + const docs = await this.queryKnowledgeBase( + query, + this.topK, + this.filter, + this.overrideSearchType + ); return docs; } } diff --git a/libs/langchain-aws/src/retrievers/tests/bedrock.int.test.ts b/libs/langchain-aws/src/retrievers/tests/bedrock.int.test.ts index 69b536f7e3fc..b44b91eea60d 100644 --- a/libs/langchain-aws/src/retrievers/tests/bedrock.int.test.ts +++ b/libs/langchain-aws/src/retrievers/tests/bedrock.int.test.ts @@ -16,6 +16,8 @@ test("AmazonKnowledgeBaseRetriever", async () => { topK: 10, knowledgeBaseId: process.env.AMAZON_KNOWLEDGE_BASE_ID || "", region: process.env.BEDROCK_AWS_REGION, + overrideSearchType: "HYBRID", + filter: undefined, clientOptions: { credentials: { accessKeyId: process.env.BEDROCK_AWS_ACCESS_KEY_ID, diff --git a/yarn.lock b/yarn.lock index 3c34ea815cab..a0ba67609156 100644 --- a/yarn.lock +++ b/yarn.lock @@ -515,6 +515,58 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/client-bedrock-agent-runtime@npm:^3.616.0": + version: 3.616.0 + resolution: "@aws-sdk/client-bedrock-agent-runtime@npm:3.616.0" + dependencies: + "@aws-crypto/sha256-browser": 5.2.0 + "@aws-crypto/sha256-js": 5.2.0 + "@aws-sdk/client-sso-oidc": 3.616.0 + "@aws-sdk/client-sts": 3.616.0 + "@aws-sdk/core": 3.616.0 + "@aws-sdk/credential-provider-node": 3.616.0 + "@aws-sdk/middleware-host-header": 3.616.0 + "@aws-sdk/middleware-logger": 3.609.0 + "@aws-sdk/middleware-recursion-detection": 3.616.0 + "@aws-sdk/middleware-user-agent": 3.616.0 + "@aws-sdk/region-config-resolver": 3.614.0 + "@aws-sdk/types": 3.609.0 + "@aws-sdk/util-endpoints": 3.614.0 + "@aws-sdk/util-user-agent-browser": 3.609.0 + "@aws-sdk/util-user-agent-node": 3.614.0 + "@smithy/config-resolver": ^3.0.5 + "@smithy/core": ^2.2.7 + "@smithy/eventstream-serde-browser": ^3.0.4 + "@smithy/eventstream-serde-config-resolver": ^3.0.3 + "@smithy/eventstream-serde-node": ^3.0.4 + "@smithy/fetch-http-handler": ^3.2.2 + "@smithy/hash-node": ^3.0.3 + "@smithy/invalid-dependency": ^3.0.3 + "@smithy/middleware-content-length": ^3.0.4 + "@smithy/middleware-endpoint": ^3.0.5 + "@smithy/middleware-retry": ^3.0.10 + "@smithy/middleware-serde": ^3.0.3 + "@smithy/middleware-stack": ^3.0.3 + "@smithy/node-config-provider": ^3.1.4 + "@smithy/node-http-handler": ^3.1.3 + "@smithy/protocol-http": ^4.0.4 + "@smithy/smithy-client": ^3.1.8 + "@smithy/types": ^3.3.0 + "@smithy/url-parser": ^3.0.3 + "@smithy/util-base64": ^3.0.0 + "@smithy/util-body-length-browser": ^3.0.0 + "@smithy/util-body-length-node": ^3.0.0 + "@smithy/util-defaults-mode-browser": ^3.0.10 + "@smithy/util-defaults-mode-node": ^3.0.10 + "@smithy/util-endpoints": ^2.0.5 + "@smithy/util-middleware": ^3.0.3 + "@smithy/util-retry": ^3.0.3 + "@smithy/util-utf8": ^3.0.0 + tslib: ^2.6.2 + checksum: d25373b0ef8b8df63f2bc935bf9d2aefa9a17d68fedd70bca21122add6ea21c3a914916cf8ad69b6a0f73a6ca43d98e9c56843aea69ea76f0cefff63aaeb24bc + languageName: node + linkType: hard + "@aws-sdk/client-bedrock-runtime@npm:^3.422.0": version: 3.490.0 resolution: "@aws-sdk/client-bedrock-runtime@npm:3.490.0" @@ -1319,6 +1371,55 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/client-sso-oidc@npm:3.616.0": + version: 3.616.0 + resolution: "@aws-sdk/client-sso-oidc@npm:3.616.0" + dependencies: + "@aws-crypto/sha256-browser": 5.2.0 + "@aws-crypto/sha256-js": 5.2.0 + "@aws-sdk/core": 3.616.0 + "@aws-sdk/credential-provider-node": 3.616.0 + "@aws-sdk/middleware-host-header": 3.616.0 + "@aws-sdk/middleware-logger": 3.609.0 + "@aws-sdk/middleware-recursion-detection": 3.616.0 + "@aws-sdk/middleware-user-agent": 3.616.0 + "@aws-sdk/region-config-resolver": 3.614.0 + "@aws-sdk/types": 3.609.0 + "@aws-sdk/util-endpoints": 3.614.0 + "@aws-sdk/util-user-agent-browser": 3.609.0 + "@aws-sdk/util-user-agent-node": 3.614.0 + "@smithy/config-resolver": ^3.0.5 + "@smithy/core": ^2.2.7 + "@smithy/fetch-http-handler": ^3.2.2 + "@smithy/hash-node": ^3.0.3 + "@smithy/invalid-dependency": ^3.0.3 + "@smithy/middleware-content-length": ^3.0.4 + "@smithy/middleware-endpoint": ^3.0.5 + "@smithy/middleware-retry": ^3.0.10 + "@smithy/middleware-serde": ^3.0.3 + "@smithy/middleware-stack": ^3.0.3 + "@smithy/node-config-provider": ^3.1.4 + "@smithy/node-http-handler": ^3.1.3 + "@smithy/protocol-http": ^4.0.4 + "@smithy/smithy-client": ^3.1.8 + "@smithy/types": ^3.3.0 + "@smithy/url-parser": ^3.0.3 + "@smithy/util-base64": ^3.0.0 + "@smithy/util-body-length-browser": ^3.0.0 + "@smithy/util-body-length-node": ^3.0.0 + "@smithy/util-defaults-mode-browser": ^3.0.10 + "@smithy/util-defaults-mode-node": ^3.0.10 + "@smithy/util-endpoints": ^2.0.5 + "@smithy/util-middleware": ^3.0.3 + "@smithy/util-retry": ^3.0.3 + "@smithy/util-utf8": ^3.0.0 + tslib: ^2.6.2 + peerDependencies: + "@aws-sdk/client-sts": ^3.616.0 + checksum: cc6fab0e7369b0dbb7d03dbfcdc4e1dedd9bf395ed468c0c22b0c141ab35fc286d27f54a075584395dd5ca8a134682e9aa119e95b52694fb061aa8c389d6fc42 + languageName: node + linkType: hard + "@aws-sdk/client-sso@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/client-sso@npm:3.310.0" @@ -1747,6 +1848,52 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/client-sso@npm:3.616.0": + version: 3.616.0 + resolution: "@aws-sdk/client-sso@npm:3.616.0" + dependencies: + "@aws-crypto/sha256-browser": 5.2.0 + "@aws-crypto/sha256-js": 5.2.0 + "@aws-sdk/core": 3.616.0 + "@aws-sdk/middleware-host-header": 3.616.0 + "@aws-sdk/middleware-logger": 3.609.0 + "@aws-sdk/middleware-recursion-detection": 3.616.0 + "@aws-sdk/middleware-user-agent": 3.616.0 + "@aws-sdk/region-config-resolver": 3.614.0 + "@aws-sdk/types": 3.609.0 + "@aws-sdk/util-endpoints": 3.614.0 + "@aws-sdk/util-user-agent-browser": 3.609.0 + "@aws-sdk/util-user-agent-node": 3.614.0 + "@smithy/config-resolver": ^3.0.5 + "@smithy/core": ^2.2.7 + "@smithy/fetch-http-handler": ^3.2.2 + "@smithy/hash-node": ^3.0.3 + "@smithy/invalid-dependency": ^3.0.3 + "@smithy/middleware-content-length": ^3.0.4 + "@smithy/middleware-endpoint": ^3.0.5 + "@smithy/middleware-retry": ^3.0.10 + "@smithy/middleware-serde": ^3.0.3 + "@smithy/middleware-stack": ^3.0.3 + "@smithy/node-config-provider": ^3.1.4 + "@smithy/node-http-handler": ^3.1.3 + "@smithy/protocol-http": ^4.0.4 + "@smithy/smithy-client": ^3.1.8 + "@smithy/types": ^3.3.0 + "@smithy/url-parser": ^3.0.3 + "@smithy/util-base64": ^3.0.0 + "@smithy/util-body-length-browser": ^3.0.0 + "@smithy/util-body-length-node": ^3.0.0 + "@smithy/util-defaults-mode-browser": ^3.0.10 + "@smithy/util-defaults-mode-node": ^3.0.10 + "@smithy/util-endpoints": ^2.0.5 + "@smithy/util-middleware": ^3.0.3 + "@smithy/util-retry": ^3.0.3 + "@smithy/util-utf8": ^3.0.0 + tslib: ^2.6.2 + checksum: 0a0d5560a84b381caad36264cc3760a0aa2c1dfa980429dc55c582447e7e7242f0947963815f7b91c0b92fc4b3b95507fd37cf9eb155b5409a6f9303f6efaed7 + languageName: node + linkType: hard + "@aws-sdk/client-sts@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/client-sts@npm:3.310.0" @@ -2163,6 +2310,54 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/client-sts@npm:3.616.0": + version: 3.616.0 + resolution: "@aws-sdk/client-sts@npm:3.616.0" + dependencies: + "@aws-crypto/sha256-browser": 5.2.0 + "@aws-crypto/sha256-js": 5.2.0 + "@aws-sdk/client-sso-oidc": 3.616.0 + "@aws-sdk/core": 3.616.0 + "@aws-sdk/credential-provider-node": 3.616.0 + "@aws-sdk/middleware-host-header": 3.616.0 + "@aws-sdk/middleware-logger": 3.609.0 + "@aws-sdk/middleware-recursion-detection": 3.616.0 + "@aws-sdk/middleware-user-agent": 3.616.0 + "@aws-sdk/region-config-resolver": 3.614.0 + "@aws-sdk/types": 3.609.0 + "@aws-sdk/util-endpoints": 3.614.0 + "@aws-sdk/util-user-agent-browser": 3.609.0 + "@aws-sdk/util-user-agent-node": 3.614.0 + "@smithy/config-resolver": ^3.0.5 + "@smithy/core": ^2.2.7 + "@smithy/fetch-http-handler": ^3.2.2 + "@smithy/hash-node": ^3.0.3 + "@smithy/invalid-dependency": ^3.0.3 + "@smithy/middleware-content-length": ^3.0.4 + "@smithy/middleware-endpoint": ^3.0.5 + "@smithy/middleware-retry": ^3.0.10 + "@smithy/middleware-serde": ^3.0.3 + "@smithy/middleware-stack": ^3.0.3 + "@smithy/node-config-provider": ^3.1.4 + "@smithy/node-http-handler": ^3.1.3 + "@smithy/protocol-http": ^4.0.4 + "@smithy/smithy-client": ^3.1.8 + "@smithy/types": ^3.3.0 + "@smithy/url-parser": ^3.0.3 + "@smithy/util-base64": ^3.0.0 + "@smithy/util-body-length-browser": ^3.0.0 + "@smithy/util-body-length-node": ^3.0.0 + "@smithy/util-defaults-mode-browser": ^3.0.10 + "@smithy/util-defaults-mode-node": ^3.0.10 + "@smithy/util-endpoints": ^2.0.5 + "@smithy/util-middleware": ^3.0.3 + "@smithy/util-retry": ^3.0.3 + "@smithy/util-utf8": ^3.0.0 + tslib: ^2.6.2 + checksum: bad2619661085259ccfa2cd95f721ed1dc479c6871a8927648d182c6fbe3d25989a904d6b9430eac762c1d2a25d370a89879b9d1f2375f2cbfa869949288643f + languageName: node + linkType: hard + "@aws-sdk/config-resolver@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/config-resolver@npm:3.310.0" @@ -2246,6 +2441,21 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/core@npm:3.616.0": + version: 3.616.0 + resolution: "@aws-sdk/core@npm:3.616.0" + dependencies: + "@smithy/core": ^2.2.7 + "@smithy/protocol-http": ^4.0.4 + "@smithy/signature-v4": ^4.0.0 + "@smithy/smithy-client": ^3.1.8 + "@smithy/types": ^3.3.0 + fast-xml-parser: 4.2.5 + tslib: ^2.6.2 + checksum: b19c43578beba8e90c1dac2a4842012e0ac2469fb0a8a72801677268447f5de2ad92ebcadc83826a7bfc360ef345c1686f2f76a04fc77f478e1c7512759789a9 + languageName: node + linkType: hard + "@aws-sdk/credential-provider-cognito-identity@npm:3.592.0": version: 3.592.0 resolution: "@aws-sdk/credential-provider-cognito-identity@npm:3.592.0" @@ -2353,6 +2563,18 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/credential-provider-env@npm:3.609.0": + version: 3.609.0 + resolution: "@aws-sdk/credential-provider-env@npm:3.609.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@smithy/property-provider": ^3.1.3 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: eda20122740481d04f5110fb9349df339562da1e1d5217e6c47e5f80ed0cce1b3bea01081272487bf04e402fcecc2734a352b0b57ae80b090dd8a0b3547ad185 + languageName: node + linkType: hard + "@aws-sdk/credential-provider-http@npm:3.582.0": version: 3.582.0 resolution: "@aws-sdk/credential-provider-http@npm:3.582.0" @@ -2404,6 +2626,23 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/credential-provider-http@npm:3.616.0": + version: 3.616.0 + resolution: "@aws-sdk/credential-provider-http@npm:3.616.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@smithy/fetch-http-handler": ^3.2.2 + "@smithy/node-http-handler": ^3.1.3 + "@smithy/property-provider": ^3.1.3 + "@smithy/protocol-http": ^4.0.4 + "@smithy/smithy-client": ^3.1.8 + "@smithy/types": ^3.3.0 + "@smithy/util-stream": ^3.1.0 + tslib: ^2.6.2 + checksum: a1afc3d78bc2496b57583a0d4e2ce080ba6f365c5b84aba39b070e51daee677256b32b8dcd93278c3c82a9c1288b2691c8f02624d23e819817fd55fa8377ddb4 + languageName: node + linkType: hard + "@aws-sdk/credential-provider-imds@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/credential-provider-imds@npm:3.310.0" @@ -2614,6 +2853,27 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/credential-provider-ini@npm:3.616.0": + version: 3.616.0 + resolution: "@aws-sdk/credential-provider-ini@npm:3.616.0" + dependencies: + "@aws-sdk/credential-provider-env": 3.609.0 + "@aws-sdk/credential-provider-http": 3.616.0 + "@aws-sdk/credential-provider-process": 3.614.0 + "@aws-sdk/credential-provider-sso": 3.616.0 + "@aws-sdk/credential-provider-web-identity": 3.609.0 + "@aws-sdk/types": 3.609.0 + "@smithy/credential-provider-imds": ^3.1.4 + "@smithy/property-provider": ^3.1.3 + "@smithy/shared-ini-file-loader": ^3.1.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + peerDependencies: + "@aws-sdk/client-sts": ^3.616.0 + checksum: 2de4455b8bc58ebed180954d04e4f3de35a390778156a99a5581b7ebbf9adf01df6166f3dc60129a465865f110d30352b740ee92591169a1cb56d11e5ea21d38 + languageName: node + linkType: hard + "@aws-sdk/credential-provider-node@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/credential-provider-node@npm:3.310.0" @@ -2784,6 +3044,26 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/credential-provider-node@npm:3.616.0": + version: 3.616.0 + resolution: "@aws-sdk/credential-provider-node@npm:3.616.0" + dependencies: + "@aws-sdk/credential-provider-env": 3.609.0 + "@aws-sdk/credential-provider-http": 3.616.0 + "@aws-sdk/credential-provider-ini": 3.616.0 + "@aws-sdk/credential-provider-process": 3.614.0 + "@aws-sdk/credential-provider-sso": 3.616.0 + "@aws-sdk/credential-provider-web-identity": 3.609.0 + "@aws-sdk/types": 3.609.0 + "@smithy/credential-provider-imds": ^3.1.4 + "@smithy/property-provider": ^3.1.3 + "@smithy/shared-ini-file-loader": ^3.1.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 9a66c9401eb152711a69010bfe9adc55fedd445d4d9754bd26490bf7b75c6606486dde9495893f893998ba74786ff4703ba94f0bdef92e2aa4c0d5baa605757a + languageName: node + linkType: hard + "@aws-sdk/credential-provider-node@npm:^3.388.0": version: 3.388.0 resolution: "@aws-sdk/credential-provider-node@npm:3.388.0" @@ -2905,6 +3185,19 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/credential-provider-process@npm:3.614.0": + version: 3.614.0 + resolution: "@aws-sdk/credential-provider-process@npm:3.614.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@smithy/property-provider": ^3.1.3 + "@smithy/shared-ini-file-loader": ^3.1.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 8bbbbf66911f38818e801187ae8df000e92b4e1c0dbe6d6b9afae81e08fb771302d2dc86c459653a2ed71acc10b9773885ae28d6fbce0031e082e9a6e61c85ee + languageName: node + linkType: hard + "@aws-sdk/credential-provider-sso@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/credential-provider-sso@npm:3.310.0" @@ -3051,6 +3344,21 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/credential-provider-sso@npm:3.616.0": + version: 3.616.0 + resolution: "@aws-sdk/credential-provider-sso@npm:3.616.0" + dependencies: + "@aws-sdk/client-sso": 3.616.0 + "@aws-sdk/token-providers": 3.614.0 + "@aws-sdk/types": 3.609.0 + "@smithy/property-provider": ^3.1.3 + "@smithy/shared-ini-file-loader": ^3.1.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 773fb35df0bb769964dd1da86e9a498620ba411b664e9ef968ba33d222dbc29849eb95a556f11bb23a3893141815db9be098cba3c99dd0148b34f116f5e1ef56 + languageName: node + linkType: hard + "@aws-sdk/credential-provider-web-identity@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/credential-provider-web-identity@npm:3.310.0" @@ -3151,6 +3459,20 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/credential-provider-web-identity@npm:3.609.0": + version: 3.609.0 + resolution: "@aws-sdk/credential-provider-web-identity@npm:3.609.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@smithy/property-provider": ^3.1.3 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + peerDependencies: + "@aws-sdk/client-sts": ^3.609.0 + checksum: 7a95a6c4792491122677fab6f01a9a46c8aa2f94d95255430bbd3fdcd514ab05ecf92c0ab169c8b30215b6b9181165f8d009774ba5a39cdd633162ef30879e56 + languageName: node + linkType: hard + "@aws-sdk/credential-providers@npm:^3.583.0": version: 3.592.0 resolution: "@aws-sdk/credential-providers@npm:3.592.0" @@ -3580,6 +3902,18 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/middleware-host-header@npm:3.616.0": + version: 3.616.0 + resolution: "@aws-sdk/middleware-host-header@npm:3.616.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@smithy/protocol-http": ^4.0.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 7936068785a58e35adf96b90d6e72d9defca2d1051992bfd7bf5bbc150d000942ff587151d27d40276942d430817bac9985ab68d926333dfb581983b6236a21c + languageName: node + linkType: hard + "@aws-sdk/middleware-location-constraint@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/middleware-location-constraint@npm:3.310.0" @@ -3675,6 +4009,17 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/middleware-logger@npm:3.609.0": + version: 3.609.0 + resolution: "@aws-sdk/middleware-logger@npm:3.609.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: b6f67a2e9ba082c8aec9d45905ae45ea5a95896f1beecb0c2d7fecfe17dd8fad99513f43b11ed7fd6ca9ff7764a0fc1ce63af91b1baed92b36f7b4b5390be5c6 + languageName: node + linkType: hard + "@aws-sdk/middleware-recursion-detection@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/middleware-recursion-detection@npm:3.310.0" @@ -3768,6 +4113,18 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/middleware-recursion-detection@npm:3.616.0": + version: 3.616.0 + resolution: "@aws-sdk/middleware-recursion-detection@npm:3.616.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@smithy/protocol-http": ^4.0.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 43bd173705125f07e44c0c0feb85af0edba1503fe629d9eacdcc446d45d038fca6148415a9f721d80a80a5dab390585ef122823f30bd8e06d723f523c6fc58c3 + languageName: node + linkType: hard + "@aws-sdk/middleware-retry@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/middleware-retry@npm:3.310.0" @@ -4138,6 +4495,19 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/middleware-user-agent@npm:3.616.0": + version: 3.616.0 + resolution: "@aws-sdk/middleware-user-agent@npm:3.616.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@aws-sdk/util-endpoints": 3.614.0 + "@smithy/protocol-http": ^4.0.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 6525d9061e0993f338c6dbb2c55e3e094aa02801d0814824cd4a0c0d9810e0f82fc7af4f6f2010723b18a856da241c3daded3fd9bc16b991cffef5f3031f0941 + languageName: node + linkType: hard + "@aws-sdk/node-config-provider@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/node-config-provider@npm:3.310.0" @@ -4375,6 +4745,20 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/region-config-resolver@npm:3.614.0": + version: 3.614.0 + resolution: "@aws-sdk/region-config-resolver@npm:3.614.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@smithy/node-config-provider": ^3.1.4 + "@smithy/types": ^3.3.0 + "@smithy/util-config-provider": ^3.0.0 + "@smithy/util-middleware": ^3.0.3 + tslib: ^2.6.2 + checksum: dbaca50792c99685845b21dd4a53228613e0458ee517a21db941890ee521d91eff80704f08e9ee71b6f04e70fb86362c4823750bb0b3727240af68d78d8fa4be + languageName: node + linkType: hard + "@aws-sdk/service-error-classification@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/service-error-classification@npm:3.310.0" @@ -4750,6 +5134,21 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/token-providers@npm:3.614.0": + version: 3.614.0 + resolution: "@aws-sdk/token-providers@npm:3.614.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@smithy/property-provider": ^3.1.3 + "@smithy/shared-ini-file-loader": ^3.1.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + peerDependencies: + "@aws-sdk/client-sso-oidc": ^3.614.0 + checksum: 2901b8428afc3b76ff1df9ac29a2698db6bf65d1d2afcd8424b9bf187313d2a3ca747c3b205afeb5c132068b5a5a94d84ce82710f775fa0cbb79499d7fea2d64 + languageName: node + linkType: hard + "@aws-sdk/types@npm:3.310.0, @aws-sdk/types@npm:^3.222.0": version: 3.310.0 resolution: "@aws-sdk/types@npm:3.310.0" @@ -4808,7 +5207,7 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/types@npm:3.598.0, @aws-sdk/types@npm:^3.598.0": +"@aws-sdk/types@npm:3.598.0": version: 3.598.0 resolution: "@aws-sdk/types@npm:3.598.0" dependencies: @@ -4818,6 +5217,16 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/types@npm:3.609.0, @aws-sdk/types@npm:^3.609.0": + version: 3.609.0 + resolution: "@aws-sdk/types@npm:3.609.0" + dependencies: + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 522768d08f104065b0ff6a37eddaa7803186014acee1c0011b3dbd3ef841e47ae694e58f608aeec8a39d22d644d759ade996fe51d18b880617778dc2dbbe1ede + languageName: node + linkType: hard + "@aws-sdk/types@npm:^3.357.0": version: 3.378.0 resolution: "@aws-sdk/types@npm:3.378.0" @@ -5109,6 +5518,18 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/util-endpoints@npm:3.614.0": + version: 3.614.0 + resolution: "@aws-sdk/util-endpoints@npm:3.614.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@smithy/types": ^3.3.0 + "@smithy/util-endpoints": ^2.0.5 + tslib: ^2.6.2 + checksum: 9d9973ceee59bf30af85c7f4328083daea033a987ec396dcb89eb7649f470ceb19c6b96635e121f3557e726f7ec7453236c956cf43f22128883c277f17d2a13f + languageName: node + linkType: hard + "@aws-sdk/util-hex-encoding@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/util-hex-encoding@npm:3.310.0" @@ -5334,6 +5755,18 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/util-user-agent-browser@npm:3.609.0": + version: 3.609.0 + resolution: "@aws-sdk/util-user-agent-browser@npm:3.609.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@smithy/types": ^3.3.0 + bowser: ^2.11.0 + tslib: ^2.6.2 + checksum: 75ba1ae74dd1001f47870766d92b66ac02a0a488efcf42c1a368962a7978a778d99536e880f07f7db1c2ca66cc9b1863fd3342957a22dcf78bf2f4398265a7a5 + languageName: node + linkType: hard + "@aws-sdk/util-user-agent-node@npm:3.310.0": version: 3.310.0 resolution: "@aws-sdk/util-user-agent-node@npm:3.310.0" @@ -5468,6 +5901,23 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/util-user-agent-node@npm:3.614.0": + version: 3.614.0 + resolution: "@aws-sdk/util-user-agent-node@npm:3.614.0" + dependencies: + "@aws-sdk/types": 3.609.0 + "@smithy/node-config-provider": ^3.1.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + peerDependencies: + aws-crt: ">=1.0.0" + peerDependenciesMeta: + aws-crt: + optional: true + checksum: 1f010080c2301fd836908963a235ef39e597d959e27461d15d4958fa582ab20795022f8cb7429c183c386f558a5c125cb254a0c4e844dbc6422169f4884be34a + languageName: node + linkType: hard + "@aws-sdk/util-utf8-browser@npm:^3.0.0": version: 3.259.0 resolution: "@aws-sdk/util-utf8-browser@npm:3.259.0" @@ -10244,11 +10694,11 @@ __metadata: version: 0.0.0-use.local resolution: "@langchain/aws@workspace:libs/langchain-aws" dependencies: - "@aws-sdk/client-bedrock-agent-runtime": ^3.583.0 + "@aws-sdk/client-bedrock-agent-runtime": ^3.616.0 "@aws-sdk/client-bedrock-runtime": ^3.602.0 "@aws-sdk/client-kendra": ^3.352.0 "@aws-sdk/credential-provider-node": ^3.600.0 - "@aws-sdk/types": ^3.598.0 + "@aws-sdk/types": ^3.609.0 "@jest/globals": ^29.5.0 "@langchain/core": ">=0.2.16 <0.3.0" "@langchain/scripts": ~0.0.14 @@ -13393,6 +13843,16 @@ __metadata: languageName: node linkType: hard +"@smithy/abort-controller@npm:^3.1.1": + version: 3.1.1 + resolution: "@smithy/abort-controller@npm:3.1.1" + dependencies: + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 7b7497f49d58787cad858f8c5ea9931ccd44d39536db4abdd531a5abf37784469522e41d9ad1d541892caa0ed3bea750447809a0a18f4689a9543d672aa61d48 + languageName: node + linkType: hard + "@smithy/config-resolver@npm:^2.0.11": version: 2.0.11 resolution: "@smithy/config-resolver@npm:2.0.11" @@ -13483,6 +13943,19 @@ __metadata: languageName: node linkType: hard +"@smithy/config-resolver@npm:^3.0.5": + version: 3.0.5 + resolution: "@smithy/config-resolver@npm:3.0.5" + dependencies: + "@smithy/node-config-provider": ^3.1.4 + "@smithy/types": ^3.3.0 + "@smithy/util-config-provider": ^3.0.0 + "@smithy/util-middleware": ^3.0.3 + tslib: ^2.6.2 + checksum: 96895ae0622a229655fa08f009d29a20157043020125014e84cb5ca33a10171c9724c309491214c2422d9c4c6681e7f5ec5f7faa8f45e11250449cf07f3552ec + languageName: node + linkType: hard + "@smithy/core@npm:^1.2.2": version: 1.2.2 resolution: "@smithy/core@npm:1.2.2" @@ -13547,6 +14020,22 @@ __metadata: languageName: node linkType: hard +"@smithy/core@npm:^2.2.7": + version: 2.2.8 + resolution: "@smithy/core@npm:2.2.8" + dependencies: + "@smithy/middleware-endpoint": ^3.0.5 + "@smithy/middleware-retry": ^3.0.11 + "@smithy/middleware-serde": ^3.0.3 + "@smithy/protocol-http": ^4.0.4 + "@smithy/smithy-client": ^3.1.9 + "@smithy/types": ^3.3.0 + "@smithy/util-middleware": ^3.0.3 + tslib: ^2.6.2 + checksum: c6dbf5e7ce509779e57889a67036e67f7c9ba39ce93eac087162997105d4afd14b34a5b145ffdcf2c56d1afa65661fc0b42705705c140a79cf0cea78f7739919 + languageName: node + linkType: hard + "@smithy/credential-provider-imds@npm:^2.0.0": version: 2.0.1 resolution: "@smithy/credential-provider-imds@npm:2.0.1" @@ -13638,6 +14127,19 @@ __metadata: languageName: node linkType: hard +"@smithy/credential-provider-imds@npm:^3.1.4": + version: 3.1.4 + resolution: "@smithy/credential-provider-imds@npm:3.1.4" + dependencies: + "@smithy/node-config-provider": ^3.1.4 + "@smithy/property-provider": ^3.1.3 + "@smithy/types": ^3.3.0 + "@smithy/url-parser": ^3.0.3 + tslib: ^2.6.2 + checksum: c75a653970f5e7b888dddbcb916fadd2c45fe59b1a776de9b44f39771b3941fb536684d2407aef88ce376afa6024f38759290db966b07e9213c49a9427ea4a7c + languageName: node + linkType: hard + "@smithy/eventstream-codec@npm:^1.1.0": version: 1.1.0 resolution: "@smithy/eventstream-codec@npm:1.1.0" @@ -13722,6 +14224,18 @@ __metadata: languageName: node linkType: hard +"@smithy/eventstream-codec@npm:^3.1.2": + version: 3.1.2 + resolution: "@smithy/eventstream-codec@npm:3.1.2" + dependencies: + "@aws-crypto/crc32": 5.2.0 + "@smithy/types": ^3.3.0 + "@smithy/util-hex-encoding": ^3.0.0 + tslib: ^2.6.2 + checksum: b0c836acbf59b57a7e2ef948a54bd441d11b75d70f1c334723c27fce1ab0ff93ea9f936976b754272b5e90413b5a169c60b1df7ecfd7d061ebaae8d5cc067d94 + languageName: node + linkType: hard + "@smithy/eventstream-serde-browser@npm:^2.0.10": version: 2.0.11 resolution: "@smithy/eventstream-serde-browser@npm:2.0.11" @@ -13766,6 +14280,17 @@ __metadata: languageName: node linkType: hard +"@smithy/eventstream-serde-browser@npm:^3.0.4": + version: 3.0.5 + resolution: "@smithy/eventstream-serde-browser@npm:3.0.5" + dependencies: + "@smithy/eventstream-serde-universal": ^3.0.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 14e8a2027745e7a1ad261068e792e4a660043ce53fefc5f564b38b841ba02d40992b38fbd2357e762f0a1ecb658df3bbf23cf5ef33c3ec2488d316be95b61b9e + languageName: node + linkType: hard + "@smithy/eventstream-serde-config-resolver@npm:^2.0.10": version: 2.0.11 resolution: "@smithy/eventstream-serde-config-resolver@npm:2.0.11" @@ -13806,6 +14331,16 @@ __metadata: languageName: node linkType: hard +"@smithy/eventstream-serde-config-resolver@npm:^3.0.3": + version: 3.0.3 + resolution: "@smithy/eventstream-serde-config-resolver@npm:3.0.3" + dependencies: + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: c61780aa0ad8c479618d0b3fcb2b42f1f9a74dcf814dba08305107ed1f088f56aa1c346db9c72439ff18617f31b9c59c6895060e4c9765c81d759150a22674af + languageName: node + linkType: hard + "@smithy/eventstream-serde-node@npm:^2.0.10": version: 2.0.11 resolution: "@smithy/eventstream-serde-node@npm:2.0.11" @@ -13850,6 +14385,17 @@ __metadata: languageName: node linkType: hard +"@smithy/eventstream-serde-node@npm:^3.0.4": + version: 3.0.4 + resolution: "@smithy/eventstream-serde-node@npm:3.0.4" + dependencies: + "@smithy/eventstream-serde-universal": ^3.0.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 0a75b184d95ab8c08efd93bf32c5fd9d735b5879df556599bd2ab78f23e3f77452e597bbdd42586c9bbedcc2b0b7683de4c816db739c19a2ebd62a34096ca86d + languageName: node + linkType: hard + "@smithy/eventstream-serde-universal@npm:^2.0.11": version: 2.0.11 resolution: "@smithy/eventstream-serde-universal@npm:2.0.11" @@ -13894,6 +14440,17 @@ __metadata: languageName: node linkType: hard +"@smithy/eventstream-serde-universal@npm:^3.0.4": + version: 3.0.4 + resolution: "@smithy/eventstream-serde-universal@npm:3.0.4" + dependencies: + "@smithy/eventstream-codec": ^3.1.2 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 8463403ca4caf4ad48dba89b126f394439a289c9095ce6361c1f186c6021c1cd8ea402d1ce06b7284069c3415091ae4d802f66ded1b89e9da9d4c255b8402668 + languageName: node + linkType: hard + "@smithy/fetch-http-handler@npm:^2.0.2, @smithy/fetch-http-handler@npm:^2.0.3": version: 2.0.3 resolution: "@smithy/fetch-http-handler@npm:2.0.3" @@ -13972,6 +14529,19 @@ __metadata: languageName: node linkType: hard +"@smithy/fetch-http-handler@npm:^3.2.2": + version: 3.2.2 + resolution: "@smithy/fetch-http-handler@npm:3.2.2" + dependencies: + "@smithy/protocol-http": ^4.0.4 + "@smithy/querystring-builder": ^3.0.3 + "@smithy/types": ^3.3.0 + "@smithy/util-base64": ^3.0.0 + tslib: ^2.6.2 + checksum: ec7f0d648d0bb2e674ca6fda040357c462833825bba6d2b1549de4b6a8d0ffdd17d6effb2dbd56241b58e76f3e7c1afba5f321f3d592c39bf5007b89e9197875 + languageName: node + linkType: hard + "@smithy/hash-node@npm:^2.0.10": version: 2.0.11 resolution: "@smithy/hash-node@npm:2.0.11" @@ -14032,6 +14602,18 @@ __metadata: languageName: node linkType: hard +"@smithy/hash-node@npm:^3.0.3": + version: 3.0.3 + resolution: "@smithy/hash-node@npm:3.0.3" + dependencies: + "@smithy/types": ^3.3.0 + "@smithy/util-buffer-from": ^3.0.0 + "@smithy/util-utf8": ^3.0.0 + tslib: ^2.6.2 + checksum: 203a3581bec5373e63d42e03f62129022f03d17390e9358a4e25fc1d44c43962ea80ab5bcbb91605e3025e22136bed059665a3b16835f66316f43ed391df9548 + languageName: node + linkType: hard + "@smithy/invalid-dependency@npm:^2.0.10": version: 2.0.11 resolution: "@smithy/invalid-dependency@npm:2.0.11" @@ -14082,6 +14664,16 @@ __metadata: languageName: node linkType: hard +"@smithy/invalid-dependency@npm:^3.0.3": + version: 3.0.3 + resolution: "@smithy/invalid-dependency@npm:3.0.3" + dependencies: + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 459b4ae4e47595e8a675ff2e8bfea7f58a41f77138416ea310c89e29312e08963a701cdc354324da9dd578a7995158b4421695365070d74b0276ddff7f701bba + languageName: node + linkType: hard + "@smithy/is-array-buffer@npm:^1.1.0": version: 1.1.0 resolution: "@smithy/is-array-buffer@npm:1.1.0" @@ -14164,6 +14756,17 @@ __metadata: languageName: node linkType: hard +"@smithy/middleware-content-length@npm:^3.0.4": + version: 3.0.4 + resolution: "@smithy/middleware-content-length@npm:3.0.4" + dependencies: + "@smithy/protocol-http": ^4.0.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 462ed3511b5cf849d272c4a6e1a1b72f6f676252e208ebd652528e3d45f132859cbcbcf9e8cb127680fbbc587ab35965225fd7421a3711f4d125738b3e7f528e + languageName: node + linkType: hard + "@smithy/middleware-endpoint@npm:^2.0.10": version: 2.0.11 resolution: "@smithy/middleware-endpoint@npm:2.0.11" @@ -14250,6 +14853,21 @@ __metadata: languageName: node linkType: hard +"@smithy/middleware-endpoint@npm:^3.0.5": + version: 3.0.5 + resolution: "@smithy/middleware-endpoint@npm:3.0.5" + dependencies: + "@smithy/middleware-serde": ^3.0.3 + "@smithy/node-config-provider": ^3.1.4 + "@smithy/shared-ini-file-loader": ^3.1.4 + "@smithy/types": ^3.3.0 + "@smithy/url-parser": ^3.0.3 + "@smithy/util-middleware": ^3.0.3 + tslib: ^2.6.2 + checksum: 4ab0272efd47baa528a04c5413fb224e41be144902680239fffc83cf1fb7e9b5342e8b627a4149136efa2b29baacc84baa4dbcef5fd2fa55c70e169c7f4ba750 + languageName: node + linkType: hard + "@smithy/middleware-retry@npm:^2.0.13": version: 2.0.16 resolution: "@smithy/middleware-retry@npm:2.0.16" @@ -14315,6 +14933,23 @@ __metadata: languageName: node linkType: hard +"@smithy/middleware-retry@npm:^3.0.10, @smithy/middleware-retry@npm:^3.0.11": + version: 3.0.11 + resolution: "@smithy/middleware-retry@npm:3.0.11" + dependencies: + "@smithy/node-config-provider": ^3.1.4 + "@smithy/protocol-http": ^4.0.4 + "@smithy/service-error-classification": ^3.0.3 + "@smithy/smithy-client": ^3.1.9 + "@smithy/types": ^3.3.0 + "@smithy/util-middleware": ^3.0.3 + "@smithy/util-retry": ^3.0.3 + tslib: ^2.6.2 + uuid: ^9.0.1 + checksum: 4061f4823c949f5e9920b4840cfbc1472f38bac05cefc511a7731afa9372dab0fb238f48b6ce7a8d4d24fa966fa80f9eb7165d29fd90fd3854d72006f612d662 + languageName: node + linkType: hard + "@smithy/middleware-retry@npm:^3.0.3": version: 3.0.3 resolution: "@smithy/middleware-retry@npm:3.0.3" @@ -14409,6 +15044,16 @@ __metadata: languageName: node linkType: hard +"@smithy/middleware-serde@npm:^3.0.3": + version: 3.0.3 + resolution: "@smithy/middleware-serde@npm:3.0.3" + dependencies: + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 6c633bb8957e078d480888bd33d5a8c269a483a1358c2b28c62daecfd442c711c509d9e69302e6b19fc298139ee67cdda63a604e7da0e4ef9005117d8e0897cc + languageName: node + linkType: hard + "@smithy/middleware-stack@npm:^2.0.0": version: 2.0.0 resolution: "@smithy/middleware-stack@npm:2.0.0" @@ -14468,6 +15113,16 @@ __metadata: languageName: node linkType: hard +"@smithy/middleware-stack@npm:^3.0.3": + version: 3.0.3 + resolution: "@smithy/middleware-stack@npm:3.0.3" + dependencies: + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: f4a450e2ebca0a8a3b4e1bbfad7d7e9c45edccbe1c984a22f2228092a526120748365e8964b478357249675d8bbc28fdaa8a4a19643a3c1d86bd74e1499327c5 + languageName: node + linkType: hard + "@smithy/node-config-provider@npm:^2.0.1": version: 2.0.1 resolution: "@smithy/node-config-provider@npm:2.0.1" @@ -14564,6 +15219,18 @@ __metadata: languageName: node linkType: hard +"@smithy/node-config-provider@npm:^3.1.4": + version: 3.1.4 + resolution: "@smithy/node-config-provider@npm:3.1.4" + dependencies: + "@smithy/property-provider": ^3.1.3 + "@smithy/shared-ini-file-loader": ^3.1.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 7ea4e7cea93ab154ab89a9d6b2453c8f96b96db18883070d287bc5fa9cfd10091bb00006a15bb7e6ed25810fd1a133d458e45310a8eaa1727a55d4ce2be3ba09 + languageName: node + linkType: hard + "@smithy/node-http-handler@npm:^2.0.2, @smithy/node-http-handler@npm:^2.0.3": version: 2.0.3 resolution: "@smithy/node-http-handler@npm:2.0.3" @@ -14642,6 +15309,19 @@ __metadata: languageName: node linkType: hard +"@smithy/node-http-handler@npm:^3.1.3": + version: 3.1.3 + resolution: "@smithy/node-http-handler@npm:3.1.3" + dependencies: + "@smithy/abort-controller": ^3.1.1 + "@smithy/protocol-http": ^4.0.4 + "@smithy/querystring-builder": ^3.0.3 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 2e07687544dc77714912467268db820cb76bffcb0f4cdb5d5f12b05561d8baedb98cb478ceb4e247151e2d7d30af7de88095f9b96037e56f58a371b2a7bab85e + languageName: node + linkType: hard + "@smithy/property-provider@npm:^2.0.0, @smithy/property-provider@npm:^2.0.1": version: 2.0.1 resolution: "@smithy/property-provider@npm:2.0.1" @@ -14722,6 +15402,16 @@ __metadata: languageName: node linkType: hard +"@smithy/property-provider@npm:^3.1.3": + version: 3.1.3 + resolution: "@smithy/property-provider@npm:3.1.3" + dependencies: + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 37a3d92267a2a32c2cc17fd1f0ab2b336f75fb7807db88f6194efede9d6a66068658a7effb7773451404fca990924393dbbf3d57e2aca67ef2e489a85666e225 + languageName: node + linkType: hard + "@smithy/protocol-http@npm:^1.0.1": version: 1.1.0 resolution: "@smithy/protocol-http@npm:1.1.0" @@ -14802,6 +15492,16 @@ __metadata: languageName: node linkType: hard +"@smithy/protocol-http@npm:^4.0.4": + version: 4.0.4 + resolution: "@smithy/protocol-http@npm:4.0.4" + dependencies: + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: a0155381d24f02d279f0b895c179e98af0a6dd1c8a1765666c856f0bca41aa7d4a245a228bc17ddde5f68c631ffe8684440051416757169074dfa5c7a7087e94 + languageName: node + linkType: hard + "@smithy/querystring-builder@npm:^2.0.10": version: 2.0.10 resolution: "@smithy/querystring-builder@npm:2.0.10" @@ -14868,6 +15568,17 @@ __metadata: languageName: node linkType: hard +"@smithy/querystring-builder@npm:^3.0.3": + version: 3.0.3 + resolution: "@smithy/querystring-builder@npm:3.0.3" + dependencies: + "@smithy/types": ^3.3.0 + "@smithy/util-uri-escape": ^3.0.0 + tslib: ^2.6.2 + checksum: 5c46c620d87f9b4e67b8eb543667b0160fb05bbec01d62d45adb94305369dca9e82daba47d81e840fdc399fa47f9b5930ce668d65fe83ee278a1b27d59d0b5d3 + languageName: node + linkType: hard + "@smithy/querystring-parser@npm:^2.0.1": version: 2.0.1 resolution: "@smithy/querystring-parser@npm:2.0.1" @@ -14938,6 +15649,16 @@ __metadata: languageName: node linkType: hard +"@smithy/querystring-parser@npm:^3.0.3": + version: 3.0.3 + resolution: "@smithy/querystring-parser@npm:3.0.3" + dependencies: + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 1de11cbc4325578b243a0e3e89b46371f4705d3df41ea51b37e8efa655d3b75253180b0fca9ceed8b3955a2d458689f551cd24fd904d0f65647c62c6b08795bf + languageName: node + linkType: hard + "@smithy/service-error-classification@npm:^2.0.0": version: 2.0.0 resolution: "@smithy/service-error-classification@npm:2.0.0" @@ -14990,6 +15711,15 @@ __metadata: languageName: node linkType: hard +"@smithy/service-error-classification@npm:^3.0.3": + version: 3.0.3 + resolution: "@smithy/service-error-classification@npm:3.0.3" + dependencies: + "@smithy/types": ^3.3.0 + checksum: 5bef710f5698c929c97865cba41f36b0c59100b9a1c4478a2d47caeb5e3a1a18077b870b365efaa45c94666f2075bc8978f7a6e8b964afbba3a4e490eb6c13eb + languageName: node + linkType: hard + "@smithy/shared-ini-file-loader@npm:^2.0.0, @smithy/shared-ini-file-loader@npm:^2.0.1": version: 2.0.1 resolution: "@smithy/shared-ini-file-loader@npm:2.0.1" @@ -15070,6 +15800,16 @@ __metadata: languageName: node linkType: hard +"@smithy/shared-ini-file-loader@npm:^3.1.4": + version: 3.1.4 + resolution: "@smithy/shared-ini-file-loader@npm:3.1.4" + dependencies: + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: c5321635f3be34e424009fc9045454a9ceec543ec20b3b9719bf3a48bbfc03b794f4545546e9c2dcb0a987de2ca5ff8999df9bf7c166c6fc7685c1fa1f068bc1 + languageName: node + linkType: hard + "@smithy/signature-v4@npm:^1.0.1": version: 1.1.0 resolution: "@smithy/signature-v4@npm:1.1.0" @@ -15132,6 +15872,21 @@ __metadata: languageName: node linkType: hard +"@smithy/signature-v4@npm:^4.0.0": + version: 4.0.0 + resolution: "@smithy/signature-v4@npm:4.0.0" + dependencies: + "@smithy/is-array-buffer": ^3.0.0 + "@smithy/types": ^3.3.0 + "@smithy/util-hex-encoding": ^3.0.0 + "@smithy/util-middleware": ^3.0.3 + "@smithy/util-uri-escape": ^3.0.0 + "@smithy/util-utf8": ^3.0.0 + tslib: ^2.6.2 + checksum: 9cebd322cbfbc8794f4a21af1152d343c4ec431d0732985e6067d3d0038d2ae970e5f12cd4862b1380a3cd1d86230bdf90a171a93d3cd82b8cbe140a4d3685b0 + languageName: node + linkType: hard + "@smithy/smithy-client@npm:^2.0.2": version: 2.0.3 resolution: "@smithy/smithy-client@npm:2.0.3" @@ -15224,6 +15979,20 @@ __metadata: languageName: node linkType: hard +"@smithy/smithy-client@npm:^3.1.8, @smithy/smithy-client@npm:^3.1.9": + version: 3.1.9 + resolution: "@smithy/smithy-client@npm:3.1.9" + dependencies: + "@smithy/middleware-endpoint": ^3.0.5 + "@smithy/middleware-stack": ^3.0.3 + "@smithy/protocol-http": ^4.0.4 + "@smithy/types": ^3.3.0 + "@smithy/util-stream": ^3.1.1 + tslib: ^2.6.2 + checksum: 2d030ca4dd3e0767e30d3bd78d7eaea19ec96f8b03a8e15b61494ea4719f63d6f25290d2d4269fdbcc2df1912ece1aa8a4b92b5f2c2f3d3c75628002ce0b5b6a + languageName: node + linkType: hard + "@smithy/types@npm:^1.0.0, @smithy/types@npm:^1.1.0": version: 1.1.0 resolution: "@smithy/types@npm:1.1.0" @@ -15314,6 +16083,15 @@ __metadata: languageName: node linkType: hard +"@smithy/types@npm:^3.3.0": + version: 3.3.0 + resolution: "@smithy/types@npm:3.3.0" + dependencies: + tslib: ^2.6.2 + checksum: 29bb5f83c41e32f8d4094a2aba2d3dfbd763ab5943784a700f3fa22df0dcf0ccac1b1907f7a87fbb9f6f2269fcd4750524bcb48f892249e200ffe397c0981309 + languageName: node + linkType: hard + "@smithy/url-parser@npm:^2.0.1": version: 2.0.1 resolution: "@smithy/url-parser@npm:2.0.1" @@ -15391,6 +16169,17 @@ __metadata: languageName: node linkType: hard +"@smithy/url-parser@npm:^3.0.3": + version: 3.0.3 + resolution: "@smithy/url-parser@npm:3.0.3" + dependencies: + "@smithy/querystring-parser": ^3.0.3 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 86b4bc8e6c176b56076c30233ca4cfeb98d162fe27a348ddfda5f163ce7d173b8e684aa26202bbf4e0b5695b0ad43c0cb40170ca6793652d0ea6edb00443c036 + languageName: node + linkType: hard + "@smithy/util-base64@npm:^2.0.0": version: 2.0.0 resolution: "@smithy/util-base64@npm:2.0.0" @@ -15584,6 +16373,19 @@ __metadata: languageName: node linkType: hard +"@smithy/util-defaults-mode-browser@npm:^3.0.10": + version: 3.0.11 + resolution: "@smithy/util-defaults-mode-browser@npm:3.0.11" + dependencies: + "@smithy/property-provider": ^3.1.3 + "@smithy/smithy-client": ^3.1.9 + "@smithy/types": ^3.3.0 + bowser: ^2.11.0 + tslib: ^2.6.2 + checksum: 62536fc7e81a180e30445c94af022223a89346c3c2f2d3fe7e48ec67e198ed31e1de598f6195a3142b6db7edb94b701ad49f52a6ef9ed546b137b97219537014 + languageName: node + linkType: hard + "@smithy/util-defaults-mode-browser@npm:^3.0.3": version: 3.0.3 resolution: "@smithy/util-defaults-mode-browser@npm:3.0.3" @@ -15669,6 +16471,21 @@ __metadata: languageName: node linkType: hard +"@smithy/util-defaults-mode-node@npm:^3.0.10": + version: 3.0.11 + resolution: "@smithy/util-defaults-mode-node@npm:3.0.11" + dependencies: + "@smithy/config-resolver": ^3.0.5 + "@smithy/credential-provider-imds": ^3.1.4 + "@smithy/node-config-provider": ^3.1.4 + "@smithy/property-provider": ^3.1.3 + "@smithy/smithy-client": ^3.1.9 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: 3df80c51cf77cd5215e64a48936831fad5f7d2accff3bed1ac62813bbd49da601cbca386b6efe0af67d33ddea423f428df14b4ca750ec7a376eb8a2e95893ba8 + languageName: node + linkType: hard + "@smithy/util-defaults-mode-node@npm:^3.0.3": version: 3.0.3 resolution: "@smithy/util-defaults-mode-node@npm:3.0.3" @@ -15743,6 +16560,17 @@ __metadata: languageName: node linkType: hard +"@smithy/util-endpoints@npm:^2.0.5": + version: 2.0.5 + resolution: "@smithy/util-endpoints@npm:2.0.5" + dependencies: + "@smithy/node-config-provider": ^3.1.4 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: bb2a96323f52beaf2820f4e5764c865cff3ac5bca0c0df6923bb4582b0f87faf1606110cd4e36005ac43f41e9673ebdca4bbb8b913880fc2a4e0ff3301250da8 + languageName: node + linkType: hard + "@smithy/util-hex-encoding@npm:^1.1.0": version: 1.1.0 resolution: "@smithy/util-hex-encoding@npm:1.1.0" @@ -15838,6 +16666,16 @@ __metadata: languageName: node linkType: hard +"@smithy/util-middleware@npm:^3.0.3": + version: 3.0.3 + resolution: "@smithy/util-middleware@npm:3.0.3" + dependencies: + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: f37f25d65595af5ff4c3f69fa7e66545ac1651f77979e15ffbc9047e18fc668dae90458ee76add85a49ea3729c49d317e40542d5430e81e2eafe8dcae2ddb3bc + languageName: node + linkType: hard + "@smithy/util-retry@npm:^2.0.0": version: 2.0.0 resolution: "@smithy/util-retry@npm:2.0.0" @@ -15903,6 +16741,17 @@ __metadata: languageName: node linkType: hard +"@smithy/util-retry@npm:^3.0.3": + version: 3.0.3 + resolution: "@smithy/util-retry@npm:3.0.3" + dependencies: + "@smithy/service-error-classification": ^3.0.3 + "@smithy/types": ^3.3.0 + tslib: ^2.6.2 + checksum: c760595376154be67414083aa6f76094022df72987521469b124ef3ef5848c0536757dcd2006520580380db6a4d7b597a05569470c3151f71d5e678df63f4c13 + languageName: node + linkType: hard + "@smithy/util-stream@npm:^2.0.14": version: 2.0.14 resolution: "@smithy/util-stream@npm:2.0.14" @@ -15999,6 +16848,22 @@ __metadata: languageName: node linkType: hard +"@smithy/util-stream@npm:^3.1.0, @smithy/util-stream@npm:^3.1.1": + version: 3.1.1 + resolution: "@smithy/util-stream@npm:3.1.1" + dependencies: + "@smithy/fetch-http-handler": ^3.2.2 + "@smithy/node-http-handler": ^3.1.3 + "@smithy/types": ^3.3.0 + "@smithy/util-base64": ^3.0.0 + "@smithy/util-buffer-from": ^3.0.0 + "@smithy/util-hex-encoding": ^3.0.0 + "@smithy/util-utf8": ^3.0.0 + tslib: ^2.6.2 + checksum: a66ce6ffebfccbf5bf81cfef08f9286839e6d17406203e42d41d611e69da558a0c1ef98b218e5544a07a8171a60792437c3468d92ef41910a8472c052f47c6bc + languageName: node + linkType: hard + "@smithy/util-uri-escape@npm:^1.1.0": version: 1.1.0 resolution: "@smithy/util-uri-escape@npm:1.1.0" From f1ae405f7ba6b31e7f46ee8e605ee61a76eb12a0 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Wed, 24 Jul 2024 13:55:52 -0700 Subject: [PATCH 09/10] Adds callback backgrounding env var in more places (#6196) --- docs/core_docs/docs/concepts.mdx | 3 +++ docs/core_docs/docs/how_to/agent_executor.ipynb | 3 +++ docs/core_docs/docs/how_to/debugging.mdx | 3 +++ .../docs/how_to/graph_constructing.ipynb | 3 +++ docs/core_docs/docs/how_to/graph_mapping.ipynb | 3 +++ docs/core_docs/docs/how_to/graph_prompting.ipynb | 3 +++ docs/core_docs/docs/how_to/graph_semantic.ipynb | 3 +++ docs/core_docs/docs/how_to/message_history.mdx | 3 +++ docs/core_docs/docs/how_to/migrate_agent.ipynb | 5 ++++- .../docs/how_to/qa_chat_history_how_to.ipynb | 3 +++ docs/core_docs/docs/how_to/qa_citations.ipynb | 3 +++ docs/core_docs/docs/how_to/qa_per_user.ipynb | 3 +++ docs/core_docs/docs/how_to/qa_sources.ipynb | 3 +++ docs/core_docs/docs/how_to/qa_streaming.ipynb | 3 +++ docs/core_docs/docs/how_to/query_few_shot.ipynb | 3 +++ .../docs/how_to/query_high_cardinality.ipynb | 3 +++ .../docs/how_to/query_multiple_queries.ipynb | 3 +++ .../docs/how_to/query_multiple_retrievers.ipynb | 3 +++ .../core_docs/docs/how_to/query_no_queries.ipynb | 3 +++ docs/core_docs/docs/how_to/sql_large_db.mdx | 3 +++ docs/core_docs/docs/how_to/sql_prompting.mdx | 3 +++ .../core_docs/docs/how_to/sql_query_checking.mdx | 3 +++ docs/core_docs/docs/how_to/tools_prompting.ipynb | 3 +++ docs/core_docs/docs/tutorials/agents.mdx | 3 +++ docs/core_docs/docs/tutorials/chatbot.ipynb | 3 +++ docs/core_docs/docs/tutorials/extraction.ipynb | 3 +++ docs/core_docs/docs/tutorials/graph.ipynb | 3 +++ docs/core_docs/docs/tutorials/llm_chain.ipynb | 3 +++ docs/core_docs/docs/tutorials/local_rag.ipynb | 3 +++ .../docs/tutorials/qa_chat_history.ipynb | 16 ++++++---------- .../docs/tutorials/query_analysis.ipynb | 3 +++ docs/core_docs/docs/tutorials/rag.ipynb | 3 +++ docs/core_docs/docs/tutorials/sql_qa.mdx | 3 +++ 33 files changed, 103 insertions(+), 11 deletions(-) diff --git a/docs/core_docs/docs/concepts.mdx b/docs/core_docs/docs/concepts.mdx index 84c48cdcaedb..93ae85ab9b68 100644 --- a/docs/core_docs/docs/concepts.mdx +++ b/docs/core_docs/docs/concepts.mdx @@ -72,6 +72,9 @@ After that, you can enable it by setting environment variables: ```shell export LANGCHAIN_TRACING_V2=true export LANGCHAIN_API_KEY=ls__... + +# Reduce tracing latency if you are not in a serverless environment +# export LANGCHAIN_CALLBACKS_BACKGROUND=true ``` ## LangChain Expression Language diff --git a/docs/core_docs/docs/how_to/agent_executor.ipynb b/docs/core_docs/docs/how_to/agent_executor.ipynb index 630c52d8aff1..1d68a826feff 100644 --- a/docs/core_docs/docs/how_to/agent_executor.ipynb +++ b/docs/core_docs/docs/how_to/agent_executor.ipynb @@ -67,6 +67,9 @@ "```shell\n", "export LANGCHAIN_TRACING_V2=\"true\"\n", "export LANGCHAIN_API_KEY=\"...\"\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```\n" ] }, diff --git a/docs/core_docs/docs/how_to/debugging.mdx b/docs/core_docs/docs/how_to/debugging.mdx index 2e93a2396536..dd92e4b15587 100644 --- a/docs/core_docs/docs/how_to/debugging.mdx +++ b/docs/core_docs/docs/how_to/debugging.mdx @@ -18,6 +18,9 @@ After you sign up at the link above, make sure to set your environment variables ```shell export LANGCHAIN_TRACING_V2="true" export LANGCHAIN_API_KEY="..." + +# Reduce tracing latency if you are not in a serverless environment +# export LANGCHAIN_CALLBACKS_BACKGROUND=true ``` Let's suppose we have an agent, and want to visualize the actions it takes and tool outputs it receives. Without any debugging, here's what we see: diff --git a/docs/core_docs/docs/how_to/graph_constructing.ipynb b/docs/core_docs/docs/how_to/graph_constructing.ipynb index 6e8b44adec70..8a78dc81aee4 100644 --- a/docs/core_docs/docs/how_to/graph_constructing.ipynb +++ b/docs/core_docs/docs/how_to/graph_constructing.ipynb @@ -42,6 +42,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```\n", "\n", "Next, we need to define Neo4j credentials.\n", diff --git a/docs/core_docs/docs/how_to/graph_mapping.ipynb b/docs/core_docs/docs/how_to/graph_mapping.ipynb index 60c3ebd6b027..f715f75b9c5e 100644 --- a/docs/core_docs/docs/how_to/graph_mapping.ipynb +++ b/docs/core_docs/docs/how_to/graph_mapping.ipynb @@ -41,6 +41,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```\n", "\n", "Next, we need to define Neo4j credentials.\n", diff --git a/docs/core_docs/docs/how_to/graph_prompting.ipynb b/docs/core_docs/docs/how_to/graph_prompting.ipynb index 73fca7deda39..6d3a442d279e 100644 --- a/docs/core_docs/docs/how_to/graph_prompting.ipynb +++ b/docs/core_docs/docs/how_to/graph_prompting.ipynb @@ -37,6 +37,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```\n", "\n", "Next, we need to define Neo4j credentials.\n", diff --git a/docs/core_docs/docs/how_to/graph_semantic.ipynb b/docs/core_docs/docs/how_to/graph_semantic.ipynb index aec3aaf4f1d8..36f335e304b4 100644 --- a/docs/core_docs/docs/how_to/graph_semantic.ipynb +++ b/docs/core_docs/docs/how_to/graph_semantic.ipynb @@ -44,6 +44,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```\n", "\n", "Next, we need to define Neo4j credentials.\n", diff --git a/docs/core_docs/docs/how_to/message_history.mdx b/docs/core_docs/docs/how_to/message_history.mdx index a3443322ed69..fe1c9c294c39 100644 --- a/docs/core_docs/docs/how_to/message_history.mdx +++ b/docs/core_docs/docs/how_to/message_history.mdx @@ -48,6 +48,9 @@ If you do want to use LangSmith, after you sign up at the link above, make sure ```bash export LANGCHAIN_TRACING_V2="true" export LANGCHAIN_API_KEY="" + +# Reduce tracing latency if you are not in a serverless environment +# export LANGCHAIN_CALLBACKS_BACKGROUND=true ``` Let's create a simple runnable that takes a dict as input and returns a `BaseMessage`. diff --git a/docs/core_docs/docs/how_to/migrate_agent.ipynb b/docs/core_docs/docs/how_to/migrate_agent.ipynb index f91cd3fd2454..26f5e0d5136c 100644 --- a/docs/core_docs/docs/how_to/migrate_agent.ipynb +++ b/docs/core_docs/docs/how_to/migrate_agent.ipynb @@ -60,7 +60,10 @@ "// process.env.LANGCHAIN_API_KEY = \"ls...\";\n", "// process.env.LANGCHAIN_CALLBACKS_BACKGROUND = \"true\";\n", "// process.env.LANGCHAIN_TRACING_V2 = \"true\";\n", - "// process.env.LANGCHAIN_PROJECT = \"How to migrate: LangGraphJS\";" + "// process.env.LANGCHAIN_PROJECT = \"How to migrate: LangGraphJS\";\n", + "\n", + "// Reduce tracing latency if you are not in a serverless environment\n", + "// process.env.LANGCHAIN_CALLBACKS_BACKGROUND = \"true\";" ] }, { diff --git a/docs/core_docs/docs/how_to/qa_chat_history_how_to.ipynb b/docs/core_docs/docs/how_to/qa_chat_history_how_to.ipynb index 2e276e92f1e2..db2f63d19198 100644 --- a/docs/core_docs/docs/how_to/qa_chat_history_how_to.ipynb +++ b/docs/core_docs/docs/how_to/qa_chat_history_how_to.ipynb @@ -60,6 +60,9 @@ "```bash\n", "export LANGCHAIN_TRACING_V2=true\n", "export LANGCHAIN_API_KEY=YOUR_KEY\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/how_to/qa_citations.ipynb b/docs/core_docs/docs/how_to/qa_citations.ipynb index cfcce3a490bd..4069fe97b022 100644 --- a/docs/core_docs/docs/how_to/qa_citations.ipynb +++ b/docs/core_docs/docs/how_to/qa_citations.ipynb @@ -57,6 +57,9 @@ "```bash\n", "export LANGCHAIN_TRACING_V2=true\n", "export LANGCHAIN_API_KEY=YOUR_KEY\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/how_to/qa_per_user.ipynb b/docs/core_docs/docs/how_to/qa_per_user.ipynb index 4e29ca6dd5b7..d3aa48764ece 100644 --- a/docs/core_docs/docs/how_to/qa_per_user.ipynb +++ b/docs/core_docs/docs/how_to/qa_per_user.ipynb @@ -89,6 +89,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/how_to/qa_sources.ipynb b/docs/core_docs/docs/how_to/qa_sources.ipynb index 142f40e5909a..dde30197c953 100644 --- a/docs/core_docs/docs/how_to/qa_sources.ipynb +++ b/docs/core_docs/docs/how_to/qa_sources.ipynb @@ -55,6 +55,9 @@ "```bash\n", "export LANGCHAIN_TRACING_V2=true\n", "export LANGCHAIN_API_KEY=YOUR_KEY\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/how_to/qa_streaming.ipynb b/docs/core_docs/docs/how_to/qa_streaming.ipynb index 6a301673dc3e..882938a3eb9c 100644 --- a/docs/core_docs/docs/how_to/qa_streaming.ipynb +++ b/docs/core_docs/docs/how_to/qa_streaming.ipynb @@ -55,6 +55,9 @@ "```bash\n", "export LANGCHAIN_TRACING_V2=true\n", "export LANGCHAIN_API_KEY=YOUR_KEY\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/how_to/query_few_shot.ipynb b/docs/core_docs/docs/how_to/query_few_shot.ipynb index ce094a5bbdef..63c91e179561 100644 --- a/docs/core_docs/docs/how_to/query_few_shot.ipynb +++ b/docs/core_docs/docs/how_to/query_few_shot.ipynb @@ -46,6 +46,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/how_to/query_high_cardinality.ipynb b/docs/core_docs/docs/how_to/query_high_cardinality.ipynb index 251e8c988f13..b07798438704 100644 --- a/docs/core_docs/docs/how_to/query_high_cardinality.ipynb +++ b/docs/core_docs/docs/how_to/query_high_cardinality.ipynb @@ -48,6 +48,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/how_to/query_multiple_queries.ipynb b/docs/core_docs/docs/how_to/query_multiple_queries.ipynb index 67712988d1ea..acac9787666a 100644 --- a/docs/core_docs/docs/how_to/query_multiple_queries.ipynb +++ b/docs/core_docs/docs/how_to/query_multiple_queries.ipynb @@ -46,6 +46,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/how_to/query_multiple_retrievers.ipynb b/docs/core_docs/docs/how_to/query_multiple_retrievers.ipynb index 933f5f49593e..74962e8e7634 100644 --- a/docs/core_docs/docs/how_to/query_multiple_retrievers.ipynb +++ b/docs/core_docs/docs/how_to/query_multiple_retrievers.ipynb @@ -46,6 +46,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/how_to/query_no_queries.ipynb b/docs/core_docs/docs/how_to/query_no_queries.ipynb index 171f5ac8dda1..a97d0e7541d0 100644 --- a/docs/core_docs/docs/how_to/query_no_queries.ipynb +++ b/docs/core_docs/docs/how_to/query_no_queries.ipynb @@ -48,6 +48,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/how_to/sql_large_db.mdx b/docs/core_docs/docs/how_to/sql_large_db.mdx index 8ce512bc8fc2..9c4895632d0e 100644 --- a/docs/core_docs/docs/how_to/sql_large_db.mdx +++ b/docs/core_docs/docs/how_to/sql_large_db.mdx @@ -25,6 +25,9 @@ export OPENAI_API_KEY="your api key" # Uncomment the below to use LangSmith. Not required. # export LANGCHAIN_API_KEY="your api key" # export LANGCHAIN_TRACING_V2=true + +# Reduce tracing latency if you are not in a serverless environment +# export LANGCHAIN_CALLBACKS_BACKGROUND=true ``` The below example will use a SQLite connection with Chinook database. Follow these [installation steps](https://database.guide/2-sample-databases-sqlite/) to create `Chinook.db` in the same directory as this notebook: diff --git a/docs/core_docs/docs/how_to/sql_prompting.mdx b/docs/core_docs/docs/how_to/sql_prompting.mdx index 827fd147a224..5cfbc2879cd2 100644 --- a/docs/core_docs/docs/how_to/sql_prompting.mdx +++ b/docs/core_docs/docs/how_to/sql_prompting.mdx @@ -24,6 +24,9 @@ export OPENAI_API_KEY="your api key" # Uncomment the below to use LangSmith. Not required. # export LANGCHAIN_API_KEY="your api key" # export LANGCHAIN_TRACING_V2=true + +# Reduce tracing latency if you are not in a serverless environment +# export LANGCHAIN_CALLBACKS_BACKGROUND=true ``` The below example will use a SQLite connection with Chinook database. Follow these [installation steps](https://database.guide/2-sample-databases-sqlite/) to create `Chinook.db` in the same directory as this notebook: diff --git a/docs/core_docs/docs/how_to/sql_query_checking.mdx b/docs/core_docs/docs/how_to/sql_query_checking.mdx index 66505a175256..7cb5146b6e8b 100644 --- a/docs/core_docs/docs/how_to/sql_query_checking.mdx +++ b/docs/core_docs/docs/how_to/sql_query_checking.mdx @@ -28,6 +28,9 @@ export OPENAI_API_KEY="your api key" # Uncomment the below to use LangSmith. Not required. # export LANGCHAIN_API_KEY="your api key" # export LANGCHAIN_TRACING_V2=true + +# Reduce tracing latency if you are not in a serverless environment +# export LANGCHAIN_CALLBACKS_BACKGROUND=true ``` The below example will use a SQLite connection with Chinook database. Follow these [installation steps](https://database.guide/2-sample-databases-sqlite/) to create `Chinook.db` in the same directory as this notebook: diff --git a/docs/core_docs/docs/how_to/tools_prompting.ipynb b/docs/core_docs/docs/how_to/tools_prompting.ipynb index a5ac5aa739d8..be665e49604c 100644 --- a/docs/core_docs/docs/how_to/tools_prompting.ipynb +++ b/docs/core_docs/docs/how_to/tools_prompting.ipynb @@ -53,6 +53,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/tutorials/agents.mdx b/docs/core_docs/docs/tutorials/agents.mdx index abf836f1f152..6176affc1a07 100644 --- a/docs/core_docs/docs/tutorials/agents.mdx +++ b/docs/core_docs/docs/tutorials/agents.mdx @@ -31,6 +31,9 @@ When building with LangChain, all steps will automatically be traced in LangSmit ```bash export LANGCHAIN_TRACING_V2="true" export LANGCHAIN_API_KEY="" + +# Reduce tracing latency if you are not in a serverless environment +# export LANGCHAIN_CALLBACKS_BACKGROUND=true ``` ## Define tools diff --git a/docs/core_docs/docs/tutorials/chatbot.ipynb b/docs/core_docs/docs/tutorials/chatbot.ipynb index 90baa457d9e1..ea09b0aa4199 100644 --- a/docs/core_docs/docs/tutorials/chatbot.ipynb +++ b/docs/core_docs/docs/tutorials/chatbot.ipynb @@ -71,6 +71,9 @@ "```shell\n", "export LANGCHAIN_TRACING_V2=\"true\"\n", "export LANGCHAIN_API_KEY=\"...\"\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```\n", "\n", "## Quickstart\n", diff --git a/docs/core_docs/docs/tutorials/extraction.ipynb b/docs/core_docs/docs/tutorials/extraction.ipynb index e1a17a350f0b..696550cf3fc2 100644 --- a/docs/core_docs/docs/tutorials/extraction.ipynb +++ b/docs/core_docs/docs/tutorials/extraction.ipynb @@ -66,6 +66,9 @@ "```shell\n", "export LANGCHAIN_TRACING_V2=\"true\"\n", "export LANGCHAIN_API_KEY=\"...\"\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/tutorials/graph.ipynb b/docs/core_docs/docs/tutorials/graph.ipynb index 240f6014f6e3..723fdf971cbf 100644 --- a/docs/core_docs/docs/tutorials/graph.ipynb +++ b/docs/core_docs/docs/tutorials/graph.ipynb @@ -62,6 +62,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```\n", "\n", "Next, we need to define Neo4j credentials.\n", diff --git a/docs/core_docs/docs/tutorials/llm_chain.ipynb b/docs/core_docs/docs/tutorials/llm_chain.ipynb index 59791535b5e8..592fef3cb35b 100644 --- a/docs/core_docs/docs/tutorials/llm_chain.ipynb +++ b/docs/core_docs/docs/tutorials/llm_chain.ipynb @@ -61,6 +61,9 @@ "```shell\n", "export LANGCHAIN_TRACING_V2=\"true\"\n", "export LANGCHAIN_API_KEY=\"...\"\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/tutorials/local_rag.ipynb b/docs/core_docs/docs/tutorials/local_rag.ipynb index be5cc79bbdd1..ca3d7a6af086 100644 --- a/docs/core_docs/docs/tutorials/local_rag.ipynb +++ b/docs/core_docs/docs/tutorials/local_rag.ipynb @@ -40,6 +40,9 @@ "```bash\n", "export LANGCHAIN_TRACING_V2=true\n", "export LANGCHAIN_API_KEY=YOUR_KEY\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/tutorials/qa_chat_history.ipynb b/docs/core_docs/docs/tutorials/qa_chat_history.ipynb index 73e71987570d..6c0c9f3e8c03 100644 --- a/docs/core_docs/docs/tutorials/qa_chat_history.ipynb +++ b/docs/core_docs/docs/tutorials/qa_chat_history.ipynb @@ -68,6 +68,9 @@ "```bash\n", "export LANGCHAIN_TRACING_V2=true\n", "export LANGCHAIN_API_KEY=YOUR_KEY\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, @@ -80,7 +83,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -92,15 +95,8 @@ "import { pull } from \"langchain/hub\";\n", "import { ChatPromptTemplate } from \"@langchain/core/prompts\";\n", "import { RunnableSequence, RunnablePassthrough } from \"@langchain/core/runnables\";\n", - "import { StringOutputParser } from \"@langchain/core/output_parsers\";" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [], - "source": [ + "import { StringOutputParser } from \"@langchain/core/output_parsers\";\n", + "\n", "import { createStuffDocumentsChain } from \"langchain/chains/combine_documents\";\n", "\n", "const loader = new CheerioWebBaseLoader(\n", diff --git a/docs/core_docs/docs/tutorials/query_analysis.ipynb b/docs/core_docs/docs/tutorials/query_analysis.ipynb index 26a5287eb85d..18c879293ced 100644 --- a/docs/core_docs/docs/tutorials/query_analysis.ipynb +++ b/docs/core_docs/docs/tutorials/query_analysis.ipynb @@ -69,6 +69,9 @@ "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", "LANGCHAIN_TRACING_V2=true\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```" ] }, diff --git a/docs/core_docs/docs/tutorials/rag.ipynb b/docs/core_docs/docs/tutorials/rag.ipynb index b7fbcbc1a44f..7e48f61db958 100644 --- a/docs/core_docs/docs/tutorials/rag.ipynb +++ b/docs/core_docs/docs/tutorials/rag.ipynb @@ -74,6 +74,9 @@ "```shell\n", "export LANGCHAIN_TRACING_V2=\"true\"\n", "export LANGCHAIN_API_KEY=\"...\"\n", + "\n", + "# Reduce tracing latency if you are not in a serverless environment\n", + "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", "```\n", "\n", "```{=mdx}\n", diff --git a/docs/core_docs/docs/tutorials/sql_qa.mdx b/docs/core_docs/docs/tutorials/sql_qa.mdx index 1357b9f45665..d0e0d2001424 100644 --- a/docs/core_docs/docs/tutorials/sql_qa.mdx +++ b/docs/core_docs/docs/tutorials/sql_qa.mdx @@ -51,6 +51,9 @@ export OPENAI_API_KEY= # Uncomment the below to use LangSmith. Not required, but recommended for debugging and observability. # export LANGCHAIN_API_KEY= # export LANGCHAIN_TRACING_V2=true + +# Reduce tracing latency if you are not in a serverless environment +# export LANGCHAIN_CALLBACKS_BACKGROUND=true ``` import CodeBlock from "@theme/CodeBlock"; From 636c17f3559da57cc73c0e930439d5606b0755ba Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Wed, 24 Jul 2024 14:23:08 -0700 Subject: [PATCH 10/10] openai[patch]: Release 0.2.5 (#6198) --- libs/langchain-openai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain-openai/package.json b/libs/langchain-openai/package.json index 7206318016bc..4c2cd0a04196 100644 --- a/libs/langchain-openai/package.json +++ b/libs/langchain-openai/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/openai", - "version": "0.2.4", + "version": "0.2.5", "description": "OpenAI integrations for LangChain.js", "type": "module", "engines": {