diff --git a/examples/src/chains/map_reduce_lcel.ts b/examples/src/chains/map_reduce_lcel.ts index ff0b9bec3c55..5615a62500a3 100644 --- a/examples/src/chains/map_reduce_lcel.ts +++ b/examples/src/chains/map_reduce_lcel.ts @@ -62,10 +62,12 @@ const collapseChain = RunnableSequence.from([ // Define a function to collapse a list of documents until the total number of tokens is within the limit const collapse = async ( documents: Document[], - config?: BaseCallbackConfig, + options?: { + config?: BaseCallbackConfig; + }, tokenMax = 4000 ) => { - const editableConfig = config; + const editableConfig = options?.config; let docs = documents; let collapseCount = 1; while ((await getNumTokens(docs)) > tokenMax) { diff --git a/examples/src/embeddings/gradient_ai.ts b/examples/src/embeddings/gradient_ai.ts index a749c2dc494e..f4957bf2d527 100644 --- a/examples/src/embeddings/gradient_ai.ts +++ b/examples/src/embeddings/gradient_ai.ts @@ -1,6 +1,6 @@ import { GradientEmbeddings } from "langchain/embeddings/gradient_ai"; -const model = new GradientEmbeddings(); +const model = new GradientEmbeddings({}); const res = await model.embedQuery( "What would be a good company name a company that makes colorful socks?" ); diff --git a/langchain-core/src/runnables/base.ts b/langchain-core/src/runnables/base.ts index 697bc59f095a..bd97724a15a0 100644 --- a/langchain-core/src/runnables/base.ts +++ b/langchain-core/src/runnables/base.ts @@ -23,10 +23,12 @@ import { RootListenersTracer } from "../tracers/root_listener.js"; export type RunnableFunc = ( input: RunInput, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - options?: Record & { - config?: RunnableConfig; - } + options?: + | { config?: RunnableConfig } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + | Record + // eslint-disable-next-line @typescript-eslint/no-explicit-any + | (Record & { config: RunnableConfig }) ) => RunOutput | Promise; // eslint-disable-next-line @typescript-eslint/no-explicit-any