mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 20:53:15 +00:00
fix: Tracing issue where LLM calls were being traced outside of the main run (#375)
This commit is contained in:
parent
1756575b4c
commit
417c2e6650
1 changed files with 13 additions and 16 deletions
|
|
@ -14,7 +14,6 @@ import { getMessageString } from "../../../utils/message/content.js";
|
|||
import { removeLastTaskMessages } from "../../../utils/message/modify-array.js";
|
||||
import { Command } from "@langchain/langgraph";
|
||||
import { ConfigurableModel } from "langchain/chat_models/universal";
|
||||
import { traceable } from "langsmith/traceable";
|
||||
import {
|
||||
completePlanItem,
|
||||
getActivePlanItems,
|
||||
|
|
@ -90,7 +89,7 @@ const formatUserMessage = (
|
|||
);
|
||||
};
|
||||
|
||||
async function generateTaskSummaryFunc(
|
||||
async function generateTaskSummary(
|
||||
state: GraphState,
|
||||
model: ConfigurableModel,
|
||||
): Promise<{ planItemIndex: number; summary: string }> {
|
||||
|
|
@ -101,16 +100,18 @@ async function generateTaskSummaryFunc(
|
|||
}
|
||||
|
||||
logger.info(`Summarizing task steps...`);
|
||||
const response = await model.withConfig({ tags: ["nostream"] }).invoke([
|
||||
{
|
||||
role: "system",
|
||||
content: formatPrompt(activePlanItems),
|
||||
},
|
||||
{
|
||||
role: "user",
|
||||
content: formatUserMessage(state.internalMessages, activePlanItems),
|
||||
},
|
||||
]);
|
||||
const response = await model
|
||||
.withConfig({ tags: ["nostream"], runName: "generate-task-summary" })
|
||||
.invoke([
|
||||
{
|
||||
role: "system",
|
||||
content: formatPrompt(activePlanItems),
|
||||
},
|
||||
{
|
||||
role: "user",
|
||||
content: formatUserMessage(state.internalMessages, activePlanItems),
|
||||
},
|
||||
]);
|
||||
|
||||
return {
|
||||
planItemIndex: lastCompletedTask.index,
|
||||
|
|
@ -118,10 +119,6 @@ async function generateTaskSummaryFunc(
|
|||
};
|
||||
}
|
||||
|
||||
const generateTaskSummary = traceable(generateTaskSummaryFunc, {
|
||||
name: "generate-task-summary",
|
||||
});
|
||||
|
||||
export async function summarizeTaskSteps(
|
||||
state: GraphState,
|
||||
config: GraphConfig,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue