You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey y'all ✋ I have been developing a graph for a chatbot that navigates an application. I want to add a node that allows users to submit feedback and report bugs (on what the agent does or responds with not the application). So my idea was to have my supervisor agent route a submitFeedback node through tool calling with { score, value, comment} as args. I have been struggling to get the current runId for the current invocation of the graph so I can use it in langSmithClient.createFeedback(runId, ...). Hoping this guide would apply to js/ts as well, I have tried the following in the RunnableConfig object I send to the invoke function:
However, none of these are setting the runId (the runId in langsmith does not match any of these and the feedback is not logged). I couldn't find any examples or docs on this, so your help is greatly appreciated 🙏
here is my node code for this:
constgetNode=()=>async(state: GraphStateType,config: RunnableConfig={}): Promise<NodeOutputType>=>{const{ messages }=state;// we get routed here if the last message is an AI message with a tool_call named "SUBMIT_FEEDBACK"constlastMessage=messages[messages.length-1]asAIMessage;consttoolCall=lastMessage.tool_calls
? lastMessage.tool_calls[0]
: undefined;// this should never happen but just in caseif(!toolCall||toolCall.name!==NodeNames.SUBMIT_FEEDBACK){thrownewError(`Invalid state: we arrived in the submitFeedback Node without calling the "${NodeNames.SUBMIT_FEEDBACK}" tool. The last message was ${JSON.stringify(lastMessage)}`);}constsmithClient=getSmithClient();construnId1=config.configurable?.run_id;construnId2=config.configurable?.runId;// @ts-ignore: Ignore type checking for debugging purposesconstrunId3=config.run_id;construnId4=config.runId;console.debug("[SubmitFeedbackNode]: Submitting feedback",toolCall.args);console.debug("[SubmitFeedbackNode]: Run ID",runId1,runId2,runId3,runId4);console.debug(config);awaitsmithClient.createFeedback(runId1??null,"user-feedback",{
...toolCall.args,// projectId: LC_PROJECT_NAME,});return{};};
A follow-up question would be is there a pre-built functionality for me to get the previous runId? This is not a big issue if I can get the current runId successfully as I could just keep track of it in the application code/state but just curious. I have tried the getCurrentRunTree function but that doesn't work in web environments because of async_hooks. Greatly appreciate the community's help and advice on this in advance!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey y'all ✋ I have been developing a graph for a chatbot that navigates an application. I want to add a node that allows users to submit feedback and report bugs (on what the agent does or responds with not the application). So my idea was to have my supervisor agent route a
submitFeedback
node through tool calling with{ score, value, comment}
as args. I have been struggling to get the currentrunId
for the current invocation of the graph so I can use it inlangSmithClient.createFeedback(runId, ...)
. Hoping this guide would apply to js/ts as well, I have tried the following in theRunnableConfig
object I send to the invoke function:However, none of these are setting the runId (the runId in langsmith does not match any of these and the feedback is not logged). I couldn't find any examples or docs on this, so your help is greatly appreciated 🙏
here is my node code for this:
A follow-up question would be is there a pre-built functionality for me to get the previous runId? This is not a big issue if I can get the current runId successfully as I could just keep track of it in the application code/state but just curious. I have tried the
getCurrentRunTree
function but that doesn't work in web environments because ofasync_hooks
. Greatly appreciate the community's help and advice on this in advance!Beta Was this translation helpful? Give feedback.
All reactions