-
Notifications
You must be signed in to change notification settings - Fork 22
docs: fix Node.js quickstart scope handle and LLM request usage #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,6 @@ const { | |
| registerSubscriber, | ||
| deregisterSubscriber, | ||
| flushSubscribers, | ||
| LlmRequest, | ||
| withScope, | ||
| event, | ||
| toolCallExecute, | ||
|
|
@@ -57,23 +56,25 @@ async function main() { | |
| }); | ||
|
|
||
| await withScope("demo-agent", ScopeType.Agent, async (handle) => { | ||
| event("initialized", handle, { binding: "node" }, null); | ||
| // `handle` describes the active scope (handle.uuid, handle.name, handle.scopeType). | ||
| // For lifecycle calls inside the scope, pass null to target the current scope. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Format Use backticks around As per coding guidelines, "Format code elements, commands, parameters, package names, and expressions in monospace." 🤖 Prompt for AI Agents |
||
| event("initialized", null, { binding: "node" }, null); | ||
|
|
||
| const toolResult = await toolCallExecute( | ||
| "search", | ||
| { query: "hello" }, | ||
| (args) => ({ echo: args.query }), | ||
| handle, | ||
| null, | ||
| null, | ||
| null, | ||
| null, | ||
| ); | ||
|
|
||
| const llmResult = await llmCallExecute( | ||
| "demo-provider", | ||
| new LlmRequest({}, { messages: [{ role: "user", content: "hi" }] }), | ||
| { headers: {}, content: { messages: [{ role: "user", content: "hi" }] } }, | ||
| (request) => ({ ok: true, messages: request.content.messages }), | ||
| handle, | ||
| null, | ||
| null, | ||
| null, | ||
| null, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use inline code formatting for
nullin the explanatory comment.Wrap
nullin backticks for consistency with documentation code-element formatting rules.As per coding guidelines, "Format commands, code elements, expressions, package names, file names, and paths as inline code."
🤖 Prompt for AI Agents