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
Does the http client manage its state automatically , or do I have to update messages based on every event I receive ?.
So for event like TEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT, do I need to intercept them and add them manually to agent.messages ?
// Assume 'agent' is an initialized HttpAgent instance// agent.messages = [{ role: 'user', content: 'Hi' }]; // State before runagent.run(runInput).subscribe({next: (event)=>{// if (event.type === EventType.TEXT_MESSAGE_START && event.role === 'assistant') {// // PROBLEM: Is agent.messages now [{user}, {assistant_placeholder}] here?// }// if (event.type === EventType.TEXT_MESSAGE_CONTENT && event.role === 'assistant') {// // PROBLEM: Is agent.messages[{assistant_idx}].content updated here?// }},complete: ()=>{// After backend sent full assistant reply "Hello there":// EXPECTED: agent.messages = [{user}, {assistant, content:"Hello there"}]// OBSERVED (potentially): agent.messages = [{user, content:"Hi"}] // Assistant reply missingconsole.log(agent.messages);// Does this log the full conversation including assistant's reply?}});
From my testing I needed to handle everything manually but I feel like I am missing how to do it properly . I also had to use the run method, the runAgent one mentioned in the docs doesn't return an observable. Would appreciate any clarity on this
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
Uh oh!
There was an error while loading. Please reload this page.
-
Does the http client manage its state automatically , or do I have to update messages based on every event I receive ?.
So for event like
TEXT_MESSAGE_START
,TEXT_MESSAGE_CONTENT
, do I need to intercept them and add them manually to agent.messages ?From my testing I needed to handle everything manually but I feel like I am missing how to do it properly . I also had to use the
run
method, the runAgent one mentioned in the docs doesn't return an observable. Would appreciate any clarity on thisBeta Was this translation helpful? Give feedback.
All reactions