fix: update examples to use stream() and haiku model
- Change session.receive() to session.stream() (API change) - Use 'haiku' model instead of 'sonnet' (more reliable) - Clean up debug output 🤖 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta <noreply@letta.com>
This commit is contained in:
@@ -148,12 +148,14 @@ export async function chat(
|
||||
let response = '';
|
||||
const printer = onOutput || createStreamPrinter();
|
||||
|
||||
for await (const msg of session.receive()) {
|
||||
for await (const msg of session.stream()) {
|
||||
if (msg.type === 'assistant') {
|
||||
response += msg.content;
|
||||
printer(msg.content);
|
||||
} else if (msg.type === 'tool_call') {
|
||||
console.log(`\n${COLORS.system}[${msg.name}]${COLORS.reset}`);
|
||||
// @ts-ignore - tool name might be in different places
|
||||
const toolName = msg.name || msg.tool || 'tool';
|
||||
console.log(`\n${COLORS.system}[${toolName}]${COLORS.reset}`);
|
||||
} else if (msg.type === 'tool_result') {
|
||||
console.log(`${COLORS.system}[done]${COLORS.reset}\n`);
|
||||
}
|
||||
|
||||
@@ -12,5 +12,5 @@ export interface BugFixerConfig {
|
||||
}
|
||||
|
||||
export const DEFAULT_CONFIG: BugFixerConfig = {
|
||||
model: 'sonnet',
|
||||
model: 'haiku',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user