/** * LangChain Adapter * Wraps LangChain chains and agents for ArtemisKit testing */ import type { AdapterConfig, GenerateOptions, GenerateResult, ModelCapabilities, ModelClient } from '@artemiskit/core'; import type { LangChainAdapterConfig, LangChainRunnable } from './types.js'; /** * Adapter for testing LangChain chains and agents with ArtemisKit * * @example * ```typescript * import { LangChainAdapter } from '@artemiskit/adapter-langchain'; * import { ChatOpenAI } from '@langchain/openai'; * import { StringOutputParser } from '@langchain/core/output_parsers'; * import { ChatPromptTemplate } from '@langchain/core/prompts'; * * // Create a LangChain chain * const model = new ChatOpenAI({ model: 'gpt-4' }); * const prompt = ChatPromptTemplate.fromTemplate('Answer: {input}'); * const chain = prompt.pipe(model).pipe(new StringOutputParser()); * * // Wrap with ArtemisKit adapter * const adapter = new LangChainAdapter({ * provider: 'langchain', * runnable: chain, * runnableType: 'chain', * }); * * // Use in ArtemisKit tests * const result = await adapter.generate({ prompt: 'What is 2+2?' }); * ``` */ export declare class LangChainAdapter implements ModelClient { private runnable; private config; private runnableType; readonly provider = "langchain"; constructor(config: AdapterConfig, runnable: LangChainRunnable); /** * Attempt to detect the type of runnable based on its properties */ private detectRunnableType; generate(options: GenerateOptions): Promise; stream(options: GenerateOptions, onChunk: (chunk: string) => void): AsyncIterable; capabilities(): Promise; close(): Promise; /** * Prepare input for the LangChain runnable */ private prepareInput; /** * Extract the text output from a LangChain response * Handles various response shapes from different runnable types */ private extractOutput; /** * Extract execution metadata from the response */ private extractMetadata; } /** * Factory function to create a LangChain adapter * * @example * ```typescript * const adapter = createLangChainAdapter(myChain, { * name: 'my-rag-chain', * runnableType: 'chain', * }); * ``` */ export declare function createLangChainAdapter(runnable: LangChainRunnable, options?: Partial): LangChainAdapter; //# sourceMappingURL=client.d.ts.map