refactor(ai): Add completion signal to onText/onThinking callbacks

- Update LLMOptions interface to include completion boolean parameter
- Modify all providers to signal when text/thinking blocks are complete
- Update examples to handle the completion parameter
- Move documentation files to docs/ directory
This commit is contained in:
Mario Zechner 2025-08-24 20:33:26 +02:00
parent a42c54e6fe
commit cb4c32faaa
11 changed files with 45 additions and 13 deletions

View file

@ -91,21 +91,23 @@ export class OpenAIResponsesLLM implements LLM<OpenAIResponsesLLMOptions> {
if (event.type === "response.reasoning_summary_text.delta") {
const delta = event.delta;
thinking += delta;
options?.onThinking?.(delta);
options?.onThinking?.(delta, false);
} else if (event.type === "response.reasoning_summary_text.done") {
if (event.text) {
thinking = event.text;
}
options?.onThinking?.("", true);
}
// Handle main text output
else if (event.type === "response.output_text.delta") {
const delta = event.delta;
content += delta;
options?.onText?.(delta);
options?.onText?.(delta, false);
} else if (event.type === "response.output_text.done") {
if (event.text) {
content = event.text;
}
options?.onText?.("", true);
}
// Handle function calls
else if (event.type === "response.output_item.done") {