mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(core): Improve Langsmith traces for AI executions (#9081)
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
||||
getPromptInputByType,
|
||||
isChatInstance,
|
||||
} from '../../../utils/helpers';
|
||||
import { getTracingConfig } from '../../../utils/tracing';
|
||||
|
||||
interface MessagesTemplate {
|
||||
type: string;
|
||||
@@ -154,9 +155,9 @@ async function createSimpleLLMChain(
|
||||
const chain = new LLMChain({
|
||||
llm,
|
||||
prompt,
|
||||
});
|
||||
}).withConfig(getTracingConfig(context));
|
||||
|
||||
const response = (await chain.call({
|
||||
const response = (await chain.invoke({
|
||||
query,
|
||||
signal: context.getExecutionCancelSignal(),
|
||||
})) as string[];
|
||||
@@ -203,8 +204,9 @@ async function getChain(
|
||||
);
|
||||
|
||||
const chain = prompt.pipe(llm).pipe(combinedOutputParser);
|
||||
|
||||
const response = (await chain.invoke({ query })) as string | string[];
|
||||
const response = (await chain.withConfig(getTracingConfig(context)).invoke({ query })) as
|
||||
| string
|
||||
| string[];
|
||||
|
||||
return Array.isArray(response) ? response : [response];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user