diff --git a/.gitignore b/.gitignore
index a705a35f8b..92f64ba492 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,4 +33,6 @@ release
/test-results/
/playwright-report/
/playwright/.cache/
-.nx/
\ No newline at end of file
+.env
+*.pem
+.nx/
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 8786fe0f0e..7469bd1c70 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -13,5 +13,10 @@
"typescript.tsdk": "node_modules/typescript/lib",
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
+ },
+ "scm.defaultViewMode": "tree",
+ "search.defaultViewMode": "tree",
+ "[typescript]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
diff --git a/docs/package.json b/docs/package.json
index a6c69910c5..b380fb13c5 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -1,6 +1,6 @@
{
"name": "docs",
- "version": "0.26.0",
+ "version": "0.30.0",
"private": true,
"scripts": {
"dev": "next dev",
diff --git a/docs/pages/docs/_meta.json b/docs/pages/docs/_meta.json
index 6be6575dc1..bd0c28d03d 100644
--- a/docs/pages/docs/_meta.json
+++ b/docs/pages/docs/_meta.json
@@ -8,6 +8,7 @@
"custom-schemas": "Custom Schemas",
"collaboration": "Collaboration",
"advanced": "Advanced",
+ "ai": "AI",
"discord-link": {
"title": "Community ↗",
"href": "https://discord.gg/Qc2QTTH5dF",
diff --git a/docs/pages/docs/ai.mdx b/docs/pages/docs/ai.mdx
new file mode 100644
index 0000000000..d997c378a3
--- /dev/null
+++ b/docs/pages/docs/ai.mdx
@@ -0,0 +1,43 @@
+---
+title: AI Rich Text Editing
+description: Add AI functionality to your BlockNote rich text editor
+imageTitle: BlockNote AI
+path: /docs/ai
+---
+
+import { Example } from "@/components/example";
+import { Callout } from "nextra/components";
+
+# BlockNote AI integration
+
+With BlockNote AI, you can add AI functionality to your rich text editor.
+Users can work with an AI agent to edit, write and format their documents.
+
+[VIDEO]
+
+- Try the [basic AI demo](/examples/ai/minimal)
+- ..or try different models in the [AI playground](/examples/ai/playground)
+- [Setup documentation](/docs/ai/getting-started)
+- TODO
+
+## Features
+
+BlockNote AI has been designed to be fully customizable.
+BlockNote shows exactly what the AI agent is doing - making it easy for users to
+work hand in hand with AI agents.
+
+- Customize commands to write new content or update existing content or formatting
+- Streaming support for quick feedback
+- Users can accept or reject AI suggestions
+- Connect any LLM model (from Llama to OpenAI, Mistral or Anthropic)
+- Customizable prompts
+- Built directly on the [Vercel AI SDK](https://sdk.vercel.ai)
+- No dependency on our backend - use your own infrastructure or connect directly to a hosted LLM API
+- Feature requests? [Get in touch](/about).
+
+
+ This feature is provided by the `@blocknote/xl-ai`. `xl-` packages are fully
+ open source, but released under a copyleft license. A commercial license for
+ usage in closed source, proprietary products comes as part of the [Business
+ subscription](/pricing).
+
diff --git a/docs/pages/docs/ai/_meta.json b/docs/pages/docs/ai/_meta.json
new file mode 100644
index 0000000000..0c8ffe7a4c
--- /dev/null
+++ b/docs/pages/docs/ai/_meta.json
@@ -0,0 +1,5 @@
+{
+ "setup": "Editor Setup",
+ "custom-commands": "Customizing Commands",
+ "reference": "Reference"
+}
diff --git a/docs/pages/docs/ai/custom-commands.mdx b/docs/pages/docs/ai/custom-commands.mdx
new file mode 100644
index 0000000000..f4dc8f417e
--- /dev/null
+++ b/docs/pages/docs/ai/custom-commands.mdx
@@ -0,0 +1,111 @@
+# Customizing AI Menu Items (commands)
+
+A central part when users are interacting with the AI agent is the _AI Suggestion Menu_ where users can enter a custom prompt or select a pre-defined command.
+
+- TODO: add image
+
+This menu is easy to customize so you can expose commands fine-tuned to your application.
+
+## Defining your own commands
+
+First, we define a new AI command, let's create one that makes selected text more casual
+
+```tsx
+import { AIMenuSuggestionItem, getAIExtension } from "@blocknote/xl-ai";
+
+// Custom item to make the text more informal.
+export const makeInformal = (
+ editor: BlockNoteEditor,
+): AIMenuSuggestionItem => ({
+ key: "make_informal",
+ title: "Make Informal",
+ aliases: ["informal", "make informal", "casual"],
+ icon: ,
+ onItemClick: async () => {
+ await getAIExtension(editor).callLLM({
+ // The prompt to send to the LLM:
+ userPrompt: "Give the selected text a more informal (casual) tone",
+ // Tell the LLM to specifically use the selected content as context (instead of the whole document)
+ useSelection: true,
+ // We only want the LLM to update selected text, not to add / delete blocks
+ defaultStreamTools: {
+ add: false,
+ delete: false,
+ update: true,
+ },
+ });
+ },
+ size: "small",
+});
+```
+
+Now, we let's create a customized AI Menu to show this command when the user has selected some text and opened the AI menu:
+
+```tsx
+import { AIMenu, getDefaultAIMenuItems } from "@blocknote/xl-ai";
+
+function CustomAIMenu() {
+ return (
+ ,
+ aiResponseStatus:
+ | "user-input"
+ | "thinking"
+ | "ai-writing"
+ | "error"
+ | "user-reviewing"
+ | "closed",
+ ) => {
+ if (aiResponseStatus === "user-input") {
+ if (editor.getSelection()) {
+ // When a selection is active (so when the AI Menu is opened via the Formatting Toolbar),
+ // we add our `makeInformal` command to the default items.
+ return [
+ ...getDefaultAIMenuItems(editor, aiResponseStatus),
+ makeInformal(editor),
+ ];
+ } else {
+ return getDefaultAIMenuItems(editor, aiResponseStatus);
+ }
+ }
+
+ // for other states, return the default items
+ return getDefaultAIMenuItems(editor, aiResponseStatus);
+ }}
+ />
+ );
+}
+```
+
+Now, let's use this custom AI Menu in our app:
+
+````tsx
+
+ {/* Creates a new AIMenu with the default items, as well as our custom
+ ones. */}
+
+
+ {/* ...other UI Elements... */}
+
+
+
+```
+
+# Full example
+
+Have a look at the full example below, where we also add an AI menu item when no selection is open
+(e.g., when the editor is opened by typing `/ai` in the editor).
+
+
+
+# Reference
+
+So far, we've added basic commands to the editor, but it's possible to completely customize low level prompts sent to the LLM.
+To learn in detail about the methods available such as `callLLM`, continue to the [AI reference docs](/docs/ai/reference).
+
+````
diff --git a/docs/pages/docs/ai/reference.mdx b/docs/pages/docs/ai/reference.mdx
new file mode 100644
index 0000000000..207703dbb0
--- /dev/null
+++ b/docs/pages/docs/ai/reference.mdx
@@ -0,0 +1,212 @@
+# BlockNote AI Reference
+
+## `createAIExtension`
+
+Use `createAIExtension` to create a new AI new AI Extension that can be registered to an editor when calling `useCreateBlockNote`.
+
+```typescript
+// Usage:
+const aiExtension = createAIExtension(opts: AIExtensionOptions);
+
+// Definition:
+type AIExtensionOptions = {
+ /**
+ * The default language model to use for LLM calls
+ */
+ model: LanguageModel;
+ /**
+ * Whether to stream the LLM response (not all models might support this)
+ * @default true
+ */
+ stream?: boolean;
+ /**
+ * The default data format to use for LLM calls
+ * "html" is recommended, the other formats are experimental
+ * @default html
+ */
+ dataFormat?: "html" | "json" | "markdown";
+ /**
+ * A function that can be used to customize the prompt sent to the LLM
+ * @default undefined
+ */
+ promptBuilder?: PromptBuilder;
+ /**
+ * The name and color of the agent cursor when the AI is writing
+ *
+ * @default { name: "AI", color: "#8bc6ff" }
+ */
+ agentCursor?: { name: string; color: string };
+};
+```
+
+## `getAIExtension`
+
+Use `getAIExtension` to retrieve the AI extension instance registered to the editor:
+
+```typescript
+getAIExtension(editor: BlockNoteEditor): AIExtension;
+```
+
+## `AIExtension`
+
+The `AIExtension` class is the main class for the AI extension. It exposes state and methods to interact with BlockNote's AI features.
+
+```typescript
+class AIExtension {
+ /**
+ * Execute a call to an LLM and apply the result to the editor
+ */
+ callLLM(opts: CallSpecificCallLLMOptions): Promise;
+ /**
+ * Returns a read-only zustand store with the state of the AI Menu
+ */
+ get store(): ReadonlyStoreApi<{
+ aiMenuState:
+ | {
+ blockId: string;
+ status:
+ | "user-input"
+ | "thinking"
+ | "ai-writing"
+ | "error"
+ | "user-reviewing";
+ }
+ | "closed";
+ }>;
+ /**
+ * Returns a zustand store with the global configuration of the AI Extension,
+ * these options are used as default across all LLM calls when calling {@link callLLM}
+ */
+ readonly options: StoreApi<{
+ model: LanguageModel;
+ dataFormat: "html" | "json" | "markdown";
+ stream: boolean;
+ promptBuilder?: PromptBuilder;
+ }>;
+
+ /**
+ * Open the AI menu at a specific block
+ */
+ openAIMenuAtBlock(blockID: string): void;
+ /**
+ * Close the AI menu
+ */
+ closeAIMenu(): void;
+ /**
+ * Accept the changes made by the LLM
+ */
+ acceptChanges(): void;
+ /**
+ * Reject the changes made by the LLM
+ */
+ rejectChanges(): void;
+ /**
+ * Update the status of a call to an LLM
+ *
+ * @warning This method should usually only be used for advanced use-cases
+ * if you want to implement how an LLM call is executed. Usually, you should
+ * use {@link callLLM} instead which will handle the status updates for you.
+ */
+ setAIResponseStatus(
+ status:
+ | "user-input"
+ | "thinking"
+ | "ai-writing"
+ | "error"
+ | "user-reviewing",
+ ): void;
+}
+```
+
+## `callLLM`
+
+```typescript
+type CallLLMOptions = {
+ /**
+ * The language model to use for the LLM call (AI SDK)
+ */
+ model: LanguageModelV1;
+ /**
+ * The user prompt to use for the LLM call
+ */
+ userPrompt: string;
+ /**
+ * The `PromptBuilder` to use for the LLM call
+ *
+ * (A PromptBuilder is a function that takes a BlockNoteEditor and details about the user's prompt
+ * and turns it into an AI SDK `CoreMessage` array to be passed to the LLM)
+ *
+ * @default provided by the format (e.g. `llm.html.defaultPromptBuilder`)
+ */
+ promptBuilder?: PromptBuilder;
+ /**
+ * The maximum number of retries for the LLM call
+ *
+ * @default 2
+ */
+ maxRetries?: number;
+ /**
+ * Whether to use the editor selection for the LLM call
+ *
+ * @default true
+ */
+ useSelection?: boolean;
+ /**
+ * Defines whether the LLM can add, update, or delete blocks
+ *
+ * @default { add: true, update: true, delete: true }
+ */
+ defaultStreamTools?: {
+ /** Enable the add tool (default: true) */
+ add?: boolean;
+ /** Enable the update tool (default: true) */
+ update?: boolean;
+ /** Enable the delete tool (default: true) */
+ delete?: boolean;
+ };
+ /**
+ * Whether to stream the LLM response or not
+ *
+ * When streaming, we use the AI SDK `streamObject` function,
+ * otherwise, we use the AI SDK `generateObject` function.
+ *
+ * @default true
+ */
+ stream?: boolean;
+ /**
+ * If the user's cursor is in an empty paragraph, automatically delete it when the AI
+ * is starting to write.
+ *
+ * (This is used when a user starts typing `/ai` in an empty block)
+ *
+ * @default true
+ */
+ deleteEmptyCursorBlock?: boolean;
+ /**
+ * Callback when a specific block is updated by the LLM
+ *
+ * (used by `AIExtension` to update the `AIMenu` position)
+ */
+ onBlockUpdate?: (blockId: string) => void;
+ /**
+ * Callback when the AI Agent starts writing
+ */
+ onStart?: () => void;
+ /**
+ * Whether to add delays between text update operations, to make the AI simulate a human typing
+ *
+ * @default true
+ */
+ withDelays?: boolean;
+ /**
+ * Additional options to pass to the `generateObject` function
+ * (only used when `stream` is `false`)
+ */
+ _generateObjectOptions?: Partial>[0]>;
+ /**
+ * Additional options to pass to the `streamObject` function
+ * (only used when `stream` is `true`)
+ */
+ _streamObjectOptions?: Partial>[0]>;
+};
+```
diff --git a/docs/pages/docs/ai/setup.mdx b/docs/pages/docs/ai/setup.mdx
new file mode 100644
index 0000000000..566c04098e
--- /dev/null
+++ b/docs/pages/docs/ai/setup.mdx
@@ -0,0 +1,108 @@
+---
+title: AI Rich Text Editing
+description: Add AI functionality to your BlockNote rich text editor
+imageTitle: BlockNote AI
+path: /docs/ai
+---
+
+import { Example } from "@/components/example";
+import { Callout } from "nextra/components";
+
+# Getting Started with BlockNote AI
+
+First, install the `@blocknote/xl-ai` package:
+
+```bash
+npm install @blocknote/xl-ai
+```
+
+## Creating a Model
+
+BlockNote AI uses the the [AI SDK](https://ai-sdk.dev/docs/foundations/overview) to standardize integrating artificial intelligence (AI) models across [supported providers](https://ai-sdk.dev/docs/foundations/providers-and-models).
+
+As a first step, you'll need to register a new model with the AI SDK. For example, for Llama hosted on Groq:
+
+```bash
+npm install @ai-sdk/groq
+```
+
+```ts
+import { createGroq } from "@ai-sdk/groq";
+
+const provider = createGroq({
+ apiKey: "YOUR_GROQ_API_KEY",
+});
+
+const model = provider("llama-3.3-70b-versatile");
+```
+
+
+ Note that this setup directly calls the provider from the client, and exposes
+ your API keys on the client. For Production scenarios, a more common approach
+ is to handle authentication on your own server and proxy requests to a
+ provider. See our [Demo AI
+ Server](https://github.com/TypeCellOS/BlockNote/tree/main/packages/xl-ai-server)
+ for a Node.js example or check the AI SDK best practices.
+
+
+## Setting up the editor
+
+Now, you can create the editor with the AI Extension enabled:
+
+```ts
+import { createBlockNoteEditor } from "@blocknote/core";
+import { BlockNoteAIExtension } from "@blocknote/xl-ai";
+import {
+ AIToolbarButton,
+ AIMenuController,
+ locales as aiLocales,
+ createAIExtension,
+ createBlockNoteAIClient,
+ getAISlashMenuItems,
+} from "@blocknote/xl-ai";
+
+const editor = createBlockNoteEditor({
+ dictionary: {
+ ...en,
+ ai: aiLocales.en, // add default translations for the AI extension
+ },
+ extensions: [
+ createAIExtension({
+ model,
+ }),
+ ],
+ // ... other editor options
+});
+```
+
+### The `createAIExtension` method
+
+TODO
+
+## Adding AI UI elements
+
+Now, the only thing left to do is to customize the UI elements of your editor.
+
+```tsx
+
+ {/* Add the AI Command menu to the editor */}
+
+
+ {/* Create you own Formatting Toolbar with an AI button,
+ (see the full example code below) */}
+
+
+ {/* Create you own SlashMenu with an AI option,
+ (see the full example code below) */}
+
+
+```
+
+# Full Example
+
+
diff --git a/docs/pages/examples/_meta.json b/docs/pages/examples/_meta.json
index aa81bb87ad..ea06b69523 100644
--- a/docs/pages/examples/_meta.json
+++ b/docs/pages/examples/_meta.json
@@ -7,5 +7,6 @@
"interoperability": "Interoperability",
"custom-schema": "Custom Schemas",
"collaboration": "Collaboration",
- "extensions": "Extensions"
+ "extensions": "Extensions",
+ "ai": "AI"
}
diff --git a/examples/01-basic/01-minimal/package.json b/examples/01-basic/01-minimal/package.json
index 08442399b8..5179e10576 100644
--- a/examples/01-basic/01-minimal/package.json
+++ b/examples/01-basic/01-minimal/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-minimal",
+ "name": "@blocknote/example-basic-minimal",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/02-block-objects/package.json b/examples/01-basic/02-block-objects/package.json
index 50c78fd245..c65e6e4fab 100644
--- a/examples/01-basic/02-block-objects/package.json
+++ b/examples/01-basic/02-block-objects/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-block-objects",
+ "name": "@blocknote/example-basic-block-objects",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/03-multi-column/package.json b/examples/01-basic/03-multi-column/package.json
index bcdfe6241e..3a6f333943 100644
--- a/examples/01-basic/03-multi-column/package.json
+++ b/examples/01-basic/03-multi-column/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-multi-column",
+ "name": "@blocknote/example-basic-multi-column",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/04-default-blocks/package.json b/examples/01-basic/04-default-blocks/package.json
index 21a66addf9..06450ec709 100644
--- a/examples/01-basic/04-default-blocks/package.json
+++ b/examples/01-basic/04-default-blocks/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-default-blocks",
+ "name": "@blocknote/example-basic-default-blocks",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/05-removing-default-blocks/package.json b/examples/01-basic/05-removing-default-blocks/package.json
index 73d542fc4d..155c5cab12 100644
--- a/examples/01-basic/05-removing-default-blocks/package.json
+++ b/examples/01-basic/05-removing-default-blocks/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-removing-default-blocks",
+ "name": "@blocknote/example-basic-removing-default-blocks",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/06-block-manipulation/package.json b/examples/01-basic/06-block-manipulation/package.json
index c241565381..4a6310c3d9 100644
--- a/examples/01-basic/06-block-manipulation/package.json
+++ b/examples/01-basic/06-block-manipulation/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-block-manipulation",
+ "name": "@blocknote/example-basic-block-manipulation",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/07-selection-blocks/package.json b/examples/01-basic/07-selection-blocks/package.json
index cf00a8d5d3..51a4cb7acc 100644
--- a/examples/01-basic/07-selection-blocks/package.json
+++ b/examples/01-basic/07-selection-blocks/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-selection-blocks",
+ "name": "@blocknote/example-basic-selection-blocks",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/08-ariakit/package.json b/examples/01-basic/08-ariakit/package.json
index 8cb5fb252b..5b12b5ad5e 100644
--- a/examples/01-basic/08-ariakit/package.json
+++ b/examples/01-basic/08-ariakit/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-ariakit",
+ "name": "@blocknote/example-basic-ariakit",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/09-shadcn/package.json b/examples/01-basic/09-shadcn/package.json
index 9099070e45..076de14c6a 100644
--- a/examples/01-basic/09-shadcn/package.json
+++ b/examples/01-basic/09-shadcn/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-shadcn",
+ "name": "@blocknote/example-basic-shadcn",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/10-localization/package.json b/examples/01-basic/10-localization/package.json
index 6e9791f93a..e6eba8cdf1 100644
--- a/examples/01-basic/10-localization/package.json
+++ b/examples/01-basic/10-localization/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-localization",
+ "name": "@blocknote/example-basic-localization",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/11-custom-placeholder/package.json b/examples/01-basic/11-custom-placeholder/package.json
index 5a0f1c4a97..d23a455b6b 100644
--- a/examples/01-basic/11-custom-placeholder/package.json
+++ b/examples/01-basic/11-custom-placeholder/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-custom-placeholder",
+ "name": "@blocknote/example-basic-custom-placeholder",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/12-multi-editor/package.json b/examples/01-basic/12-multi-editor/package.json
index 0ff9e1bfd4..78e798f03e 100644
--- a/examples/01-basic/12-multi-editor/package.json
+++ b/examples/01-basic/12-multi-editor/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-multi-editor",
+ "name": "@blocknote/example-basic-multi-editor",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/13-custom-paste-handler/package.json b/examples/01-basic/13-custom-paste-handler/package.json
index 29c51b05ba..676827b542 100644
--- a/examples/01-basic/13-custom-paste-handler/package.json
+++ b/examples/01-basic/13-custom-paste-handler/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-custom-paste-handler",
+ "name": "@blocknote/example-basic-custom-paste-handler",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/01-basic/testing/package.json b/examples/01-basic/testing/package.json
index e1d8d76c5e..34af6c470e 100644
--- a/examples/01-basic/testing/package.json
+++ b/examples/01-basic/testing/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-testing",
+ "name": "@blocknote/example-basic-testing",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/02-backend/01-file-uploading/package.json b/examples/02-backend/01-file-uploading/package.json
index b03a49a541..115c1caaef 100644
--- a/examples/02-backend/01-file-uploading/package.json
+++ b/examples/02-backend/01-file-uploading/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-file-uploading",
+ "name": "@blocknote/example-backend-file-uploading",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/02-backend/02-saving-loading/package.json b/examples/02-backend/02-saving-loading/package.json
index 8bcc9a4272..61e62e68d8 100644
--- a/examples/02-backend/02-saving-loading/package.json
+++ b/examples/02-backend/02-saving-loading/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-saving-loading",
+ "name": "@blocknote/example-backend-saving-loading",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/02-backend/03-s3/package.json b/examples/02-backend/03-s3/package.json
index 1dd9e12f87..6f2ceee11a 100644
--- a/examples/02-backend/03-s3/package.json
+++ b/examples/02-backend/03-s3/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-s3",
+ "name": "@blocknote/example-backend-s3",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/02-backend/04-rendering-static-documents/package.json b/examples/02-backend/04-rendering-static-documents/package.json
index c3c00afbf2..6d9bf7d440 100644
--- a/examples/02-backend/04-rendering-static-documents/package.json
+++ b/examples/02-backend/04-rendering-static-documents/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-rendering-static-documents",
+ "name": "@blocknote/example-backend-rendering-static-documents",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/01-ui-elements-remove/package.json b/examples/03-ui-components/01-ui-elements-remove/package.json
index d773d4c681..6217ceb432 100644
--- a/examples/03-ui-components/01-ui-elements-remove/package.json
+++ b/examples/03-ui-components/01-ui-elements-remove/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-ui-elements-remove",
+ "name": "@blocknote/example-ui-components-ui-elements-remove",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/02-formatting-toolbar-buttons/BlueButton.tsx b/examples/03-ui-components/02-formatting-toolbar-buttons/BlueButton.tsx
index 0451aa6a54..c5bad4edaa 100644
--- a/examples/03-ui-components/02-formatting-toolbar-buttons/BlueButton.tsx
+++ b/examples/03-ui-components/02-formatting-toolbar-buttons/BlueButton.tsx
@@ -1,9 +1,9 @@
+import "@blocknote/mantine/style.css";
import {
useBlockNoteEditor,
useComponentsContext,
useEditorContentOrSelectionChange,
} from "@blocknote/react";
-import "@blocknote/mantine/style.css";
import { useState } from "react";
// Custom Formatting Toolbar Button to toggle blue text & background color.
diff --git a/examples/03-ui-components/02-formatting-toolbar-buttons/package.json b/examples/03-ui-components/02-formatting-toolbar-buttons/package.json
index 42b4c9d0f2..67a1d7bc80 100644
--- a/examples/03-ui-components/02-formatting-toolbar-buttons/package.json
+++ b/examples/03-ui-components/02-formatting-toolbar-buttons/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-formatting-toolbar-buttons",
+ "name": "@blocknote/example-ui-components-formatting-toolbar-buttons",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/03-formatting-toolbar-block-type-items/package.json b/examples/03-ui-components/03-formatting-toolbar-block-type-items/package.json
index 74eb9abb28..7a01c4bf85 100644
--- a/examples/03-ui-components/03-formatting-toolbar-block-type-items/package.json
+++ b/examples/03-ui-components/03-formatting-toolbar-block-type-items/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-formatting-toolbar-block-type-items",
+ "name": "@blocknote/example-ui-components-formatting-toolbar-block-type-items",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/04-side-menu-buttons/package.json b/examples/03-ui-components/04-side-menu-buttons/package.json
index c5dfa45e36..0503387354 100644
--- a/examples/03-ui-components/04-side-menu-buttons/package.json
+++ b/examples/03-ui-components/04-side-menu-buttons/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-side-menu-buttons",
+ "name": "@blocknote/example-ui-components-side-menu-buttons",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/05-side-menu-drag-handle-items/package.json b/examples/03-ui-components/05-side-menu-drag-handle-items/package.json
index de9f04ad5d..1665ffdc67 100644
--- a/examples/03-ui-components/05-side-menu-drag-handle-items/package.json
+++ b/examples/03-ui-components/05-side-menu-drag-handle-items/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-side-menu-drag-handle-items",
+ "name": "@blocknote/example-ui-components-side-menu-drag-handle-items",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/06-suggestion-menus-slash-menu-items/App.tsx b/examples/03-ui-components/06-suggestion-menus-slash-menu-items/App.tsx
index 9c81e78841..61fc407ff7 100644
--- a/examples/03-ui-components/06-suggestion-menus-slash-menu-items/App.tsx
+++ b/examples/03-ui-components/06-suggestion-menus-slash-menu-items/App.tsx
@@ -2,17 +2,16 @@ import {
BlockNoteEditor,
filterSuggestionItems,
insertOrUpdateBlock,
- PartialBlock,
} from "@blocknote/core";
import "@blocknote/core/fonts/inter.css";
+import { BlockNoteView } from "@blocknote/mantine";
+import "@blocknote/mantine/style.css";
import {
DefaultReactSuggestionItem,
getDefaultReactSlashMenuItems,
SuggestionMenuController,
useCreateBlockNote,
} from "@blocknote/react";
-import { BlockNoteView } from "@blocknote/mantine";
-import "@blocknote/mantine/style.css";
import { HiOutlineGlobeAlt } from "react-icons/hi";
// Custom Slash Menu item to insert a block after the current one.
diff --git a/examples/03-ui-components/06-suggestion-menus-slash-menu-items/package.json b/examples/03-ui-components/06-suggestion-menus-slash-menu-items/package.json
index b64b0ef662..fe37b52315 100644
--- a/examples/03-ui-components/06-suggestion-menus-slash-menu-items/package.json
+++ b/examples/03-ui-components/06-suggestion-menus-slash-menu-items/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-suggestion-menus-slash-menu-items",
+ "name": "@blocknote/example-ui-components-suggestion-menus-slash-menu-items",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/07-suggestion-menus-slash-menu-component/package.json b/examples/03-ui-components/07-suggestion-menus-slash-menu-component/package.json
index 0dd900a083..ecdf705fe7 100644
--- a/examples/03-ui-components/07-suggestion-menus-slash-menu-component/package.json
+++ b/examples/03-ui-components/07-suggestion-menus-slash-menu-component/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-suggestion-menus-slash-menu-component",
+ "name": "@blocknote/example-ui-components-suggestion-menus-slash-menu-component",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/08-suggestion-menus-emoji-picker-columns/package.json b/examples/03-ui-components/08-suggestion-menus-emoji-picker-columns/package.json
index 0af6a1c397..c933aea6cb 100644
--- a/examples/03-ui-components/08-suggestion-menus-emoji-picker-columns/package.json
+++ b/examples/03-ui-components/08-suggestion-menus-emoji-picker-columns/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-suggestion-menus-emoji-picker-columns",
+ "name": "@blocknote/example-ui-components-suggestion-menus-emoji-picker-columns",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/09-suggestion-menus-emoji-picker-component/package.json b/examples/03-ui-components/09-suggestion-menus-emoji-picker-component/package.json
index 697bc6cc8f..259276ce27 100644
--- a/examples/03-ui-components/09-suggestion-menus-emoji-picker-component/package.json
+++ b/examples/03-ui-components/09-suggestion-menus-emoji-picker-component/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-suggestion-menus-emoji-picker-component",
+ "name": "@blocknote/example-ui-components-suggestion-menus-emoji-picker-component",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/10-suggestion-menus-grid-mentions/package.json b/examples/03-ui-components/10-suggestion-menus-grid-mentions/package.json
index 886b3b20c6..ed99e19b43 100644
--- a/examples/03-ui-components/10-suggestion-menus-grid-mentions/package.json
+++ b/examples/03-ui-components/10-suggestion-menus-grid-mentions/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-suggestion-menus-grid-mentions",
+ "name": "@blocknote/example-ui-components-suggestion-menus-grid-mentions",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/11-uppy-file-panel/package.json b/examples/03-ui-components/11-uppy-file-panel/package.json
index 74f5905aeb..e1b7a98888 100644
--- a/examples/03-ui-components/11-uppy-file-panel/package.json
+++ b/examples/03-ui-components/11-uppy-file-panel/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-uppy-file-panel",
+ "name": "@blocknote/example-ui-components-uppy-file-panel",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/12-static-formatting-toolbar/package.json b/examples/03-ui-components/12-static-formatting-toolbar/package.json
index da4735a601..e3e07cceac 100644
--- a/examples/03-ui-components/12-static-formatting-toolbar/package.json
+++ b/examples/03-ui-components/12-static-formatting-toolbar/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-static-formatting-toolbar",
+ "name": "@blocknote/example-ui-components-static-formatting-toolbar",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/13-custom-ui/package.json b/examples/03-ui-components/13-custom-ui/package.json
index c93dab18c5..4f2d67c282 100644
--- a/examples/03-ui-components/13-custom-ui/package.json
+++ b/examples/03-ui-components/13-custom-ui/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-custom-ui",
+ "name": "@blocknote/example-ui-components-custom-ui",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/14-experimental-mobile-formatting-toolbar/package.json b/examples/03-ui-components/14-experimental-mobile-formatting-toolbar/package.json
index 69dd64c794..c581485b1e 100644
--- a/examples/03-ui-components/14-experimental-mobile-formatting-toolbar/package.json
+++ b/examples/03-ui-components/14-experimental-mobile-formatting-toolbar/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-experimental-mobile-formatting-toolbar",
+ "name": "@blocknote/example-ui-components-experimental-mobile-formatting-toolbar",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/15-advanced-tables/package.json b/examples/03-ui-components/15-advanced-tables/package.json
index 962209faf6..b01ce849e7 100644
--- a/examples/03-ui-components/15-advanced-tables/package.json
+++ b/examples/03-ui-components/15-advanced-tables/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-advanced-tables",
+ "name": "@blocknote/example-ui-components-advanced-tables",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/03-ui-components/link-toolbar-buttons/package.json b/examples/03-ui-components/link-toolbar-buttons/package.json
index 4b3c21921b..abf29e935f 100644
--- a/examples/03-ui-components/link-toolbar-buttons/package.json
+++ b/examples/03-ui-components/link-toolbar-buttons/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-link-toolbar-buttons",
+ "name": "@blocknote/example-ui-components-link-toolbar-buttons",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/04-theming/01-theming-dom-attributes/package.json b/examples/04-theming/01-theming-dom-attributes/package.json
index a9688166e7..f2b71c3e2d 100644
--- a/examples/04-theming/01-theming-dom-attributes/package.json
+++ b/examples/04-theming/01-theming-dom-attributes/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-theming-dom-attributes",
+ "name": "@blocknote/example-theming-theming-dom-attributes",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/04-theming/02-changing-font/package.json b/examples/04-theming/02-changing-font/package.json
index 338f6a9886..fb4f54d6f5 100644
--- a/examples/04-theming/02-changing-font/package.json
+++ b/examples/04-theming/02-changing-font/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-changing-font",
+ "name": "@blocknote/example-theming-changing-font",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/04-theming/03-theming-css/package.json b/examples/04-theming/03-theming-css/package.json
index 7b6fa317c3..d3d9b61829 100644
--- a/examples/04-theming/03-theming-css/package.json
+++ b/examples/04-theming/03-theming-css/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-theming-css",
+ "name": "@blocknote/example-theming-theming-css",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/04-theming/04-theming-css-variables/package.json b/examples/04-theming/04-theming-css-variables/package.json
index 91b5b6b6ae..aafb4cfcf9 100644
--- a/examples/04-theming/04-theming-css-variables/package.json
+++ b/examples/04-theming/04-theming-css-variables/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-theming-css-variables",
+ "name": "@blocknote/example-theming-theming-css-variables",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/04-theming/05-theming-css-variables-code/package.json b/examples/04-theming/05-theming-css-variables-code/package.json
index ba67913af9..bea27d77ea 100644
--- a/examples/04-theming/05-theming-css-variables-code/package.json
+++ b/examples/04-theming/05-theming-css-variables-code/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-theming-css-variables-code",
+ "name": "@blocknote/example-theming-theming-css-variables-code",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/04-theming/06-code-block/package.json b/examples/04-theming/06-code-block/package.json
index dac4dc03a6..a71e44df2d 100644
--- a/examples/04-theming/06-code-block/package.json
+++ b/examples/04-theming/06-code-block/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-code-block",
+ "name": "@blocknote/example-theming-code-block",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/04-theming/07-custom-code-block/package.json b/examples/04-theming/07-custom-code-block/package.json
index a5fe5530c3..33aa535e85 100644
--- a/examples/04-theming/07-custom-code-block/package.json
+++ b/examples/04-theming/07-custom-code-block/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-custom-code-block",
+ "name": "@blocknote/example-theming-custom-code-block",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/05-interoperability/01-converting-blocks-to-html/package.json b/examples/05-interoperability/01-converting-blocks-to-html/package.json
index 43b5b3df06..bead14a025 100644
--- a/examples/05-interoperability/01-converting-blocks-to-html/package.json
+++ b/examples/05-interoperability/01-converting-blocks-to-html/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-converting-blocks-to-html",
+ "name": "@blocknote/example-interoperability-converting-blocks-to-html",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/05-interoperability/02-converting-blocks-from-html/package.json b/examples/05-interoperability/02-converting-blocks-from-html/package.json
index f31ad9ff6a..d1dbd7037d 100644
--- a/examples/05-interoperability/02-converting-blocks-from-html/package.json
+++ b/examples/05-interoperability/02-converting-blocks-from-html/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-converting-blocks-from-html",
+ "name": "@blocknote/example-interoperability-converting-blocks-from-html",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/05-interoperability/03-converting-blocks-to-md/package.json b/examples/05-interoperability/03-converting-blocks-to-md/package.json
index de3151f165..b48fde48e6 100644
--- a/examples/05-interoperability/03-converting-blocks-to-md/package.json
+++ b/examples/05-interoperability/03-converting-blocks-to-md/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-converting-blocks-to-md",
+ "name": "@blocknote/example-interoperability-converting-blocks-to-md",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/05-interoperability/04-converting-blocks-from-md/package.json b/examples/05-interoperability/04-converting-blocks-from-md/package.json
index 3c733ea46c..c8148fb197 100644
--- a/examples/05-interoperability/04-converting-blocks-from-md/package.json
+++ b/examples/05-interoperability/04-converting-blocks-from-md/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-converting-blocks-from-md",
+ "name": "@blocknote/example-interoperability-converting-blocks-from-md",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/05-interoperability/05-converting-blocks-to-pdf/package.json b/examples/05-interoperability/05-converting-blocks-to-pdf/package.json
index d28a48de5f..a20a4011c4 100644
--- a/examples/05-interoperability/05-converting-blocks-to-pdf/package.json
+++ b/examples/05-interoperability/05-converting-blocks-to-pdf/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-converting-blocks-to-pdf",
+ "name": "@blocknote/example-interoperability-converting-blocks-to-pdf",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/05-interoperability/06-converting-blocks-to-docx/package.json b/examples/05-interoperability/06-converting-blocks-to-docx/package.json
index 1947c68d54..092a4761c2 100644
--- a/examples/05-interoperability/06-converting-blocks-to-docx/package.json
+++ b/examples/05-interoperability/06-converting-blocks-to-docx/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-converting-blocks-to-docx",
+ "name": "@blocknote/example-interoperability-converting-blocks-to-docx",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/05-interoperability/07-converting-blocks-to-odt/package.json b/examples/05-interoperability/07-converting-blocks-to-odt/package.json
index e5e81bfaa8..4318d50d5b 100644
--- a/examples/05-interoperability/07-converting-blocks-to-odt/package.json
+++ b/examples/05-interoperability/07-converting-blocks-to-odt/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-converting-blocks-to-odt",
+ "name": "@blocknote/example-interoperability-converting-blocks-to-odt",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/06-custom-schema/01-alert-block/package.json b/examples/06-custom-schema/01-alert-block/package.json
index 86988599a5..724ada3572 100644
--- a/examples/06-custom-schema/01-alert-block/package.json
+++ b/examples/06-custom-schema/01-alert-block/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-alert-block",
+ "name": "@blocknote/example-custom-schema-alert-block",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/06-custom-schema/02-suggestion-menus-mentions/package.json b/examples/06-custom-schema/02-suggestion-menus-mentions/package.json
index 05f9ea4cbf..21f885a9e4 100644
--- a/examples/06-custom-schema/02-suggestion-menus-mentions/package.json
+++ b/examples/06-custom-schema/02-suggestion-menus-mentions/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-suggestion-menus-mentions",
+ "name": "@blocknote/example-custom-schema-suggestion-menus-mentions",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/06-custom-schema/03-font-style/package.json b/examples/06-custom-schema/03-font-style/package.json
index ef3214b29b..d08215b00e 100644
--- a/examples/06-custom-schema/03-font-style/package.json
+++ b/examples/06-custom-schema/03-font-style/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-font-style",
+ "name": "@blocknote/example-custom-schema-font-style",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/06-custom-schema/04-pdf-file-block/package.json b/examples/06-custom-schema/04-pdf-file-block/package.json
index 4d18a9546f..f817dbae28 100644
--- a/examples/06-custom-schema/04-pdf-file-block/package.json
+++ b/examples/06-custom-schema/04-pdf-file-block/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-pdf-file-block",
+ "name": "@blocknote/example-custom-schema-pdf-file-block",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/06-custom-schema/05-alert-block-full-ux/App.tsx b/examples/06-custom-schema/05-alert-block-full-ux/App.tsx
index bfaf162f90..9e72f9904a 100644
--- a/examples/06-custom-schema/05-alert-block-full-ux/App.tsx
+++ b/examples/06-custom-schema/05-alert-block-full-ux/App.tsx
@@ -8,13 +8,13 @@ import "@blocknote/core/fonts/inter.css";
import { BlockNoteView } from "@blocknote/mantine";
import "@blocknote/mantine/style.css";
import {
+ BlockTypeSelectItem,
+ FormattingToolbar,
FormattingToolbarController,
SuggestionMenuController,
blockTypeSelectItems,
getDefaultReactSlashMenuItems,
useCreateBlockNote,
- BlockTypeSelectItem,
- FormattingToolbar,
} from "@blocknote/react";
import { RiAlertFill } from "react-icons/ri";
diff --git a/examples/06-custom-schema/05-alert-block-full-ux/package.json b/examples/06-custom-schema/05-alert-block-full-ux/package.json
index a5ca782e7a..635d86536f 100644
--- a/examples/06-custom-schema/05-alert-block-full-ux/package.json
+++ b/examples/06-custom-schema/05-alert-block-full-ux/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-alert-block-full-ux",
+ "name": "@blocknote/example-custom-schema-alert-block-full-ux",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/06-custom-schema/react-custom-blocks/package.json b/examples/06-custom-schema/react-custom-blocks/package.json
index 1998f1ca1a..ef9df33b4a 100644
--- a/examples/06-custom-schema/react-custom-blocks/package.json
+++ b/examples/06-custom-schema/react-custom-blocks/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-react-custom-blocks",
+ "name": "@blocknote/example-custom-schema-react-custom-blocks",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/06-custom-schema/react-custom-inline-content/package.json b/examples/06-custom-schema/react-custom-inline-content/package.json
index 02e0da5c3c..1dc9b17734 100644
--- a/examples/06-custom-schema/react-custom-inline-content/package.json
+++ b/examples/06-custom-schema/react-custom-inline-content/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-react-custom-inline-content",
+ "name": "@blocknote/example-custom-schema-react-custom-inline-content",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/06-custom-schema/react-custom-styles/App.tsx b/examples/06-custom-schema/react-custom-styles/App.tsx
index c0b5075376..706931cabd 100644
--- a/examples/06-custom-schema/react-custom-styles/App.tsx
+++ b/examples/06-custom-schema/react-custom-styles/App.tsx
@@ -1,17 +1,17 @@
import { BlockNoteSchema, defaultStyleSpecs } from "@blocknote/core";
import "@blocknote/core/fonts/inter.css";
+import { BlockNoteView } from "@blocknote/mantine";
+import "@blocknote/mantine/style.css";
import {
- createReactStyleSpec,
FormattingToolbar,
FormattingToolbarController,
FormattingToolbarProps,
+ createReactStyleSpec,
useActiveStyles,
useBlockNoteEditor,
useComponentsContext,
useCreateBlockNote,
} from "@blocknote/react";
-import { BlockNoteView } from "@blocknote/mantine";
-import "@blocknote/mantine/style.css";
const small = createReactStyleSpec(
{
diff --git a/examples/06-custom-schema/react-custom-styles/package.json b/examples/06-custom-schema/react-custom-styles/package.json
index f3cf3bf4fb..a2d9f585a2 100644
--- a/examples/06-custom-schema/react-custom-styles/package.json
+++ b/examples/06-custom-schema/react-custom-styles/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-react-custom-styles",
+ "name": "@blocknote/example-custom-schema-react-custom-styles",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/07-collaboration/01-partykit/package.json b/examples/07-collaboration/01-partykit/package.json
index c39e06c134..c50ea40320 100644
--- a/examples/07-collaboration/01-partykit/package.json
+++ b/examples/07-collaboration/01-partykit/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-partykit",
+ "name": "@blocknote/example-collaboration-partykit",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/07-collaboration/02-liveblocks/package.json b/examples/07-collaboration/02-liveblocks/package.json
index f5b01c872b..def2998319 100644
--- a/examples/07-collaboration/02-liveblocks/package.json
+++ b/examples/07-collaboration/02-liveblocks/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-liveblocks",
+ "name": "@blocknote/example-collaboration-liveblocks",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/07-collaboration/03-y-sweet/package.json b/examples/07-collaboration/03-y-sweet/package.json
index abd2912846..cb8d1492a1 100644
--- a/examples/07-collaboration/03-y-sweet/package.json
+++ b/examples/07-collaboration/03-y-sweet/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-y-sweet",
+ "name": "@blocknote/example-collaboration-y-sweet",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/07-collaboration/04-comments/package.json b/examples/07-collaboration/04-comments/package.json
index 84e0105849..45cebf7075 100644
--- a/examples/07-collaboration/04-comments/package.json
+++ b/examples/07-collaboration/04-comments/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-comments",
+ "name": "@blocknote/example-collaboration-comments",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/07-collaboration/05-comments-with-sidebar/package.json b/examples/07-collaboration/05-comments-with-sidebar/package.json
index c49f1dcb9a..2b7d33d0c8 100644
--- a/examples/07-collaboration/05-comments-with-sidebar/package.json
+++ b/examples/07-collaboration/05-comments-with-sidebar/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-comments-with-sidebar",
+ "name": "@blocknote/example-collaboration-comments-with-sidebar",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/07-collaboration/06-ghost-writer/package.json b/examples/07-collaboration/06-ghost-writer/package.json
index 44b1e1c3ac..5f37787686 100644
--- a/examples/07-collaboration/06-ghost-writer/package.json
+++ b/examples/07-collaboration/06-ghost-writer/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-ghost-writer",
+ "name": "@blocknote/example-collaboration-ghost-writer",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/08-extensions/01-tiptap-arrow-conversion/package.json b/examples/08-extensions/01-tiptap-arrow-conversion/package.json
index 464decdddd..9d973b019f 100644
--- a/examples/08-extensions/01-tiptap-arrow-conversion/package.json
+++ b/examples/08-extensions/01-tiptap-arrow-conversion/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-tiptap-arrow-conversion",
+ "name": "@blocknote/example-extensions-tiptap-arrow-conversion",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/09-ai/01-minimal/.bnexample.json b/examples/09-ai/01-minimal/.bnexample.json
new file mode 100644
index 0000000000..19b3413f5e
--- /dev/null
+++ b/examples/09-ai/01-minimal/.bnexample.json
@@ -0,0 +1,13 @@
+{
+ "playground": true,
+ "docs": true,
+ "author": "yousefed",
+ "tags": ["AI", "llm"],
+ "dependencies": {
+ "@blocknote/xl-ai": "latest",
+ "@mantine/core": "^7.10.1",
+ "ai": "^4.3.15",
+ "@ai-sdk/groq": "^1.2.9",
+ "zustand": "^5.0.3"
+ }
+}
diff --git a/examples/09-ai/01-minimal/App.tsx b/examples/09-ai/01-minimal/App.tsx
new file mode 100644
index 0000000000..ffb3cb673b
--- /dev/null
+++ b/examples/09-ai/01-minimal/App.tsx
@@ -0,0 +1,158 @@
+import { createGroq } from "@ai-sdk/groq";
+import { BlockNoteEditor, filterSuggestionItems } from "@blocknote/core";
+import "@blocknote/core/fonts/inter.css";
+import { en } from "@blocknote/core/locales";
+import { BlockNoteView } from "@blocknote/mantine";
+import "@blocknote/mantine/style.css";
+import {
+ FormattingToolbar,
+ FormattingToolbarController,
+ SuggestionMenuController,
+ getDefaultReactSlashMenuItems,
+ getFormattingToolbarItems,
+ useCreateBlockNote,
+} from "@blocknote/react";
+import {
+ AIMenuController,
+ AIToolbarButton,
+ locales as aiLocales,
+ createAIExtension,
+ createBlockNoteAIClient,
+ getAISlashMenuItems,
+} from "@blocknote/xl-ai";
+import "@blocknote/xl-ai/style.css";
+import { getEnv } from "./getEnv.js";
+
+// Optional: proxy requests through the `@blocknote/xl-ai-server` proxy server
+// so that we don't have to expose our API keys to the client
+const client = createBlockNoteAIClient({
+ apiKey: getEnv("BLOCKNOTE_AI_SERVER_API_KEY") || "PLACEHOLDER",
+ baseURL:
+ getEnv("BLOCKNOTE_AI_SERVER_BASE_URL") || "https://localhost:3000/ai",
+});
+
+// Use an "open" model such as llama, in this case via groq.com
+const model = createGroq({
+ // call via our proxy client
+ ...client.getProviderSettings("groq"),
+})("llama-3.3-70b-versatile");
+
+/*
+ALTERNATIVES:
+
+Call a model directly (without the proxy):
+
+const model = createGroq({
+ apiKey: "",
+})("llama-3.3-70b-versatile");
+
+Or, use a different provider like OpenAI:
+
+const model = createOpenAI({
+ ...client.getProviderSettings("openai"),
+})("gpt-4", {});
+*/
+
+export default function App() {
+ // Creates a new editor instance.
+ const editor = useCreateBlockNote({
+ dictionary: {
+ ...en,
+ ai: aiLocales.en, // add default translations for the AI extension
+ },
+ // Register the AI extension
+ extensions: [
+ createAIExtension({
+ model,
+ }),
+ ],
+ // We set some initial content for demo purposes
+ initialContent: [
+ {
+ type: "heading",
+ props: {
+ level: 1,
+ },
+ content: "I love cats",
+ },
+ {
+ type: "paragraph",
+ content:
+ "Cats are one of the most beloved and fascinating animals in the world. Known for their agility, independence, and charm, cats have been companions to humans for thousands of years. Domesticated cats, scientifically named Felis catus, come in various breeds, colors, and personalities, making them a popular choice for pet owners everywhere. Their mysterious behavior, sharp reflexes, and quiet affection have earned them a special place in countless households.",
+ },
+ {
+ type: "paragraph",
+ content:
+ "Beyond their role as pets, cats have a rich history and cultural significance. In ancient Egypt, they were revered and even worshipped as symbols of protection and grace. Throughout history, they’ve appeared in folklore, art, and literature, often associated with curiosity, luck, and mystery. Despite superstitions surrounding black cats in some cultures, many societies around the world admire and cherish these sleek and graceful animals.",
+ },
+ {
+ type: "paragraph",
+ content:
+ "Cats also offer emotional and physical benefits to their owners. Studies have shown that interacting with cats can reduce stress, lower blood pressure, and improve mental well-being. Their gentle purring, playful antics, and warm companionship provide comfort to people of all ages. Whether lounging in the sun, chasing a toy, or curling up on a lap, cats bring joy, peace, and a bit of magic to the lives of those who welcome them into their homes.",
+ },
+ ],
+ });
+
+ // Renders the editor instance using a React component.
+ return (
+
+
+ {/* Add the AI Command menu to the editor */}
+
+
+ {/* We disabled the default formatting toolbar with `formattingToolbar=false`
+ and replace it for one with an "AI button" (defined below).
+ (See "Formatting Toolbar" in docs)
+ */}
+
+
+ {/* We disabled the default SlashMenu with `slashMenu=false`
+ and replace it for one with an AI option (defined below).
+ (See "Suggestion Menus" in docs)
+ */}
+
+
+
+ );
+}
+
+// Formatting toolbar with the `AIToolbarButton` added
+function FormattingToolbarWithAI() {
+ return (
+ (
+
+ {...getFormattingToolbarItems()}
+ {/* Add the AI button */}
+
+
+ )}
+ />
+ );
+}
+
+// Slash menu with the AI option added
+function SuggestionMenuWithAI(props: {
+ editor: BlockNoteEditor;
+}) {
+ return (
+
+ filterSuggestionItems(
+ [
+ ...getDefaultReactSlashMenuItems(props.editor),
+ // add the default AI slash menu items, or define your own
+ ...getAISlashMenuItems(props.editor),
+ ],
+ query,
+ )
+ }
+ />
+ );
+}
diff --git a/examples/09-ai/01-minimal/README.md b/examples/09-ai/01-minimal/README.md
new file mode 100644
index 0000000000..309a6d94ec
--- /dev/null
+++ b/examples/09-ai/01-minimal/README.md
@@ -0,0 +1,12 @@
+# Rich Text editor AI integration
+
+This example shows the minimal setup to add AI integration to your BlockNote rich text editor.
+
+Select some text and click the AI (magic wand) button, or type `/ai` anywhere in the editor to access AI functionality.
+
+**Relevant Docs:**
+
+- [Editor Setup](/docs/editor-basics/setup)
+- [Changing the Formatting Toolbar](/docs/ui-components/formatting-toolbar#changing-the-formatting-toolbar)
+- [Changing Slash Menu Items](/docs/ui-components/suggestion-menus#changing-slash-menu-items)
+- [Getting Stared with BlockNote AI](/docs/ai/setup)
diff --git a/examples/09-ai/01-minimal/getEnv.ts b/examples/09-ai/01-minimal/getEnv.ts
new file mode 100644
index 0000000000..b225fc462e
--- /dev/null
+++ b/examples/09-ai/01-minimal/getEnv.ts
@@ -0,0 +1,20 @@
+// helper function to get env variables across next / vite
+// only needed so this example works in BlockNote demos and docs
+export function getEnv(key: string) {
+ const env = (import.meta as any).env
+ ? {
+ BLOCKNOTE_AI_SERVER_API_KEY: (import.meta as any).env
+ .VITE_BLOCKNOTE_AI_SERVER_API_KEY,
+ BLOCKNOTE_AI_SERVER_BASE_URL: (import.meta as any).env
+ .VITE_BLOCKNOTE_AI_SERVER_BASE_URL,
+ }
+ : {
+ BLOCKNOTE_AI_SERVER_API_KEY:
+ process.env.NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_API_KEY,
+ BLOCKNOTE_AI_SERVER_BASE_URL:
+ process.env.NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_BASE_URL,
+ };
+
+ const value = env[key as keyof typeof env];
+ return value;
+}
diff --git a/examples/09-ai/01-minimal/index.html b/examples/09-ai/01-minimal/index.html
new file mode 100644
index 0000000000..6e9c4e44a1
--- /dev/null
+++ b/examples/09-ai/01-minimal/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+ Rich Text editor AI integration
+
+
+
+
+
+
diff --git a/examples/09-ai/01-minimal/main.tsx b/examples/09-ai/01-minimal/main.tsx
new file mode 100644
index 0000000000..6284417d60
--- /dev/null
+++ b/examples/09-ai/01-minimal/main.tsx
@@ -0,0 +1,11 @@
+// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
+import React from "react";
+import { createRoot } from "react-dom/client";
+import App from "./App.jsx";
+
+const root = createRoot(document.getElementById("root")!);
+root.render(
+
+
+
+);
diff --git a/examples/09-ai/01-minimal/package.json b/examples/09-ai/01-minimal/package.json
new file mode 100644
index 0000000000..aabe636163
--- /dev/null
+++ b/examples/09-ai/01-minimal/package.json
@@ -0,0 +1,32 @@
+{
+ "name": "@blocknote/example-ai-minimal",
+ "description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
+ "private": true,
+ "version": "0.12.4",
+ "scripts": {
+ "start": "vite",
+ "dev": "vite",
+ "build:prod": "tsc && vite build",
+ "preview": "vite preview"
+ },
+ "dependencies": {
+ "@blocknote/core": "latest",
+ "@blocknote/react": "latest",
+ "@blocknote/ariakit": "latest",
+ "@blocknote/mantine": "latest",
+ "@blocknote/shadcn": "latest",
+ "react": "^18.3.1",
+ "react-dom": "^18.3.1",
+ "@blocknote/xl-ai": "latest",
+ "@mantine/core": "^7.10.1",
+ "ai": "^4.3.15",
+ "@ai-sdk/groq": "^1.2.9",
+ "zustand": "^5.0.3"
+ },
+ "devDependencies": {
+ "@types/react": "^18.0.25",
+ "@types/react-dom": "^18.0.9",
+ "@vitejs/plugin-react": "^4.3.1",
+ "vite": "^5.3.4"
+ }
+}
\ No newline at end of file
diff --git a/examples/09-ai/01-minimal/tsconfig.json b/examples/09-ai/01-minimal/tsconfig.json
new file mode 100644
index 0000000000..dbe3e6f62d
--- /dev/null
+++ b/examples/09-ai/01-minimal/tsconfig.json
@@ -0,0 +1,36 @@
+{
+ "__comment": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
+ "compilerOptions": {
+ "target": "ESNext",
+ "useDefineForClassFields": true,
+ "lib": [
+ "DOM",
+ "DOM.Iterable",
+ "ESNext"
+ ],
+ "allowJs": false,
+ "skipLibCheck": true,
+ "esModuleInterop": false,
+ "allowSyntheticDefaultImports": true,
+ "strict": true,
+ "forceConsistentCasingInFileNames": true,
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "jsx": "react-jsx",
+ "composite": true
+ },
+ "include": [
+ "."
+ ],
+ "__ADD_FOR_LOCAL_DEV_references": [
+ {
+ "path": "../../../packages/core/"
+ },
+ {
+ "path": "../../../packages/react/"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/examples/09-ai/01-minimal/vite.config.ts b/examples/09-ai/01-minimal/vite.config.ts
new file mode 100644
index 0000000000..f62ab20bc2
--- /dev/null
+++ b/examples/09-ai/01-minimal/vite.config.ts
@@ -0,0 +1,32 @@
+// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
+import react from "@vitejs/plugin-react";
+import * as fs from "fs";
+import * as path from "path";
+import { defineConfig } from "vite";
+// import eslintPlugin from "vite-plugin-eslint";
+// https://vitejs.dev/config/
+export default defineConfig((conf) => ({
+ plugins: [react()],
+ optimizeDeps: {},
+ build: {
+ sourcemap: true,
+ },
+ resolve: {
+ alias:
+ conf.command === "build" ||
+ !fs.existsSync(path.resolve(__dirname, "../../packages/core/src"))
+ ? {}
+ : ({
+ // Comment out the lines below to load a built version of blocknote
+ // or, keep as is to load live from sources with live reload working
+ "@blocknote/core": path.resolve(
+ __dirname,
+ "../../packages/core/src/"
+ ),
+ "@blocknote/react": path.resolve(
+ __dirname,
+ "../../packages/react/src/"
+ ),
+ } as any),
+ },
+}));
diff --git a/examples/09-ai/02-playground/.bnexample.json b/examples/09-ai/02-playground/.bnexample.json
new file mode 100644
index 0000000000..dc5849f4d4
--- /dev/null
+++ b/examples/09-ai/02-playground/.bnexample.json
@@ -0,0 +1,17 @@
+{
+ "playground": true,
+ "docs": true,
+ "author": "yousefed",
+ "tags": ["AI", "llm"],
+ "dependencies": {
+ "@blocknote/xl-ai": "latest",
+ "@mantine/core": "^7.10.1",
+ "ai": "^4.3.15",
+ "@ai-sdk/openai": "^1.3.22",
+ "@ai-sdk/openai-compatible": "^0.2.14",
+ "@ai-sdk/groq": "^1.2.9",
+ "@ai-sdk/anthropic": "^1.2.11",
+ "@ai-sdk/mistral": "^1.2.8",
+ "zustand": "^5.0.3"
+ }
+}
diff --git a/examples/09-ai/02-playground/App.tsx b/examples/09-ai/02-playground/App.tsx
new file mode 100644
index 0000000000..f2c45a869e
--- /dev/null
+++ b/examples/09-ai/02-playground/App.tsx
@@ -0,0 +1,236 @@
+import { createAnthropic } from "@ai-sdk/anthropic";
+import { createGroq } from "@ai-sdk/groq";
+import { createMistral } from "@ai-sdk/mistral";
+import { createOpenAI } from "@ai-sdk/openai";
+import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
+import { BlockNoteEditor, filterSuggestionItems } from "@blocknote/core";
+import "@blocknote/core/fonts/inter.css";
+import { en } from "@blocknote/core/locales";
+import { BlockNoteView } from "@blocknote/mantine";
+import "@blocknote/mantine/style.css";
+import {
+ FormattingToolbar,
+ FormattingToolbarController,
+ SuggestionMenuController,
+ getDefaultReactSlashMenuItems,
+ getFormattingToolbarItems,
+ useCreateBlockNote,
+} from "@blocknote/react";
+import {
+ AIMenuController,
+ AIToolbarButton,
+ locales as aiLocales,
+ createAIExtension,
+ createBlockNoteAIClient,
+ getAIExtension,
+ getAISlashMenuItems,
+ llmFormats,
+} from "@blocknote/xl-ai";
+import "@blocknote/xl-ai/style.css";
+import { Fieldset, Switch } from "@mantine/core";
+import { LanguageModelV1 } from "ai";
+import { useEffect, useMemo, useState } from "react";
+import { useStore } from "zustand";
+import { BasicAutocomplete } from "./AutoComplete.js";
+import RadioGroupComponent from "./components/RadioGroupComponent.js";
+import { getEnv } from "./getEnv.js";
+// Optional: proxy requests through the `@blocknote/xl-ai-server` proxy server
+// so that we don't have to expose our API keys to the client
+const client = createBlockNoteAIClient({
+ apiKey: getEnv("BLOCKNOTE_AI_SERVER_API_KEY") || "PLACEHOLDER",
+ baseURL:
+ getEnv("BLOCKNOTE_AI_SERVER_BASE_URL") || "https://localhost:3000/ai",
+});
+
+// return the AI SDK model based on the selected model string
+function getModel(aiModelString: string) {
+ const [provider, ...modelNameParts] = aiModelString.split("/");
+ const modelName = modelNameParts.join("/");
+ if (provider === "openai.chat") {
+ return createOpenAI({
+ ...client.getProviderSettings("openai"),
+ })(modelName, {});
+ } else if (provider === "groq.chat") {
+ return createGroq({
+ ...client.getProviderSettings("groq"),
+ })(modelName);
+ } else if (provider === "albert-etalab.chat") {
+ return createOpenAICompatible({
+ name: "albert-etalab",
+ baseURL: "https://albert.api.etalab.gouv.fr/v1",
+ ...client.getProviderSettings("albert-etalab"),
+ })(modelName);
+ } else if (provider === "mistral.chat") {
+ return createMistral({
+ ...client.getProviderSettings("mistral"),
+ })(modelName);
+ } else if (provider === "anthropic.chat") {
+ return createAnthropic({
+ ...client.getProviderSettings("anthropic"),
+ })(modelName);
+ } else {
+ return "unknown-model" as const;
+ }
+}
+
+export default function App() {
+ const [modelString, setModelString] = useState(
+ "groq.chat/llama-3.3-70b-versatile",
+ );
+
+ const model = useMemo(() => {
+ return getModel(modelString);
+ }, [modelString]);
+
+ // Creates a new editor instance.
+ const editor = useCreateBlockNote({
+ dictionary: {
+ ...en,
+ ai: aiLocales.en, // add default translations for the AI extension
+ },
+ // Register the AI extension
+ extensions: [
+ createAIExtension({
+ model: model as LanguageModelV1, // (type because initially it's valid)
+ }),
+ ],
+ // We set some initial content for demo purposes
+ initialContent: [
+ {
+ type: "heading",
+ props: {
+ level: 1,
+ },
+ content: "I love cats",
+ },
+ {
+ type: "paragraph",
+ content:
+ "Cats are one of the most beloved and fascinating animals in the world. Known for their agility, independence, and charm, cats have been companions to humans for thousands of years. Domesticated cats, scientifically named Felis catus, come in various breeds, colors, and personalities, making them a popular choice for pet owners everywhere. Their mysterious behavior, sharp reflexes, and quiet affection have earned them a special place in countless households.",
+ },
+ {
+ type: "paragraph",
+ content:
+ "Beyond their role as pets, cats have a rich history and cultural significance. In ancient Egypt, they were revered and even worshipped as symbols of protection and grace. Throughout history, they’ve appeared in folklore, art, and literature, often associated with curiosity, luck, and mystery. Despite superstitions surrounding black cats in some cultures, many societies around the world admire and cherish these sleek and graceful animals.",
+ },
+ {
+ type: "paragraph",
+ content:
+ "Cats also offer emotional and physical benefits to their owners. Studies have shown that interacting with cats can reduce stress, lower blood pressure, and improve mental well-being. Their gentle purring, playful antics, and warm companionship provide comfort to people of all ages. Whether lounging in the sun, chasing a toy, or curling up on a lap, cats bring joy, peace, and a bit of magic to the lives of those who welcome them into their homes.",
+ },
+ ],
+ });
+
+ const ai = getAIExtension(editor);
+
+ // TODO: fix typing in autocompletion box
+
+ useEffect(() => {
+ // update the default model in the extension
+ if (model !== "unknown-model") {
+ ai.options.setState({ model });
+ }
+ }, [model, ai.options]);
+
+ const [dataFormat, setDataFormat] = useState("html");
+
+ const stream = useStore(ai.options, (state) => state.stream);
+
+ return (
+
+
+
+
+ {/* Add the AI Command menu to the editor */}
+
+
+ {/* We disabled the default formatting toolbar with `formattingToolbar=false`
+ and replace it for one with an "AI button" (defined below).
+ (See "Formatting Toolbar" in docs)
+ */}
+
+
+ {/* We disabled the default SlashMenu with `slashMenu=false`
+ and replace it for one with an AI option (defined below).
+ (See "Suggestion Menus" in docs)
+ */}
+
+
+
+ );
+}
+
+// Formatting toolbar with the `AIToolbarButton` added
+function FormattingToolbarWithAI() {
+ return (
+ (
+
+ {...getFormattingToolbarItems()}
+
+
+ )}
+ />
+ );
+}
+
+// Slash menu with the AI option added
+function SuggestionMenuWithAI(props: {
+ editor: BlockNoteEditor;
+}) {
+ return (
+
+ filterSuggestionItems(
+ [
+ ...getDefaultReactSlashMenuItems(props.editor),
+ ...getAISlashMenuItems(props.editor),
+ ],
+ query,
+ )
+ }
+ />
+ );
+}
diff --git a/examples/09-ai/02-playground/AutoComplete.tsx b/examples/09-ai/02-playground/AutoComplete.tsx
new file mode 100644
index 0000000000..8503c91f1d
--- /dev/null
+++ b/examples/09-ai/02-playground/AutoComplete.tsx
@@ -0,0 +1,63 @@
+import { Combobox, TextInput, useCombobox } from "@mantine/core";
+import { AI_MODELS } from "./data/aimodels.js";
+
+// https://mantine.dev/combobox/?e=BasicAutocomplete
+// This is used for the AI Model selector in the example
+export function BasicAutocomplete(props: {
+ value: string;
+ onChange: (value: string) => void;
+ error?: string;
+}) {
+ const { value, onChange } = props;
+ const combobox = useCombobox();
+
+ const shouldFilterOptions = !AI_MODELS.some((item) => item === value);
+ const filteredOptions = shouldFilterOptions
+ ? AI_MODELS.filter((item) =>
+ item.toLowerCase().includes(value.toLowerCase().trim()),
+ )
+ : AI_MODELS;
+
+ const options = filteredOptions.map((item) => (
+
+ {item}
+
+ ));
+
+ return (
+ {
+ onChange(optionValue);
+ combobox.closeDropdown();
+ }}
+ store={combobox}
+ withinPortal={false}>
+
+ {
+ onChange(event.currentTarget.value);
+ combobox.openDropdown();
+ combobox.updateSelectedOptionIndex();
+ }}
+ onClick={() => combobox.openDropdown()}
+ onFocus={() => combobox.openDropdown()}
+ onBlur={() => combobox.closeDropdown()}
+ error={props.error}
+ />
+
+
+
+
+ {options.length === 0 ? (
+ Nothing found
+ ) : (
+ options
+ )}
+
+
+
+ );
+}
diff --git a/examples/09-ai/02-playground/README.md b/examples/09-ai/02-playground/README.md
new file mode 100644
index 0000000000..9a42631199
--- /dev/null
+++ b/examples/09-ai/02-playground/README.md
@@ -0,0 +1,12 @@
+# AI Playground
+
+The AI Playground example shows how to customize different options of the AI Extension such as model type and streaming mode.
+
+Change the configuration, the highlight some text to access the AI menu, or type `/ai` anywhere in the editor.
+
+**Relevant Docs:**
+
+- [Editor Setup](/docs/editor-basics/setup)
+- [Changing the Formatting Toolbar](/docs/ui-components/formatting-toolbar#changing-the-formatting-toolbar)
+- [Changing Slash Menu Items](/docs/ui-components/suggestion-menus#changing-slash-menu-items)
+- [Getting Stared with BlockNote AI](/docs/ai/setup)
diff --git a/examples/09-ai/02-playground/components/RadioGroupComponent.module.css b/examples/09-ai/02-playground/components/RadioGroupComponent.module.css
new file mode 100644
index 0000000000..46eedff7db
--- /dev/null
+++ b/examples/09-ai/02-playground/components/RadioGroupComponent.module.css
@@ -0,0 +1,33 @@
+.root {
+ position: relative;
+ padding: var(--mantine-spacing-md);
+ transition: border-color 150ms ease;
+
+ &[data-checked] {
+ border-color: var(--mantine-primary-color-filled);
+ }
+
+ @mixin hover {
+ @mixin light {
+ background-color: var(--mantine-color-gray-0);
+ }
+
+ @mixin dark {
+ background-color: var(--mantine-color-dark-6);
+ }
+ }
+}
+
+.label {
+ font-family: var(--mantine-font-family-monospace);
+ font-weight: bold;
+ font-size: var(--mantine-font-size-md);
+ line-height: 1.3;
+ color: var(--mantine-color-bright);
+}
+
+.description {
+ margin-top: 8px;
+ color: var(--mantine-color-dimmed);
+ font-size: var(--mantine-font-size-xs);
+}
diff --git a/examples/09-ai/02-playground/components/RadioGroupComponent.tsx b/examples/09-ai/02-playground/components/RadioGroupComponent.tsx
new file mode 100644
index 0000000000..f1cbed1508
--- /dev/null
+++ b/examples/09-ai/02-playground/components/RadioGroupComponent.tsx
@@ -0,0 +1,44 @@
+import { Radio, Stack } from "@mantine/core";
+import React from "react";
+
+interface RadioGroupComponentProps {
+ label: string;
+ items: Array<{
+ name: string;
+ description: string;
+ value: string;
+ }>;
+ value: string;
+ onChange: (value: string) => void;
+}
+
+const RadioGroupComponent: React.FC = ({
+ label,
+ items,
+ value,
+ onChange,
+}) => (
+
+
+ {items.map((item) => (
+
+ // TODO: doesn't work well with our mantive version or styles
+ //
+ //
+ //
+ //
+ // {item.name}
+ // {item.description}
+ //
+ //
+ //
+ ))}
+
+
+);
+
+export default RadioGroupComponent;
diff --git a/examples/09-ai/02-playground/data/aimodels.ts b/examples/09-ai/02-playground/data/aimodels.ts
new file mode 100644
index 0000000000..174618d11c
--- /dev/null
+++ b/examples/09-ai/02-playground/data/aimodels.ts
@@ -0,0 +1,17 @@
+export const AI_MODELS = [
+ "openai.chat/gpt-4o",
+ "openai.chat/gpt-4o-mini",
+ "openai.chat/gpt-4.1",
+ "groq.chat/llama-3.3-70b-versatile",
+ "groq.chat/llama-3.1-8b-instant",
+ "groq.chat/llama3-70b-8192",
+ "groq.chat/deepseek-r1-distill-llama-70b",
+ "groq.chat/qwen-qwq-32b",
+ "mistral.chat/mistral-large-latest",
+ "mistral.chat/mistral-medium-latest",
+ "mistral.chat/ministral-3b-latest",
+ "mistral.chat/ministral-8b-latest",
+ "anthropic.chat/claude-3-7-sonnet-latest",
+ "anthropic.chat/claude-3-5-haiku-latest",
+ "albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8",
+];
diff --git a/examples/09-ai/02-playground/getEnv.ts b/examples/09-ai/02-playground/getEnv.ts
new file mode 100644
index 0000000000..b225fc462e
--- /dev/null
+++ b/examples/09-ai/02-playground/getEnv.ts
@@ -0,0 +1,20 @@
+// helper function to get env variables across next / vite
+// only needed so this example works in BlockNote demos and docs
+export function getEnv(key: string) {
+ const env = (import.meta as any).env
+ ? {
+ BLOCKNOTE_AI_SERVER_API_KEY: (import.meta as any).env
+ .VITE_BLOCKNOTE_AI_SERVER_API_KEY,
+ BLOCKNOTE_AI_SERVER_BASE_URL: (import.meta as any).env
+ .VITE_BLOCKNOTE_AI_SERVER_BASE_URL,
+ }
+ : {
+ BLOCKNOTE_AI_SERVER_API_KEY:
+ process.env.NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_API_KEY,
+ BLOCKNOTE_AI_SERVER_BASE_URL:
+ process.env.NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_BASE_URL,
+ };
+
+ const value = env[key as keyof typeof env];
+ return value;
+}
diff --git a/examples/09-ai/02-playground/index.html b/examples/09-ai/02-playground/index.html
new file mode 100644
index 0000000000..402f74d225
--- /dev/null
+++ b/examples/09-ai/02-playground/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+ AI Playground
+
+
+
+
+
+
diff --git a/examples/09-ai/02-playground/main.tsx b/examples/09-ai/02-playground/main.tsx
new file mode 100644
index 0000000000..6284417d60
--- /dev/null
+++ b/examples/09-ai/02-playground/main.tsx
@@ -0,0 +1,11 @@
+// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
+import React from "react";
+import { createRoot } from "react-dom/client";
+import App from "./App.jsx";
+
+const root = createRoot(document.getElementById("root")!);
+root.render(
+
+
+
+);
diff --git a/examples/09-ai/02-playground/package.json b/examples/09-ai/02-playground/package.json
new file mode 100644
index 0000000000..f2874ba52c
--- /dev/null
+++ b/examples/09-ai/02-playground/package.json
@@ -0,0 +1,36 @@
+{
+ "name": "@blocknote/example-ai-playground",
+ "description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
+ "private": true,
+ "version": "0.12.4",
+ "scripts": {
+ "start": "vite",
+ "dev": "vite",
+ "build:prod": "tsc && vite build",
+ "preview": "vite preview"
+ },
+ "dependencies": {
+ "@blocknote/core": "latest",
+ "@blocknote/react": "latest",
+ "@blocknote/ariakit": "latest",
+ "@blocknote/mantine": "latest",
+ "@blocknote/shadcn": "latest",
+ "react": "^18.3.1",
+ "react-dom": "^18.3.1",
+ "@blocknote/xl-ai": "latest",
+ "@mantine/core": "^7.10.1",
+ "ai": "^4.3.15",
+ "@ai-sdk/openai": "^1.3.22",
+ "@ai-sdk/openai-compatible": "^0.2.14",
+ "@ai-sdk/groq": "^1.2.9",
+ "@ai-sdk/anthropic": "^1.2.11",
+ "@ai-sdk/mistral": "^1.2.8",
+ "zustand": "^5.0.3"
+ },
+ "devDependencies": {
+ "@types/react": "^18.0.25",
+ "@types/react-dom": "^18.0.9",
+ "@vitejs/plugin-react": "^4.3.1",
+ "vite": "^5.3.4"
+ }
+}
\ No newline at end of file
diff --git a/examples/09-ai/02-playground/tsconfig.json b/examples/09-ai/02-playground/tsconfig.json
new file mode 100644
index 0000000000..dbe3e6f62d
--- /dev/null
+++ b/examples/09-ai/02-playground/tsconfig.json
@@ -0,0 +1,36 @@
+{
+ "__comment": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
+ "compilerOptions": {
+ "target": "ESNext",
+ "useDefineForClassFields": true,
+ "lib": [
+ "DOM",
+ "DOM.Iterable",
+ "ESNext"
+ ],
+ "allowJs": false,
+ "skipLibCheck": true,
+ "esModuleInterop": false,
+ "allowSyntheticDefaultImports": true,
+ "strict": true,
+ "forceConsistentCasingInFileNames": true,
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "jsx": "react-jsx",
+ "composite": true
+ },
+ "include": [
+ "."
+ ],
+ "__ADD_FOR_LOCAL_DEV_references": [
+ {
+ "path": "../../../packages/core/"
+ },
+ {
+ "path": "../../../packages/react/"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/examples/09-ai/02-playground/vite.config.ts b/examples/09-ai/02-playground/vite.config.ts
new file mode 100644
index 0000000000..f62ab20bc2
--- /dev/null
+++ b/examples/09-ai/02-playground/vite.config.ts
@@ -0,0 +1,32 @@
+// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
+import react from "@vitejs/plugin-react";
+import * as fs from "fs";
+import * as path from "path";
+import { defineConfig } from "vite";
+// import eslintPlugin from "vite-plugin-eslint";
+// https://vitejs.dev/config/
+export default defineConfig((conf) => ({
+ plugins: [react()],
+ optimizeDeps: {},
+ build: {
+ sourcemap: true,
+ },
+ resolve: {
+ alias:
+ conf.command === "build" ||
+ !fs.existsSync(path.resolve(__dirname, "../../packages/core/src"))
+ ? {}
+ : ({
+ // Comment out the lines below to load a built version of blocknote
+ // or, keep as is to load live from sources with live reload working
+ "@blocknote/core": path.resolve(
+ __dirname,
+ "../../packages/core/src/"
+ ),
+ "@blocknote/react": path.resolve(
+ __dirname,
+ "../../packages/react/src/"
+ ),
+ } as any),
+ },
+}));
diff --git a/examples/09-ai/03-custom-ai-menu-items/.bnexample.json b/examples/09-ai/03-custom-ai-menu-items/.bnexample.json
new file mode 100644
index 0000000000..94929e4e36
--- /dev/null
+++ b/examples/09-ai/03-custom-ai-menu-items/.bnexample.json
@@ -0,0 +1,15 @@
+{
+ "playground": true,
+ "docs": true,
+ "author": "matthewlipski",
+ "tags": ["AI", "llm"],
+ "dependencies": {
+ "@blocknote/xl-ai": "latest",
+ "@mantine/core": "^7.10.1",
+ "ai": "^4.1.0",
+ "@ai-sdk/openai": "^1.1.0",
+ "@ai-sdk/groq": "^1.1.0",
+ "react-icons": "^5.2.1",
+ "zustand": "^5.0.3"
+ }
+}
diff --git a/examples/09-ai/03-custom-ai-menu-items/App.tsx b/examples/09-ai/03-custom-ai-menu-items/App.tsx
new file mode 100644
index 0000000000..39d05a116b
--- /dev/null
+++ b/examples/09-ai/03-custom-ai-menu-items/App.tsx
@@ -0,0 +1,203 @@
+import { createGroq } from "@ai-sdk/groq";
+import { BlockNoteEditor, filterSuggestionItems } from "@blocknote/core";
+import "@blocknote/core/fonts/inter.css";
+import { en } from "@blocknote/core/locales";
+import { BlockNoteView } from "@blocknote/mantine";
+import "@blocknote/mantine/style.css";
+import {
+ FormattingToolbar,
+ FormattingToolbarController,
+ SuggestionMenuController,
+ getDefaultReactSlashMenuItems,
+ getFormattingToolbarItems,
+ useCreateBlockNote,
+} from "@blocknote/react";
+import {
+ AIMenu,
+ AIMenuController,
+ AIToolbarButton,
+ locales as aiLocales,
+ createAIExtension,
+ createBlockNoteAIClient,
+ getAISlashMenuItems,
+ getDefaultAIMenuItems,
+} from "@blocknote/xl-ai";
+import "@blocknote/xl-ai/style.css";
+import { getEnv } from "./getEnv.js";
+
+import { addRelatedTopics, makeInformal } from "./customAIMenuItems.js";
+
+// Optional: proxy requests through the `@blocknote/xl-ai-server` proxy server
+// so that we don't have to expose our API keys to the client
+const client = createBlockNoteAIClient({
+ apiKey: getEnv("BLOCKNOTE_AI_SERVER_API_KEY") || "PLACEHOLDER",
+ baseURL:
+ getEnv("BLOCKNOTE_AI_SERVER_BASE_URL") || "https://localhost:3000/ai",
+});
+
+// Use an "open" model such as llama, in this case via groq.com
+const model = createGroq({
+ // call via our proxy client
+ ...client.getProviderSettings("groq"),
+})("llama-3.3-70b-versatile");
+
+/*
+ALTERNATIVES:
+
+Call a model directly (without the proxy):
+
+const model = createGroq({
+ apiKey: "",
+})("llama-3.3-70b-versatile");
+
+Or, use a different provider like OpenAI:
+
+const model = createOpenAI({
+ ...client.getProviderSettings("openai"),
+})("gpt-4", {});
+*/
+
+export default function App() {
+ // Creates a new editor instance.
+ const editor = useCreateBlockNote({
+ dictionary: {
+ ...en,
+ ai: aiLocales.en, // add default translations for the AI extension
+ },
+ // Register the AI extension
+ extensions: [
+ createAIExtension({
+ model,
+ }),
+ ],
+ // We set some initial content for demo purposes
+ initialContent: [
+ {
+ type: "heading",
+ props: {
+ level: 1,
+ },
+ content: "I love cats",
+ },
+ {
+ type: "paragraph",
+ content:
+ "Cats are one of the most beloved and fascinating animals in the world. Known for their agility, independence, and charm, cats have been companions to humans for thousands of years. Domesticated cats, scientifically named Felis catus, come in various breeds, colors, and personalities, making them a popular choice for pet owners everywhere. Their mysterious behavior, sharp reflexes, and quiet affection have earned them a special place in countless households.",
+ },
+ {
+ type: "paragraph",
+ content:
+ "Beyond their role as pets, cats have a rich history and cultural significance. In ancient Egypt, they were revered and even worshipped as symbols of protection and grace. Throughout history, they’ve appeared in folklore, art, and literature, often associated with curiosity, luck, and mystery. Despite superstitions surrounding black cats in some cultures, many societies around the world admire and cherish these sleek and graceful animals.",
+ },
+ {
+ type: "paragraph",
+ content:
+ "Cats also offer emotional and physical benefits to their owners. Studies have shown that interacting with cats can reduce stress, lower blood pressure, and improve mental well-being. Their gentle purring, playful antics, and warm companionship provide comfort to people of all ages. Whether lounging in the sun, chasing a toy, or curling up on a lap, cats bring joy, peace, and a bit of magic to the lives of those who welcome them into their homes.",
+ },
+ ],
+ });
+
+ // Renders the editor instance using a React component.
+ return (
+
+
+ {/* Creates a new AIMenu with the default items,
+ as well as our custom ones. */}
+
+
+ {/* We disabled the default formatting toolbar with `formattingToolbar=false`
+ and replace it for one with an "AI button" (defined below).
+ (See "Formatting Toolbar" in docs)
+ */}
+
+
+ {/* We disabled the default SlashMenu with `slashMenu=false`
+ and replace it for one with an AI option (defined below).
+ (See "Suggestion Menus" in docs)
+ */}
+
+
+
+ );
+}
+
+function CustomAIMenu() {
+ return (
+ ,
+ aiResponseStatus:
+ | "user-input"
+ | "thinking"
+ | "ai-writing"
+ | "error"
+ | "user-reviewing"
+ | "closed",
+ ) => {
+ if (aiResponseStatus === "user-input") {
+ // Returns different items based on whether the AI Menu was
+ // opened via the Formatting Toolbar or the Slash Menu.
+ if (editor.getSelection()) {
+ return [
+ // Gets the default AI Menu items
+ ...getDefaultAIMenuItems(editor, aiResponseStatus),
+ // Adds our custom item to make the text more casual.
+ // Only appears when the AI Menu is opened via the
+ // Formatting Toolbar.
+ makeInformal(editor),
+ ];
+ } else {
+ return [
+ // Gets the default AI Menu items
+ ...getDefaultAIMenuItems(editor, aiResponseStatus),
+ // Adds our custom item to find related topics. Only
+ // appears when the AI Menu is opened via the Slash
+ // Menu.
+ addRelatedTopics(editor),
+ ];
+ }
+ }
+ // for other states, return the default items
+ return getDefaultAIMenuItems(editor, aiResponseStatus);
+ }}
+ />
+ );
+}
+
+// Formatting toolbar with the `AIToolbarButton` added
+function FormattingToolbarWithAI() {
+ return (
+ (
+
+ {...getFormattingToolbarItems()}
+
+
+ )}
+ />
+ );
+}
+
+// Slash menu with the AI option added
+function SuggestionMenuWithAI(props: {
+ editor: BlockNoteEditor;
+}) {
+ return (
+
+ filterSuggestionItems(
+ [
+ ...getDefaultReactSlashMenuItems(props.editor),
+ ...getAISlashMenuItems(props.editor),
+ ],
+ query,
+ )
+ }
+ />
+ );
+}
diff --git a/examples/09-ai/03-custom-ai-menu-items/README.md b/examples/09-ai/03-custom-ai-menu-items/README.md
new file mode 100644
index 0000000000..96ccc89571
--- /dev/null
+++ b/examples/09-ai/03-custom-ai-menu-items/README.md
@@ -0,0 +1,10 @@
+# Adding AI Menu Items
+
+In this example, we add two items to the AI Menu. The first prompts the AI to make the selected text more casual, and can be found by selecting some text and click the AI (magic wand) button. The second prompts the AI to give ideas on related topics to extend the document with, and can be found by clicking the "Ask AI" Slash Menu item.
+
+Select some text and click the AI (magic wand) button, or type `/ai` anywhere in the editor to access AI functionality.
+
+**Relevant Docs:**
+
+- [Getting Stared with BlockNote AI](/docs/ai/setup)
+- [Custom AI Menu Items](/docs/ai/custom-commands)
diff --git a/examples/09-ai/03-custom-ai-menu-items/customAIMenuItems.tsx b/examples/09-ai/03-custom-ai-menu-items/customAIMenuItems.tsx
new file mode 100644
index 0000000000..4752756416
--- /dev/null
+++ b/examples/09-ai/03-custom-ai-menu-items/customAIMenuItems.tsx
@@ -0,0 +1,63 @@
+import { BlockNoteEditor } from "@blocknote/core";
+import { AIMenuSuggestionItem, getAIExtension } from "@blocknote/xl-ai";
+import { RiApps2AddFill, RiEmotionHappyFill } from "react-icons/ri";
+
+// Custom item to make the text more informal.
+export const makeInformal = (
+ editor: BlockNoteEditor,
+): AIMenuSuggestionItem => ({
+ key: "make_informal",
+ title: "Make Informal",
+ // Aliases used when filtering AI Menu items from
+ // text in prompt input.
+ aliases: ["informal", "make informal", "casual"],
+ icon: ,
+ onItemClick: async () => {
+ await getAIExtension(editor).callLLM({
+ userPrompt: "Give the selected text a more informal (casual) tone",
+ // Set to true to tell the LLM to specifically
+ // use the selected content as context. Defaults
+ // to false.
+ useSelection: true,
+ // Sets what operations the LLM is allowed to do.
+ // In this case, we only want to allow updating
+ // the selected content, so only `update` is set
+ // to true. Defaults to `true` for all
+ // operations.
+ defaultStreamTools: {
+ add: false,
+ delete: false,
+ update: true,
+ },
+ });
+ },
+ size: "small",
+});
+
+// Custom item to write about related topics.
+export const addRelatedTopics = (
+ editor: BlockNoteEditor,
+): AIMenuSuggestionItem => ({
+ key: "add_related_topics",
+ title: "Add Related Topics",
+ // Aliases used when filtering AI Menu items from
+ // text in prompt input.
+ aliases: ["related topics", "find topics"],
+ icon: ,
+ onItemClick: async () => {
+ await getAIExtension(editor).callLLM({
+ userPrompt:
+ "Think of some related topics to the current text and write a sentence about each",
+ // Sets what operations the LLM is allowed to do.
+ // In this case, we only want to allow adding new
+ // content, so only `add` is set to true.
+ // Defaults to `true` for all operations.
+ defaultStreamTools: {
+ add: true,
+ delete: false,
+ update: false,
+ },
+ });
+ },
+ size: "small",
+});
diff --git a/examples/09-ai/03-custom-ai-menu-items/getEnv.ts b/examples/09-ai/03-custom-ai-menu-items/getEnv.ts
new file mode 100644
index 0000000000..b225fc462e
--- /dev/null
+++ b/examples/09-ai/03-custom-ai-menu-items/getEnv.ts
@@ -0,0 +1,20 @@
+// helper function to get env variables across next / vite
+// only needed so this example works in BlockNote demos and docs
+export function getEnv(key: string) {
+ const env = (import.meta as any).env
+ ? {
+ BLOCKNOTE_AI_SERVER_API_KEY: (import.meta as any).env
+ .VITE_BLOCKNOTE_AI_SERVER_API_KEY,
+ BLOCKNOTE_AI_SERVER_BASE_URL: (import.meta as any).env
+ .VITE_BLOCKNOTE_AI_SERVER_BASE_URL,
+ }
+ : {
+ BLOCKNOTE_AI_SERVER_API_KEY:
+ process.env.NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_API_KEY,
+ BLOCKNOTE_AI_SERVER_BASE_URL:
+ process.env.NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_BASE_URL,
+ };
+
+ const value = env[key as keyof typeof env];
+ return value;
+}
diff --git a/examples/09-ai/03-custom-ai-menu-items/index.html b/examples/09-ai/03-custom-ai-menu-items/index.html
new file mode 100644
index 0000000000..8a9ab3594f
--- /dev/null
+++ b/examples/09-ai/03-custom-ai-menu-items/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+ Adding AI Menu Items
+
+
+
+
+
+
diff --git a/examples/09-ai/03-custom-ai-menu-items/main.tsx b/examples/09-ai/03-custom-ai-menu-items/main.tsx
new file mode 100644
index 0000000000..6284417d60
--- /dev/null
+++ b/examples/09-ai/03-custom-ai-menu-items/main.tsx
@@ -0,0 +1,11 @@
+// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
+import React from "react";
+import { createRoot } from "react-dom/client";
+import App from "./App.jsx";
+
+const root = createRoot(document.getElementById("root")!);
+root.render(
+
+
+
+);
diff --git a/examples/09-ai/03-custom-ai-menu-items/package.json b/examples/09-ai/03-custom-ai-menu-items/package.json
new file mode 100644
index 0000000000..6a2f4b2b77
--- /dev/null
+++ b/examples/09-ai/03-custom-ai-menu-items/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "@blocknote/example-ai-ai-menu-items",
+ "description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
+ "private": true,
+ "version": "0.12.4",
+ "scripts": {
+ "start": "vite",
+ "dev": "vite",
+ "build:prod": "tsc && vite build",
+ "preview": "vite preview"
+ },
+ "dependencies": {
+ "@blocknote/core": "latest",
+ "@blocknote/react": "latest",
+ "@blocknote/ariakit": "latest",
+ "@blocknote/mantine": "latest",
+ "@blocknote/shadcn": "latest",
+ "react": "^18.3.1",
+ "react-dom": "^18.3.1",
+ "@blocknote/xl-ai": "latest",
+ "@mantine/core": "^7.10.1",
+ "ai": "^4.1.0",
+ "@ai-sdk/openai": "^1.1.0",
+ "@ai-sdk/groq": "^1.1.0",
+ "react-icons": "^5.2.1",
+ "zustand": "^5.0.3"
+ },
+ "devDependencies": {
+ "@types/react": "^18.0.25",
+ "@types/react-dom": "^18.0.9",
+ "@vitejs/plugin-react": "^4.3.1",
+ "vite": "^5.3.4"
+ }
+}
\ No newline at end of file
diff --git a/examples/09-ai/03-custom-ai-menu-items/tsconfig.json b/examples/09-ai/03-custom-ai-menu-items/tsconfig.json
new file mode 100644
index 0000000000..dbe3e6f62d
--- /dev/null
+++ b/examples/09-ai/03-custom-ai-menu-items/tsconfig.json
@@ -0,0 +1,36 @@
+{
+ "__comment": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
+ "compilerOptions": {
+ "target": "ESNext",
+ "useDefineForClassFields": true,
+ "lib": [
+ "DOM",
+ "DOM.Iterable",
+ "ESNext"
+ ],
+ "allowJs": false,
+ "skipLibCheck": true,
+ "esModuleInterop": false,
+ "allowSyntheticDefaultImports": true,
+ "strict": true,
+ "forceConsistentCasingInFileNames": true,
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "jsx": "react-jsx",
+ "composite": true
+ },
+ "include": [
+ "."
+ ],
+ "__ADD_FOR_LOCAL_DEV_references": [
+ {
+ "path": "../../../packages/core/"
+ },
+ {
+ "path": "../../../packages/react/"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/examples/09-ai/03-custom-ai-menu-items/vite.config.ts b/examples/09-ai/03-custom-ai-menu-items/vite.config.ts
new file mode 100644
index 0000000000..f62ab20bc2
--- /dev/null
+++ b/examples/09-ai/03-custom-ai-menu-items/vite.config.ts
@@ -0,0 +1,32 @@
+// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
+import react from "@vitejs/plugin-react";
+import * as fs from "fs";
+import * as path from "path";
+import { defineConfig } from "vite";
+// import eslintPlugin from "vite-plugin-eslint";
+// https://vitejs.dev/config/
+export default defineConfig((conf) => ({
+ plugins: [react()],
+ optimizeDeps: {},
+ build: {
+ sourcemap: true,
+ },
+ resolve: {
+ alias:
+ conf.command === "build" ||
+ !fs.existsSync(path.resolve(__dirname, "../../packages/core/src"))
+ ? {}
+ : ({
+ // Comment out the lines below to load a built version of blocknote
+ // or, keep as is to load live from sources with live reload working
+ "@blocknote/core": path.resolve(
+ __dirname,
+ "../../packages/core/src/"
+ ),
+ "@blocknote/react": path.resolve(
+ __dirname,
+ "../../packages/react/src/"
+ ),
+ } as any),
+ },
+}));
diff --git a/examples/vanilla-js/react-vanilla-custom-blocks/package.json b/examples/vanilla-js/react-vanilla-custom-blocks/package.json
index e33728d57c..6349cd5574 100644
--- a/examples/vanilla-js/react-vanilla-custom-blocks/package.json
+++ b/examples/vanilla-js/react-vanilla-custom-blocks/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-react-vanilla-custom-blocks",
+ "name": "@blocknote/example-vanilla-js-react-vanilla-custom-blocks",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/vanilla-js/react-vanilla-custom-inline-content/package.json b/examples/vanilla-js/react-vanilla-custom-inline-content/package.json
index 132a7e48f8..e8664135bd 100644
--- a/examples/vanilla-js/react-vanilla-custom-inline-content/package.json
+++ b/examples/vanilla-js/react-vanilla-custom-inline-content/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-react-vanilla-custom-inline-content",
+ "name": "@blocknote/example-vanilla-js-react-vanilla-custom-inline-content",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/examples/vanilla-js/react-vanilla-custom-styles/App.tsx b/examples/vanilla-js/react-vanilla-custom-styles/App.tsx
index 96ddc2c4fe..3d64681178 100644
--- a/examples/vanilla-js/react-vanilla-custom-styles/App.tsx
+++ b/examples/vanilla-js/react-vanilla-custom-styles/App.tsx
@@ -4,6 +4,8 @@ import {
defaultStyleSpecs,
} from "@blocknote/core";
import "@blocknote/core/fonts/inter.css";
+import { BlockNoteView } from "@blocknote/mantine";
+import "@blocknote/mantine/style.css";
import {
FormattingToolbar,
FormattingToolbarController,
@@ -13,8 +15,6 @@ import {
useComponentsContext,
useCreateBlockNote,
} from "@blocknote/react";
-import { BlockNoteView } from "@blocknote/mantine";
-import "@blocknote/mantine/style.css";
const small = createStyleSpec(
{
diff --git a/examples/vanilla-js/react-vanilla-custom-styles/package.json b/examples/vanilla-js/react-vanilla-custom-styles/package.json
index 358013df6f..a3c95ac913 100644
--- a/examples/vanilla-js/react-vanilla-custom-styles/package.json
+++ b/examples/vanilla-js/react-vanilla-custom-styles/package.json
@@ -1,5 +1,5 @@
{
- "name": "@blocknote/example-react-vanilla-custom-styles",
+ "name": "@blocknote/example-vanilla-js-react-vanilla-custom-styles",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
diff --git a/package.json b/package.json
index 1a95339eb6..a4fa628456 100644
--- a/package.json
+++ b/package.json
@@ -1,4 +1,5 @@
{
+ "name": "root",
"devDependencies": {
"@nx/js": "20.6.4",
"@typescript-eslint/eslint-plugin": "^5.5.0",
@@ -16,7 +17,6 @@
"vitest": "^2.0.3",
"wait-on": "8.0.3"
},
- "name": "root",
"pnpm": {
"ignoredBuiltDependencies": [
"sharp",
diff --git a/packages/ariakit/src/input/TextInput.tsx b/packages/ariakit/src/input/TextInput.tsx
index 9da81c8f15..d4b9817f4a 100644
--- a/packages/ariakit/src/input/TextInput.tsx
+++ b/packages/ariakit/src/input/TextInput.tsx
@@ -15,13 +15,17 @@ export const TextInput = forwardRef<
className,
name,
label,
+ variant,
icon,
value,
autoFocus,
placeholder,
+ disabled,
onKeyDown,
onChange,
onSubmit,
+ autoComplete,
+ rightSection,
...rest
} = props;
@@ -33,16 +37,23 @@ export const TextInput = forwardRef<
- {children}
+ {/* Taken from Google Material Icons */}
+ {/* https://fonts.google.com/icons?selected=Material+Symbols+Rounded:progress_activity:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=load&icon.size=24&icon.color=%23e8eaed&icon.set=Material+Symbols&icon.style=Rounded&icon.platform=web */}
+
) move it forward so we include all closing tags (|)
+ while (end.parentOffset >= end.parent.nodeSize - 2 && end.depth > 0) {
+ end = tr.doc.resolve(end.pos + 1);
+ }
+
+ // if the end is at the start of an empty node (
|) move it backwards so we drop empty start tags (
|)
+ while (end.parentOffset === 0 && end.depth > 0) {
+ end = tr.doc.resolve(end.pos - 1);
+ }
+
+ // if the start is at the start of a node (
|) move it backwards so we include all open tags (|
)
+ while (start.parentOffset === 0 && start.depth > 0) {
+ start = tr.doc.resolve(start.pos - 1);
+ }
+
+ // if the start is at the end of a node (|
|) move it forwards so we drop all closing tags (|
+ {/* Taken from Google Material Icons */}
+ {/* https://fonts.google.com/icons?selected=Material+Symbols+Rounded:progress_activity:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=load&icon.size=24&icon.color=%23e8eaed&icon.set=Material+Symbols&icon.style=Rounded&icon.platform=web */}
+
);
});
diff --git a/packages/shadcn/src/toolbar/Toolbar.tsx b/packages/shadcn/src/toolbar/Toolbar.tsx
index 654a34ff72..a3bb007572 100644
--- a/packages/shadcn/src/toolbar/Toolbar.tsx
+++ b/packages/shadcn/src/toolbar/Toolbar.tsx
@@ -5,8 +5,7 @@ import { forwardRef } from "react";
import { cn } from "../lib/utils.js";
import { useShadCNComponentsContext } from "../ShadCNComponentsContext.js";
-type ToolbarProps = ComponentProps["FormattingToolbar"]["Root"] &
- ComponentProps["LinkToolbar"]["Root"];
+type ToolbarProps = ComponentProps["Generic"]["Toolbar"]["Root"];
export const Toolbar = forwardRef(
(props, ref) => {
@@ -42,8 +41,7 @@ export const Toolbar = forwardRef(
},
);
-type ToolbarButtonProps = ComponentProps["FormattingToolbar"]["Button"] &
- ComponentProps["LinkToolbar"]["Button"];
+type ToolbarButtonProps = ComponentProps["Generic"]["Toolbar"]["Button"];
export const ToolbarButton = forwardRef(
(props, ref) => {
diff --git a/packages/xl-ai-server/.env.example b/packages/xl-ai-server/.env.example
new file mode 100644
index 0000000000..719aa7c60a
--- /dev/null
+++ b/packages/xl-ai-server/.env.example
@@ -0,0 +1,5 @@
+TOKEN=
+GROQ_API_KEY=
+MISTRAL_API_KEY=
+OPENAI_API_KEY=
+MY_PROVIDER_API_KEY=
diff --git a/packages/xl-ai-server/README.md b/packages/xl-ai-server/README.md
new file mode 100644
index 0000000000..ca6c275232
--- /dev/null
+++ b/packages/xl-ai-server/README.md
@@ -0,0 +1,24 @@
+# BlockNote AI Server
+
+The BlockNote AI Server is a simple demo node.js ([Hono](http://hono.dev/)) Proxy server you can use to pass requests to third party LLM provider without exposing your LLM API keys on the client.
+
+The server exposes the endpoint `/ai?url=&provider=` which can handle LLM requests (e.g.: created with the [AI SDK](https://ai-sdk.dev/)). These are forwarded to `URL-TO-FETCH` with API keys loaded from environment variables.
+
+## Requirements
+
+Requirements:
+
+- `mkcert` for local testing over https ([instructions](https://web.dev/articles/how-to-use-local-https))
+
+## Configuration
+
+Configure your environment variables according to `.env.example`.
+
+## Running (dev mode):
+
+ mkcert localhost
+ pnpm run dev
+
+## Client Usage
+
+use `createBlockNoteAIClient` from `@blocknote/xl-ai` to create an API client to connect to the BlockNote AI Server / proxy.
diff --git a/packages/xl-ai-server/package.json b/packages/xl-ai-server/package.json
new file mode 100644
index 0000000000..18f81e528d
--- /dev/null
+++ b/packages/xl-ai-server/package.json
@@ -0,0 +1,71 @@
+{
+ "name": "@blocknote/xl-ai-server",
+ "homepage": "https://github.com/TypeCellOS/BlockNote",
+ "private": false,
+ "license": "AGPL-3.0 OR PROPRIETARY",
+ "version": "0.30.0",
+ "files": [
+ "dist",
+ "types",
+ "src"
+ ],
+ "keywords": [
+ "react",
+ "javascript",
+ "editor",
+ "typescript",
+ "prosemirror",
+ "wysiwyg",
+ "rich-text-editor",
+ "notion",
+ "yjs",
+ "block-based",
+ "tiptap"
+ ],
+ "description": "A \"Notion-style\" block-based extensible text editor built on top of Prosemirror and Tiptap.",
+ "type": "module",
+ "source": "src/index.ts",
+ "types": "./types/src/index.d.ts",
+ "main": "./dist/blocknote-xl-ai-server.umd.cjs",
+ "module": "./dist/blocknote-xl-ai-server.js",
+ "exports": {
+ ".": {
+ "types": "./types/src/index.d.ts",
+ "import": "./dist/blocknote-xl-ai-server.js",
+ "require": "./dist/blocknote-xl-ai-server.umd.cjs"
+ }
+ },
+ "scripts": {
+ "dev": "vite-node src/index.ts",
+ "build": "tsc && vite build",
+ "start": "node dist/blocknote-xl-ai-server.js",
+ "lint": "eslint src --max-warnings 0",
+ "clean": "rimraf dist && rimraf types"
+ },
+ "dependencies": {
+ "@hono/node-server": "^1.13.7",
+ "hono": "^4.6.12"
+ },
+ "devDependencies": {
+ "eslint": "^8.10.0",
+ "rimraf": "^5.0.5",
+ "rollup-plugin-webpack-stats": "^0.2.2",
+ "typescript": "^5.3.3",
+ "vite": "^5.3.4",
+ "vite-node": "^2.1.6",
+ "vite-plugin-eslint": "^1.8.1",
+ "vite-plugin-externalize-deps": "^0.8.0",
+ "vitest": "^2.0.3",
+ "undici": "^6"
+ },
+ "peerDependencies": {},
+ "eslintConfig": {
+ "extends": [
+ "../../.eslintrc.js"
+ ]
+ },
+ "publishConfig": {
+ "access": "public",
+ "registry": "https://registry.npmjs.org/"
+ }
+}
diff --git a/packages/xl-ai-server/src/index.ts b/packages/xl-ai-server/src/index.ts
new file mode 100644
index 0000000000..4d784b8d12
--- /dev/null
+++ b/packages/xl-ai-server/src/index.ts
@@ -0,0 +1,136 @@
+import { serve } from "@hono/node-server";
+import { Hono } from "hono";
+import { bearerAuth } from "hono/bearer-auth";
+import { cors } from "hono/cors";
+import { existsSync, readFileSync } from "node:fs";
+import { createSecureServer } from "node:http2";
+import { Agent, setGlobalDispatcher } from "undici";
+
+// make sure our fetch request uses HTTP/2
+setGlobalDispatcher(
+ new Agent({
+ allowH2: true,
+ }),
+);
+
+const ignoreHeadersRe = /^content-(?:encoding|length|range)$/i;
+
+// REC: we might be able to replace this by https://github.com/honojs/hono/pull/3589
+export const proxyFetch: typeof fetch = async (request, options) => {
+ const req = new Request(request, options);
+ req.headers.delete("accept-encoding"); // TBD: there may be cases where you want to explicitly specify
+ req.headers.delete("Origin");
+ const res = await fetch(req);
+
+ const headers: HeadersInit = [...res.headers.entries()].filter(
+ ([k]) => !ignoreHeadersRe.test(k) && k !== "strict-transport-security",
+ );
+
+ const readable = res.body;
+
+ // For debugging purposes, we can log the chunks as they stream:
+
+ // const { readable, writable } = new TransformStream({
+ // async transform(chunk, controller) {
+ // // Log each chunk as it passes through
+
+ // // optional, wait to test streaming mode
+ // // await new Promise((resolve) => setTimeout(resolve, 3000));
+
+ // console.log("Streaming chunk:", new TextDecoder().decode(chunk));
+ // controller.enqueue(chunk);
+ // },
+ // });
+
+ // // Pipe the response body through our transform stream
+ // res.body?.pipeTo(writable).catch((err) => {
+ // console.error("Error in stream:", err);
+ // });
+
+ return new Response(readable, {
+ ...res,
+ status: res.status,
+ statusText: res.statusText,
+ headers,
+ });
+};
+
+function getProviderInfo(provider: string) {
+ const envKey = `${provider.toUpperCase().replace(/-/g, "_")}_API_KEY`;
+ const key = process.env[envKey];
+ if (!key || !key.length) {
+ return "not-found";
+ }
+ return {
+ key,
+ header: provider === "anthropic" ? "x-api-key" : "Authorization",
+ };
+}
+
+const app = new Hono();
+
+app.use("/health", async (c) => {
+ return c.json({ status: "ok" });
+});
+
+if (process.env.TOKEN?.length) {
+ app.use("/ai/*", bearerAuth({ token: process.env.TOKEN }));
+} else {
+ // eslint-disable-next-line no-console
+ console.warn("no token set, ai requests will not be secured");
+}
+
+app.use("/ai", cors(), async (c) => {
+ const url = c.req.query("url");
+ if (!url) {
+ return c.json({ error: "url parameter is required" }, 400);
+ }
+
+ const provider = c.req.query("provider");
+ if (!provider) {
+ return c.json({ error: "provider parameter is required" }, 400);
+ }
+
+ const providerInfo = getProviderInfo(provider);
+
+ if (providerInfo === "not-found") {
+ return c.json(
+ {
+ error: `provider / key not found for provider ${provider}. Make sure to load correct env variables.`,
+ },
+ 404,
+ );
+ }
+
+ // eslint-disable-next-line no-console
+ console.log("Proxying request to", url);
+ const request = new Request(url, c.req.raw);
+ if (providerInfo.header === "Authorization") {
+ request.headers.set("Authorization", `Bearer ${providerInfo.key}`);
+ } else {
+ request.headers.set(providerInfo.header, `${providerInfo.key}`);
+ }
+
+ request.headers.set("x-api-key", `${providerInfo.key}`);
+ return proxyFetch(request);
+});
+
+const http2 = existsSync("localhost.pem");
+serve(
+ {
+ fetch: app.fetch,
+ createServer: http2 ? createSecureServer : undefined,
+
+ serverOptions: {
+ key: http2 ? readFileSync("localhost-key.pem") : undefined,
+ cert: http2 ? readFileSync("localhost.pem") : undefined,
+ },
+ port: Number(process.env.PORT) || 3000,
+ },
+ (info) => {
+ // eslint-disable-next-line no-console
+ console.log(
+ `Server is running on ${info.address}${info.port}, http2: ${http2}`,
+ );
+ },
+);
diff --git a/packages/xl-ai-server/tsconfig.json b/packages/xl-ai-server/tsconfig.json
new file mode 100644
index 0000000000..283e07431f
--- /dev/null
+++ b/packages/xl-ai-server/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "compilerOptions": {
+ "target": "ESNext",
+ "useDefineForClassFields": true,
+ "module": "ESNext",
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
+ "moduleResolution": "Node",
+ "jsx": "react-jsx",
+ "strict": true,
+ "sourceMap": true,
+ "resolveJsonModule": true,
+ "esModuleInterop": true,
+ "noEmit": false,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noImplicitReturns": true,
+ "outDir": "dist",
+ "declaration": true,
+ "declarationDir": "types",
+ "composite": true,
+ "skipLibCheck": true
+ },
+ "include": ["src"],
+ "references": []
+}
diff --git a/packages/xl-ai-server/vite.config.ts b/packages/xl-ai-server/vite.config.ts
new file mode 100644
index 0000000000..c2041c3105
--- /dev/null
+++ b/packages/xl-ai-server/vite.config.ts
@@ -0,0 +1,54 @@
+import * as path from "path";
+import { webpackStats } from "rollup-plugin-webpack-stats";
+import { defineConfig } from "vite";
+import pkg from "./package.json";
+// import eslintPlugin from "vite-plugin-eslint";
+
+// https://vitejs.dev/config/
+export default defineConfig((conf) => ({
+ test: {
+ environment: "jsdom",
+ setupFiles: ["./vitestSetup.ts"],
+ },
+ plugins: [webpackStats()],
+ // used so that vitest resolves the core package from the sources instead of the built version
+ resolve: {
+ alias:
+ conf.command === "build"
+ ? ({} as Record)
+ : ({
+ // load live from sources with live reload working
+ "@blocknote/core": path.resolve(__dirname, "../core/src/"),
+ } as Record),
+ },
+ build: {
+ sourcemap: true,
+ lib: {
+ entry: path.resolve(__dirname, "src/index.ts"),
+ name: "blocknote-xl-ai-server",
+ fileName: "blocknote-xl-ai-server",
+ },
+ rollupOptions: {
+ // make sure to externalize deps that shouldn't be bundled
+ // into your library
+ external: [
+ ...Object.keys({
+ ...pkg.dependencies,
+ ...pkg.peerDependencies,
+ ...pkg.devDependencies,
+ }),
+ "node:fs",
+ "node:http2",
+ ],
+ output: {
+ // Provide global variables to use in the UMD build
+ // for externalized deps
+ globals: {
+ react: "React",
+ "react-dom": "ReactDOM",
+ },
+ interop: "compat", // https://rollupjs.org/migration/#changed-defaults
+ },
+ },
+ },
+}));
diff --git a/packages/xl-ai/package.json b/packages/xl-ai/package.json
new file mode 100644
index 0000000000..2f32d4c054
--- /dev/null
+++ b/packages/xl-ai/package.json
@@ -0,0 +1,122 @@
+{
+ "name": "@blocknote/xl-ai",
+ "homepage": "https://github.com/TypeCellOS/BlockNote",
+ "private": false,
+ "sideEffects": [
+ "*.css"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/TypeCellOS/BlockNote.git",
+ "directory": "packages/xl-ai"
+ },
+ "license": "AGPL-3.0 OR PROPRIETARY",
+ "version": "0.30.0",
+ "files": [
+ "dist",
+ "types",
+ "src"
+ ],
+ "keywords": [
+ "ai",
+ "llm",
+ "react",
+ "javascript",
+ "editor",
+ "typescript",
+ "prosemirror",
+ "wysiwyg",
+ "rich-text-editor",
+ "notion",
+ "yjs",
+ "block-based",
+ "tiptap"
+ ],
+ "description": "A \"Notion-style\" block-based extensible text editor built on top of Prosemirror and Tiptap.",
+ "type": "module",
+ "source": "src/index.ts",
+ "types": "./types/src/index.d.ts",
+ "main": "./dist/blocknote-xl-ai.umd.cjs",
+ "module": "./dist/blocknote-xl-ai.js",
+ "exports": {
+ ".": {
+ "types": "./types/src/index.d.ts",
+ "import": "./dist/blocknote-xl-ai.js",
+ "require": "./dist/blocknote-xl-ai.umd.cjs"
+ },
+ "./style.css": {
+ "import": "./dist/style.css",
+ "require": "./dist/style.css",
+ "style": "./dist/style.css"
+ }
+ },
+ "scripts": {
+ "dev": "vite",
+ "build": "tsc --build && vite build",
+ "lint": "eslint src --max-warnings 0",
+ "test": "NODE_EXTRA_CA_CERTS=\"$(mkcert -CAROOT)/rootCA.pem\" vitest --run",
+ "test-watch": "NODE_EXTRA_CA_CERTS=\"$(mkcert -CAROOT)/rootCA.pem\" vitest watch",
+ "email": "email dev"
+ },
+ "dependencies": {
+ "@blocknote/prosemirror-suggest-changes": "^0.1.3",
+ "prosemirror-changeset": "^2.3.0",
+ "prosemirror-tables": "^1.6.4",
+ "prosemirror-transform": "^1.10.4",
+ "prosemirror-model": "^1.24.1",
+ "ai": "^4.3.15",
+ "@ai-sdk/openai-compatible": "^0.2.14",
+ "@ai-sdk/openai": "^1.3.22",
+ "@ai-sdk/groq": "^1.2.9",
+ "@ai-sdk/mistral": "^1.2.8",
+ "@blocknote/core": "workspace:*",
+ "@blocknote/mantine": "workspace:*",
+ "@blocknote/react": "workspace:*",
+ "@floating-ui/react": "^0.26.4",
+ "@tiptap/core": "^2.7.1",
+ "lodash.isequal": "^4.5.0",
+ "prosemirror-state": "^1.4.3",
+ "prosemirror-view": "^1.33.7",
+ "react": "^18",
+ "react-dom": "^18",
+ "react-icons": "^5.2.1",
+ "remark-parse": "^10.0.1",
+ "remark-stringify": "^10.0.2",
+ "unified": "^10.1.2",
+ "y-prosemirror": "^1.3.4",
+ "zustand": "^5.0.3"
+ },
+ "devDependencies": {
+ "@types/json-schema": "^7.0.15",
+ "@types/lodash.isequal": "^4.5.8",
+ "@types/diff": "^6.0.0",
+ "@types/json-diff": "^1.0.3",
+ "@types/react": "^18.0.25",
+ "@types/react-dom": "^18.0.9",
+ "@vitejs/plugin-react": "^4.3.1",
+ "eslint": "^8.10.0",
+ "@mswjs/interceptors": "^0.37.5",
+ "glob": "^10.3.10",
+ "headers-polyfill": "^4.0.3",
+ "msw": "^2.7.3",
+ "msw-snapshot": "^5.2.0",
+ "rimraf": "^5.0.5",
+ "rollup-plugin-webpack-stats": "^0.2.2",
+ "typescript": "^5.3.3",
+ "vite": "^5.3.4",
+ "vite-plugin-eslint": "^1.8.1",
+ "vite-plugin-externalize-deps": "^0.8.0",
+ "vitest": "^2.0.3",
+ "@vitest/runner": "^2.0.3",
+ "undici": "^6"
+ },
+ "peerDependencies": {
+ "react": "^18.0 || ^19.0 || >= 19.0.0-rc",
+ "react-dom": "^18.0 || ^19.0 || >= 19.0.0-rc"
+ },
+ "eslintConfig": {
+ "extends": [
+ "../../.eslintrc.js"
+ ]
+ }
+}
diff --git a/packages/xl-ai/src/AIExtension.ts b/packages/xl-ai/src/AIExtension.ts
new file mode 100644
index 0000000000..6c2a503a0d
--- /dev/null
+++ b/packages/xl-ai/src/AIExtension.ts
@@ -0,0 +1,361 @@
+import {
+ BlockNoteEditor,
+ BlockNoteExtension,
+ UnreachableCaseError,
+} from "@blocknote/core";
+import {
+ applySuggestions,
+ revertSuggestions,
+ suggestChanges,
+} from "@blocknote/prosemirror-suggest-changes";
+import { APICallError, LanguageModel, RetryError } from "ai";
+import { Plugin, PluginKey } from "prosemirror-state";
+import { fixTablesKey } from "prosemirror-tables";
+import { createStore, StoreApi } from "zustand/vanilla";
+import { doLLMRequest, LLMRequestOptions } from "./api/LLMRequest.js";
+import { LLMResponse } from "./api/LLMResponse.js";
+import { PromptBuilder } from "./api/formats/PromptBuilder.js";
+import { LLMFormat, llmFormats } from "./api/index.js";
+import { createAgentCursorPlugin } from "./plugins/AgentCursorPlugin.js";
+
+type MakeOptional = Omit & Partial>;
+
+type ReadonlyStoreApi = Pick<
+ StoreApi,
+ "getState" | "getInitialState" | "subscribe"
+>;
+
+type AIPluginState = {
+ /**
+ * zustand design considerations:
+ * - moved this to a nested object to have better typescript typing
+ * - if we'd do this without a nested object, then we could easily set "wrong" values,
+ * because "setState" takes a partial object (unless the second parameter "replace" = true),
+ * and thus we'd lose typescript's typing help
+ *
+ */
+ aiMenuState:
+ | ({
+ blockId: string;
+ } & (
+ | {
+ status: "error";
+ error: any;
+ }
+ | {
+ status: "user-input" | "thinking" | "ai-writing" | "user-reviewing";
+ }
+ ))
+ | "closed";
+
+ /**
+ * The previous response from the LLM, used for multi-step LLM calls
+ */
+ llmResponse?: LLMResponse;
+};
+
+/**
+ * configuration options for LLM calls that are shared across all calls by default
+ */
+type GlobalLLMRequestOptions = {
+ /**
+ * The default language model to use for LLM calls
+ */
+ model: LanguageModel;
+ /**
+ * The default data format to use for LLM calls
+ * "html" is recommended, the other formats are experimental
+ * @default html
+ */
+ dataFormat?: LLMFormat;
+ /**
+ * Whether to stream the LLM response
+ * @default true
+ */
+ stream?: boolean;
+ /**
+ * A function that can be used to customize the prompt sent to the LLM
+ * @default undefined
+ */
+ promptBuilder?: PromptBuilder;
+};
+
+type CallSpecificLLMRequestOptions = MakeOptional;
+
+const PLUGIN_KEY = new PluginKey(`blocknote-ai-plugin`);
+
+export class AIExtension extends BlockNoteExtension {
+ private previousRequestOptions: CallSpecificLLMRequestOptions | undefined;
+
+ public static name(): string {
+ return "ai";
+ }
+
+ // internal store including setters
+ private readonly _store = createStore()((_set) => ({
+ aiMenuState: "closed",
+ }));
+
+ /**
+ * Returns a read-only zustand store with the state of the AI Extension
+ */
+ public get store() {
+ // externally, don't expose setters (if we want to do so, expose `set` methods seperately)
+ return this._store as ReadonlyStoreApi;
+ }
+
+ /**
+ * Returns a zustand store with the global configuration of the AI Extension.
+ * These options are used by default across all LLM calls when calling {@link doLLMRequest}
+ */
+ public readonly options: ReturnType<
+ ReturnType<
+ typeof createStore<
+ MakeOptional, "promptBuilder">
+ >
+ >
+ >;
+
+ /**
+ * @internal use `createAIExtension` instead
+ */
+ constructor(
+ public readonly editor: BlockNoteEditor,
+ options: GlobalLLMRequestOptions & {
+ /**
+ * The name and color of the agent cursor
+ *
+ * @default { name: "AI", color: "#8bc6ff" }
+ */
+ agentCursor?: { name: string; color: string };
+ },
+ ) {
+ super();
+
+ this.options = createStore<
+ MakeOptional, "promptBuilder">
+ >()((_set) => ({
+ dataFormat: llmFormats.html,
+ stream: true,
+ ...options,
+ }));
+
+ this.addProsemirrorPlugin(
+ new Plugin({
+ key: PLUGIN_KEY,
+ filterTransaction: (tr) => {
+ const menuState = this.store.getState().aiMenuState;
+
+ if (menuState !== "closed" && menuState.status === "ai-writing") {
+ if (tr.getMeta(fixTablesKey)?.fixTables) {
+ // the fixtables plugin causes the steps between of the AI Agent to become invalid
+ // so we need to prevent it from running
+ // (we might need to filter out other / or maybe any transactions during the writing phase)
+ return false;
+ }
+ }
+ return true;
+ },
+ }),
+ );
+ this.addProsemirrorPlugin(suggestChanges());
+ this.addProsemirrorPlugin(
+ createAgentCursorPlugin(
+ options.agentCursor || { name: "AI", color: "#8bc6ff" },
+ ),
+ );
+ }
+
+ /**
+ * Open the AI menu at a specific block
+ */
+ public openAIMenuAtBlock(blockID: string) {
+ this.editor.setForceSelectionVisible(true);
+ this.editor.isEditable = false;
+ this._store.setState({
+ aiMenuState: {
+ blockId: blockID,
+ status: "user-input",
+ },
+ });
+ }
+
+ /**
+ * Close the AI menu
+ */
+ public closeAIMenu() {
+ this.previousRequestOptions = undefined;
+ this._store.setState({
+ aiMenuState: "closed",
+ llmResponse: undefined,
+ });
+ this.editor.setForceSelectionVisible(false);
+ this.editor.isEditable = true;
+ this.editor.focus();
+ }
+
+ /**
+ * Accept the changes made by the LLM
+ */
+ public acceptChanges() {
+ this.editor.exec(applySuggestions);
+ this.closeAIMenu();
+ }
+
+ /**
+ * Reject the changes made by the LLM
+ */
+ public rejectChanges() {
+ this.editor.exec(revertSuggestions);
+ this.closeAIMenu();
+ }
+
+ /**
+ * Retry the previous LLM call.
+ *
+ * Only valid if the current status is "error"
+ */
+ public async retry() {
+ const state = this.store.getState().aiMenuState;
+ if (
+ state === "closed" ||
+ state.status !== "error" ||
+ !this.previousRequestOptions
+ ) {
+ throw new Error("retry() is only valid when a previous response failed");
+ }
+ if (
+ state.error instanceof APICallError ||
+ state.error instanceof RetryError
+ ) {
+ // retry the previous call as-is, as there was a network error
+ return this.callLLM(this.previousRequestOptions);
+ } else {
+ // an error occurred while parsing / executing the previous LLM call
+ // give the LLM a chance to fix the error
+ // (Possible improvement: maybe this should be a system prompt instead of the userPrompt)
+ const errorMessage =
+ state.error instanceof Error
+ ? state.error.message
+ : String(state.error);
+
+ return this.callLLM({
+ userPrompt: `An error occured: ${errorMessage}
+ Please retry the previous user request.`,
+ });
+ }
+ }
+
+ /**
+ * Update the status of a call to an LLM
+ *
+ * @warning This method should usually only be used for advanced use-cases
+ * if you want to implement how an LLM call is executed. Usually, you should
+ * use {@link doLLMRequest} instead which will handle the status updates for you.
+ */
+ public setAIResponseStatus(
+ status:
+ | "user-input"
+ | "thinking"
+ | "ai-writing"
+ | "user-reviewing"
+ | {
+ status: "error";
+ error: any;
+ },
+ ) {
+ const aiMenuState = this.store.getState().aiMenuState;
+ if (aiMenuState === "closed") {
+ return; // TODO: log error?
+ }
+
+ if (status === "ai-writing") {
+ this.editor.setForceSelectionVisible(false);
+ }
+
+ if (typeof status === "object") {
+ if (status.status !== "error") {
+ throw new UnreachableCaseError(status.status);
+ }
+ this._store.setState({
+ aiMenuState: {
+ status: status.status,
+ error: status.error,
+ blockId: aiMenuState.blockId,
+ },
+ });
+ } else {
+ this._store.setState({
+ aiMenuState: {
+ status: status,
+ blockId: aiMenuState.blockId,
+ },
+ });
+ }
+ }
+
+ /**
+ * Execute a call to an LLM and apply the result to the editor
+ */
+ public async callLLM(opts: CallSpecificLLMRequestOptions) {
+ this.setAIResponseStatus("thinking");
+
+ try {
+ const requestOptions = {
+ ...this.options.getState(),
+ ...opts,
+ previousResponse: this.store.getState().llmResponse,
+ };
+ this.previousRequestOptions = requestOptions;
+
+ const ret = await doLLMRequest(this.editor, {
+ ...requestOptions,
+ onStart: () => {
+ this.setAIResponseStatus("ai-writing");
+ },
+ onBlockUpdate: (blockId: string) => {
+ // NOTE: does this setState with an anon object trigger unnecessary re-renders?
+ this._store.setState({
+ aiMenuState: {
+ blockId,
+ status: "ai-writing",
+ },
+ });
+ },
+ });
+
+ this._store.setState({
+ llmResponse: ret,
+ });
+
+ await ret.execute();
+
+ this.setAIResponseStatus("user-reviewing");
+ } catch (e) {
+ this.setAIResponseStatus({
+ status: "error",
+ error: e,
+ });
+ // eslint-disable-next-line no-console
+ console.warn("Error calling LLM", e);
+ }
+ }
+}
+
+/**
+ * Create a new AIExtension instance, this can be passed to the BlockNote editor via the `extensions` option
+ */
+export function createAIExtension(
+ options: ConstructorParameters[1],
+) {
+ return (editor: BlockNoteEditor) => {
+ return new AIExtension(editor, options);
+ };
+}
+
+/**
+ * Return the AIExtension instance from the editor
+ */
+export function getAIExtension(editor: BlockNoteEditor) {
+ return editor.extension(AIExtension);
+}
diff --git a/packages/xl-ai/src/api/LLMRequest.ts b/packages/xl-ai/src/api/LLMRequest.ts
new file mode 100644
index 0000000000..4dee3fcecb
--- /dev/null
+++ b/packages/xl-ai/src/api/LLMRequest.ts
@@ -0,0 +1,231 @@
+import { BlockNoteEditor } from "@blocknote/core";
+import { CoreMessage, generateObject, LanguageModelV1, streamObject } from "ai";
+import {
+ generateOperations,
+ streamOperations,
+} from "../streamTool/callLLMWithStreamTools.js";
+import { isEmptyParagraph } from "../util/emptyBlock.js";
+import { LLMResponse } from "./LLMResponse.js";
+import type { PromptBuilder } from "./formats/PromptBuilder.js";
+import { htmlBlockLLMFormat } from "./formats/html-blocks/htmlBlocks.js";
+import { LLMFormat } from "./index.js";
+
+export type LLMRequestOptions = {
+ /**
+ * The language model to use for the LLM call (AI SDK)
+ */
+ model: LanguageModelV1;
+ /**
+ * The user prompt to use for the LLM call
+ */
+ userPrompt: string;
+ /**
+ * Previous response from the LLM, used for multi-step LLM calls
+ */
+ previousResponse?: LLMResponse;
+ /**
+ * The default data format to use for LLM calls
+ * "html" is recommended, the other formats are experimental
+ * @default html format (`llm.html`)
+ */
+ dataFormat?: LLMFormat;
+ /**
+ * The `PromptBuilder` to use for the LLM call
+ *
+ * (A PromptBuilder is a function that takes a BlockNoteEditor and details about the user's prompt
+ * and turns it into an AI SDK `CoreMessage` array to be passed to the LLM)
+ *
+ * @default provided by the format (e.g. `llm.html.defaultPromptBuilder`)
+ */
+ promptBuilder?: PromptBuilder;
+ /**
+ * The maximum number of retries for the LLM call
+ *
+ * @default 2
+ */
+ maxRetries?: number;
+ /**
+ * Whether to use the editor selection for the LLM call
+ *
+ * @default true
+ */
+ useSelection?: boolean;
+ /**
+ * Defines whether the LLM can add, update, or delete blocks
+ *
+ * @default { add: true, update: true, delete: true }
+ */
+ defaultStreamTools?: {
+ /** Enable the add tool (default: true) */
+ add?: boolean;
+ /** Enable the update tool (default: true) */
+ update?: boolean;
+ /** Enable the delete tool (default: true) */
+ delete?: boolean;
+ };
+ /**
+ * Whether to stream the LLM response or not
+ *
+ * When streaming, we use the AI SDK `streamObject` function,
+ * otherwise, we use the AI SDK `generateObject` function.
+ *
+ * @default true
+ */
+ stream?: boolean;
+ /**
+ * If the user's cursor is in an empty paragraph, automatically delete it when the AI
+ * is starting to write.
+ *
+ * (This is used when a user starts typing `/ai` in an empty block)
+ *
+ * @default true
+ */
+ deleteEmptyCursorBlock?: boolean;
+ /**
+ * Callback when a specific block is updated by the LLM
+ *
+ * (used by `AIExtension` to update the `AIMenu` position)
+ */
+ onBlockUpdate?: (blockId: string) => void;
+ /**
+ * Callback when the AI Agent starts writing
+ */
+ onStart?: () => void;
+ /**
+ * Whether to add delays between text update operations, to make the AI simulate a human typing
+ *
+ * @default true
+ */
+ withDelays?: boolean;
+ /**
+ * Additional options to pass to the `generateObject` function
+ * (only used when `stream` is `false`)
+ */
+ _generateObjectOptions?: Partial>[0]>;
+ /**
+ * Additional options to pass to the `streamObject` function
+ * (only used when `stream` is `true`)
+ */
+ _streamObjectOptions?: Partial>[0]>;
+};
+
+/**
+ * Execute an LLM call and apply the result to the editor
+ *
+ * @param editor - The BlockNoteEditor the LLM should operate on
+ * @param opts - The options for the LLM call (@link {CallLLMOptions})
+ * @returns A `LLMResponse` object containing the LLM response which can be applied to the editor
+ */
+export async function doLLMRequest(
+ editor: BlockNoteEditor,
+ opts: LLMRequestOptions,
+): Promise {
+ const {
+ userPrompt,
+ useSelection,
+ deleteEmptyCursorBlock,
+ stream,
+ onStart,
+ withDelays,
+ dataFormat,
+ previousResponse,
+ ...rest
+ } = {
+ maxRetries: 2,
+ deleteEmptyCursorBlock: true,
+ stream: true,
+ withDelays: true,
+ dataFormat: htmlBlockLLMFormat,
+ ...opts,
+ };
+
+ const promptBuilder = opts.promptBuilder ?? dataFormat.defaultPromptBuilder;
+ const getStreamTools = dataFormat.getStreamTools;
+
+ const cursorBlock = useSelection
+ ? undefined
+ : editor.getTextCursorPosition().block;
+
+ const deleteCursorBlock: string | undefined =
+ cursorBlock && deleteEmptyCursorBlock && isEmptyParagraph(cursorBlock)
+ ? cursorBlock.id
+ : undefined;
+
+ const selectionInfo = useSelection
+ ? editor.getSelectionCutBlocks()
+ : undefined;
+
+ let previousMessages: CoreMessage[] | undefined = undefined;
+
+ if (previousResponse) {
+ previousMessages = previousResponse.messages;
+ /*
+ We currently insert these messages as "assistant" string messages.
+ When using Tools, the "official" pattern for this is to use a "tool_result" message.
+ We might need to switch to this, but it would require more research whether:
+ - we maybe should switch to streamText / generateText instead of streamObject / generateObject
+ (this has built in access to `response.messages` on the AI SDK level)
+ - but, we need to make research whether tool calls are always way to go.
+ generateObject / streamObject can also use structured outputs, and this
+ might be yielding better results than tool calls.
+
+ For now, this approach works ok.
+ */
+ previousMessages.push({
+ role: "assistant",
+ content:
+ "These are the operations returned by a previous LLM call: \n" +
+ JSON.stringify(
+ await previousResponse.llmResult.getGeneratedOperations(),
+ ),
+ });
+ }
+
+ const messages = await promptBuilder(editor, {
+ selectedBlocks: selectionInfo?.blocks,
+ userPrompt,
+ excludeBlockIds: deleteCursorBlock ? [deleteCursorBlock] : undefined,
+ previousMessages,
+ });
+
+ const streamTools = getStreamTools(
+ editor,
+ withDelays,
+ opts.defaultStreamTools,
+ selectionInfo
+ ? { from: selectionInfo._meta.startPos, to: selectionInfo._meta.endPos }
+ : undefined,
+ opts.onBlockUpdate,
+ );
+
+ let response:
+ | Awaited>>
+ | Awaited>>;
+
+ if (stream) {
+ response = await streamOperations(
+ streamTools,
+ {
+ messages,
+ ...rest,
+ },
+ () => {
+ if (deleteCursorBlock) {
+ editor.removeBlocks([deleteCursorBlock]);
+ }
+ onStart?.();
+ },
+ );
+ } else {
+ response = await generateOperations(streamTools, {
+ messages,
+ ...rest,
+ });
+ if (deleteCursorBlock) {
+ editor.removeBlocks([deleteCursorBlock]);
+ }
+ onStart?.();
+ }
+
+ return new LLMResponse(messages, response, streamTools);
+}
diff --git a/packages/xl-ai/src/api/LLMResponse.ts b/packages/xl-ai/src/api/LLMResponse.ts
new file mode 100644
index 0000000000..1321ab5b9d
--- /dev/null
+++ b/packages/xl-ai/src/api/LLMResponse.ts
@@ -0,0 +1,64 @@
+import { CoreMessage } from "ai";
+import { OperationsResult } from "../streamTool/callLLMWithStreamTools.js";
+import { StreamTool, StreamToolCall } from "../streamTool/streamTool.js";
+
+/**
+ * Result of an LLM call with stream tools that apply changes to a BlockNote Editor
+ */
+export class LLMResponse {
+ /**
+ * @internal
+ */
+ constructor(
+ /**
+ * The messages sent to the LLM
+ */
+ public readonly messages: CoreMessage[],
+ /**
+ * Result of the underlying LLM call. Use this to access operations the LLM decided to execute, but without applying them.
+ * (usually this is only used for advanced used cases or debugging)
+ */
+ public readonly llmResult: OperationsResult,
+
+ private readonly streamTools: StreamTool[],
+ ) {}
+
+ /**
+ * Apply the operations to the editor and return a stream of results.
+ *
+ * (this method consumes underlying streams in `llmResult`)
+ */
+ async *applyToolCalls() {
+ let currentStream: AsyncIterable<{
+ operation: StreamToolCall[]>;
+ isUpdateToPreviousOperation: boolean;
+ isPossiblyPartial: boolean;
+ }> = this.llmResult.operationsSource;
+ for (const tool of this.streamTools) {
+ currentStream = tool.execute(currentStream);
+ }
+ yield* currentStream;
+ }
+
+ /**
+ * Helper method to apply all operations to the editor if you're not interested in intermediate operations and results.
+ *
+ * (this method consumes underlying streams in `llmResult`)
+ */
+ public async execute() {
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ for await (const _result of this.applyToolCalls()) {
+ // no op
+ }
+ }
+
+ /**
+ * @internal
+ */
+ public async _logToolCalls() {
+ for await (const toolCall of this.llmResult.operationsSource) {
+ // eslint-disable-next-line no-console
+ console.log(JSON.stringify(toolCall, null, 2));
+ }
+ }
+}
diff --git a/packages/xl-ai/src/api/formats/PromptBuilder.ts b/packages/xl-ai/src/api/formats/PromptBuilder.ts
new file mode 100644
index 0000000000..5465e25dfd
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/PromptBuilder.ts
@@ -0,0 +1,46 @@
+import { Block, BlockNoteEditor } from "@blocknote/core";
+import { CoreMessage } from "ai";
+
+/*
+We want users to be able to easily customize the prompts send to an LLM,
+especially since different models might need slightly different prompts.
+
+For this, we use PromptBuilders that the
+
+Every format (html, markdown, json) has a default PromptBuilder that is used if no custom one is provided,
+which is also exposed as `llm.html.defaultPromptBuilder` etc. for possible reuse.
+*/
+
+/**
+ * The input passed to a PromptBuilder
+ */
+export type PromptBuilderInput = {
+ /**
+ * The ids of blocks that should be excluded from the prompt
+ * (e.g.: if `deleteEmptyCursorBlock` is true in the LLMRequest,
+ * this will be the id of the block that should be ignored)
+ */
+ excludeBlockIds?: string[];
+ /**
+ * The selection of the editor which the LLM should operate on
+ */
+ selectedBlocks?: Block[];
+ /**
+ * The user's prompt
+ */
+ userPrompt: string;
+ /**
+ * When following a multi-step conversation, or repairing a previous error,
+ * the previous messages that have been sent to the LLM
+ */
+ previousMessages?: Array;
+};
+
+/**
+ * A PromptBuilder is a function that takes a BlockNoteEditor and details about the user's promot
+ * and turns it into an array of CoreMessage to be passed to the LLM.
+ */
+export type PromptBuilder = (
+ editor: BlockNoteEditor,
+ opts: PromptBuilderInput,
+) => Promise>;
diff --git a/packages/xl-ai/src/api/formats/base-tools/createAddBlocksTool.ts b/packages/xl-ai/src/api/formats/base-tools/createAddBlocksTool.ts
new file mode 100644
index 0000000000..0cfa370a4f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/base-tools/createAddBlocksTool.ts
@@ -0,0 +1,290 @@
+import { BlockNoteEditor, insertBlocks, PartialBlock } from "@blocknote/core";
+import type { JSONSchema7 } from "json-schema";
+import {
+ AgentStep,
+ agentStepToTr,
+ delayAgentStep,
+ getStepsAsAgent,
+} from "../../../prosemirror/agent.js";
+import { updateToReplaceSteps } from "../../../prosemirror/changeset.js";
+import { RebaseTool } from "../../../prosemirror/rebaseTool.js";
+import { Result, streamTool } from "../../../streamTool/streamTool.js";
+import { isEmptyParagraph } from "../../../util/emptyBlock.js";
+import { validateBlockArray } from "./util/validateBlockArray.js";
+
+/**
+ * Factory function to create a StreamTool that adds blocks to the document.
+ */
+export function createAddBlocksTool(config: {
+ /**
+ * The description of the tool
+ */
+ description: string;
+ /**
+ * The schema of the tool
+ */
+ schema:
+ | {
+ block: JSONSchema7["items"];
+ $defs?: JSONSchema7["$defs"];
+ }
+ | ((editor: BlockNoteEditor) => {
+ block: JSONSchema7["items"];
+ $defs?: JSONSchema7["$defs"];
+ });
+ /**
+ * A function that can validate a block
+ */
+ validateBlock: (
+ block: any,
+ editor: BlockNoteEditor,
+ ) => Result;
+ /**
+ * The rebaseTool is used to get a projection of the document that
+ * the JSON Tool Calls will be applied to. By using the rebaseTool we can
+ * apply operations to a "projected" document, and then map them (rebase) to the actual document
+ *
+ * This is to:
+ * - apply operations without suggestion-marks to an editor that has suggestions in it
+ * (the projection should have the suggestions applied)
+ * - apply operations from a format that doesn't support all Block features (e.g.: markdown)
+ * (the projection should be the the BlockNote document without the unsupported features)
+ */
+ rebaseTool: (
+ id: string,
+ editor: BlockNoteEditor,
+ ) => Promise;
+ /**
+ * Converts the operation from `AddBlocksToolCall` to `AddBlocksToolCall>`
+ *
+ * When using these factories to create a tool for a different format (e.g.: HTML / MD),
+ * the `toJSONToolCall` function is used to convert the operation to a format that we can execute
+ */
+ toJSONToolCall: (
+ editor: BlockNoteEditor,
+ chunk: {
+ operation: AddBlocksToolCall;
+ isUpdateToPreviousOperation: boolean;
+ isPossiblyPartial: boolean;
+ },
+ ) => Promise> | undefined>;
+}) {
+ return (
+ editor: BlockNoteEditor,
+ options: {
+ idsSuffixed: boolean;
+ withDelays: boolean;
+ onBlockUpdate?: (blockId: string) => void;
+ },
+ ) => {
+ const schema =
+ typeof config.schema === "function"
+ ? config.schema(editor)
+ : config.schema;
+ return streamTool>({
+ name: "add",
+ description: config.description,
+ parameters: {
+ type: "object",
+ properties: {
+ referenceId: {
+ type: "string",
+ description: "MUST be an id of a block in the document",
+ },
+ position: {
+ type: "string",
+ enum: ["before", "after"],
+ description:
+ "`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)",
+ },
+ blocks: {
+ items: schema.block,
+ type: "array",
+ },
+ },
+ required: ["referenceId", "position", "blocks"],
+ $defs: schema.$defs,
+ },
+ validate: (operation) => {
+ if (operation.type !== "add") {
+ return {
+ ok: false,
+ error: "invalid operation type",
+ };
+ }
+
+ if (operation.position !== "before" && operation.position !== "after") {
+ return {
+ ok: false,
+ error: "invalid position",
+ };
+ }
+
+ if (!operation.referenceId || !operation.blocks) {
+ return {
+ ok: false,
+ error: "referenceId and blocks are required",
+ };
+ }
+
+ let referenceId = operation.referenceId;
+ if (options.idsSuffixed) {
+ if (!referenceId?.endsWith("$")) {
+ return {
+ ok: false,
+ error: "referenceId must end with $",
+ };
+ }
+
+ referenceId = referenceId.slice(0, -1);
+ }
+
+ const block = editor.getBlock(referenceId);
+
+ if (!block) {
+ return {
+ ok: false,
+ error: "referenceId not found",
+ };
+ }
+
+ const validatedBlocksResult = validateBlockArray(
+ operation.blocks,
+ (block) => config.validateBlock(block, editor),
+ );
+
+ if (!validatedBlocksResult.ok) {
+ return validatedBlocksResult;
+ }
+
+ return {
+ ok: true,
+ value: {
+ type: operation.type,
+ referenceId,
+ position: operation.position,
+ blocks: validatedBlocksResult.value,
+ },
+ };
+ },
+ // Note: functionality mostly tested in jsontools.test.ts
+ // would be nicer to add a direct unit test
+ execute: async function* (operationsStream) {
+ // An add operation has some complexity:
+ // - it can add multiple blocks in 1 operation
+ // (this is needed because you need an id as reference block - and if you want to insert multiple blocks you can only use an existing block as reference id)
+ // - when streaming, the first time we encounter a block to add, it's an "insert" operation, but after that (i.e.: more characters are being streamed in)
+ // it's an update operation (i.e.: update the previously added block)
+
+ // keep track of added block ids to be able to update blocks that have already been added
+ let addedBlockIds: string[] = [];
+
+ const referenceIdMap: Record = {}; // TODO: unit test
+
+ for await (const chunk of operationsStream) {
+ if (!chunk.isUpdateToPreviousOperation) {
+ // we have a new operation, reset the added block ids
+ addedBlockIds = [];
+ }
+
+ if (chunk.operation.type !== "add") {
+ // pass through non-add operations
+ yield chunk;
+ continue;
+ }
+
+ const operation = chunk.operation as AddBlocksToolCall;
+
+ const jsonToolCall = await config.toJSONToolCall(editor, chunk);
+
+ if (!jsonToolCall) {
+ continue;
+ }
+
+ if (
+ chunk.isPossiblyPartial &&
+ isEmptyParagraph(
+ jsonToolCall.blocks[jsonToolCall.blocks.length - 1],
+ )
+ ) {
+ // for example, a parsing just "
" would first result in an empty paragraph,
+ // wait for more content before adding the block
+ continue;
+ }
+
+ for (let i = 0; i < jsonToolCall.blocks.length; i++) {
+ const block = jsonToolCall.blocks[i];
+ const doc = editor.prosemirrorState.doc;
+ const tr = editor.prosemirrorState.tr;
+
+ let agentSteps: AgentStep[] = [];
+ if (i < addedBlockIds.length) {
+ // we have already added this block, so we need to update it
+ const tool = await config.rebaseTool(addedBlockIds[i], editor);
+ const steps = updateToReplaceSteps(
+ {
+ id: addedBlockIds[i],
+ block,
+ },
+ tool.doc,
+ false,
+ );
+
+ const inverted = steps.map((step) => step.map(tool.invertMap)!);
+ agentSteps = getStepsAsAgent(doc, editor.pmSchema, inverted);
+ // don't spend time "selecting" the block as an agent, as we're continuing a previous update
+ agentSteps = agentSteps.filter((step) => step.type !== "select");
+ } else {
+ // we are adding a new block, so we need to insert it
+ const mappedReferenceId =
+ operation.position === "after"
+ ? referenceIdMap[operation.referenceId]
+ : undefined;
+
+ const ret = insertBlocks(
+ tr,
+ [block],
+ i > 0
+ ? addedBlockIds[i - 1]
+ : mappedReferenceId || operation.referenceId,
+ i > 0 ? "after" : operation.position,
+ );
+ addedBlockIds.push(...ret.map((r) => r.id));
+ agentSteps = getStepsAsAgent(doc, editor.pmSchema, tr.steps);
+ }
+
+ if (agentSteps.find((step) => step.type === "replace")) {
+ // throw new Error("unexpected: replace step in add operation");
+ // this is unexpected but we've been able to see this when:
+ // adding a list item, because
first gets parsed as paragraph, that then gets turned into a list
+ }
+
+ for (const step of agentSteps) {
+ if (options.withDelays) {
+ await delayAgentStep(step);
+ }
+ editor.transact((tr) => {
+ agentStepToTr(tr, step);
+ });
+ options.onBlockUpdate?.(addedBlockIds[i]);
+ }
+ }
+
+ if (!chunk.isPossiblyPartial) {
+ if (operation.position === "after") {
+ referenceIdMap[operation.referenceId] =
+ addedBlockIds[addedBlockIds.length - 1];
+ }
+ }
+ }
+ },
+ });
+ };
+}
+
+export type AddBlocksToolCall = {
+ type: "add";
+ referenceId: string;
+ position: "before" | "after";
+ blocks: T[];
+};
diff --git a/packages/xl-ai/src/api/formats/base-tools/createUpdateBlockTool.ts b/packages/xl-ai/src/api/formats/base-tools/createUpdateBlockTool.ts
new file mode 100644
index 0000000000..4a6d32171e
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/base-tools/createUpdateBlockTool.ts
@@ -0,0 +1,268 @@
+import { BlockNoteEditor, PartialBlock, trackPosition } from "@blocknote/core";
+import type { JSONSchema7 } from "json-schema";
+import {
+ agentStepToTr,
+ delayAgentStep,
+ getStepsAsAgent,
+} from "../../../prosemirror/agent.js";
+import { updateToReplaceSteps } from "../../../prosemirror/changeset.js";
+import { RebaseTool } from "../../../prosemirror/rebaseTool.js";
+import {
+ Result,
+ StreamTool,
+ streamTool,
+ StreamToolCall,
+} from "../../../streamTool/streamTool.js";
+
+export type UpdateBlockToolCall = {
+ type: "update";
+ id: string;
+ block: T;
+};
+
+/**
+ * Factory function to create a StreamTool that Updates blocks in the document.
+ */
+export function createUpdateBlockTool(config: {
+ /**
+ * The description of the tool
+ */
+ description: string;
+ /**
+ * The schema of the tool
+ */
+ schema:
+ | {
+ block: JSONSchema7;
+ $defs?: JSONSchema7["$defs"];
+ }
+ | ((editor: BlockNoteEditor) => {
+ block: JSONSchema7;
+ $defs?: JSONSchema7["$defs"];
+ });
+ /**
+ * A function that can validate a block
+ */
+ validateBlock: (
+ block: any,
+ editor: BlockNoteEditor,
+ fallbackType?: string,
+ ) => Result;
+ /**
+ * The rebaseTool is used to get a projection of the document that
+ * the JSON Tool Calls will be applied to. By using the rebaseTool we can
+ * apply operations to a "projected" document, and then map them (rebase) to the actual document
+ *
+ * This is to:
+ * - apply operations without suggestion-marks to an editor that has suggestions in it
+ * (the projection should have the suggestions applied)
+ * - apply operations from a format that doesn't support all Block features (e.g.: markdown)
+ * (the projection should be the the BlockNote document without the unsupported features)
+ */
+ rebaseTool: (
+ id: string,
+ editor: BlockNoteEditor,
+ ) => Promise;
+ /**
+ * Converts the operation from `AddBlocksToolCall` to `AddBlocksToolCall>`
+ *
+ * When using these factories to create a tool for a different format (e.g.: HTML / MD),
+ * the `toJSONToolCall` function is used to convert the operation to a format that we can execute
+ */
+ toJSONToolCall: (
+ editor: BlockNoteEditor,
+ chunk: {
+ operation: UpdateBlockToolCall;
+ isUpdateToPreviousOperation: boolean;
+ isPossiblyPartial: boolean;
+ },
+ ) => Promise> | undefined>;
+}) {
+ return (
+ editor: BlockNoteEditor,
+ options: {
+ idsSuffixed: boolean;
+ withDelays: boolean;
+ updateSelection?: {
+ from: number;
+ to: number;
+ };
+ onBlockUpdate?: (blockId: string) => void;
+ },
+ ) => {
+ const schema =
+ typeof config.schema === "function"
+ ? config.schema(editor)
+ : config.schema;
+ return streamTool>({
+ name: "update",
+ description: config.description,
+ parameters: {
+ type: "object",
+ properties: {
+ id: {
+ type: "string",
+ description: "id of block to update",
+ },
+ block: schema.block,
+ },
+ required: ["id", "block"],
+ $defs: schema.$defs,
+ },
+ validate: (operation) => {
+ if (operation.type !== "update") {
+ return {
+ ok: false,
+ error: "invalid operation type",
+ };
+ }
+
+ if (!operation.id) {
+ return {
+ ok: false,
+ error: "id is required",
+ };
+ }
+
+ let id = operation.id;
+ if (options.idsSuffixed) {
+ if (!id?.endsWith("$")) {
+ return {
+ ok: false,
+ error: "id must end with $",
+ };
+ }
+
+ id = id.slice(0, -1);
+ }
+
+ if (!operation.block) {
+ return {
+ ok: false,
+ error: "block is required",
+ };
+ }
+
+ const block = editor.getBlock(id);
+
+ if (!block) {
+ // eslint-disable-next-line no-console
+ console.error("BLOCK NOT FOUND", id);
+ return {
+ ok: false,
+ error: "block not found",
+ };
+ }
+
+ const ret = config.validateBlock(operation.block, editor, block.type);
+
+ if (!ret.ok) {
+ return ret;
+ }
+
+ return {
+ ok: true,
+ value: {
+ type: operation.type,
+ id,
+ block: ret.value,
+ },
+ };
+ },
+ // Note: functionality mostly tested in jsontools.test.ts
+ // would be nicer to add a direct unit test
+ execute: async function* (
+ operationsStream: AsyncIterable<{
+ operation: StreamToolCall[]>;
+ isUpdateToPreviousOperation: boolean;
+ isPossiblyPartial: boolean;
+ }>,
+ ) {
+ const STEP_SIZE = 50;
+ let minSize = STEP_SIZE;
+ const selectionPositions = options.updateSelection
+ ? {
+ from: trackPosition(editor, options.updateSelection.from),
+ to: trackPosition(editor, options.updateSelection.to),
+ }
+ : undefined;
+
+ for await (const chunk of operationsStream) {
+ if (chunk.operation.type !== "update") {
+ // pass through non-update operations
+ yield chunk;
+ continue;
+ }
+
+ const operation = chunk.operation as UpdateBlockToolCall;
+
+ if (chunk.isPossiblyPartial) {
+ const size = JSON.stringify(operation.block).length;
+ if (size < minSize) {
+ continue;
+ } else {
+ // increase minSize for next chunk
+ minSize = size + STEP_SIZE;
+ }
+ } else {
+ // reset for next chunk
+ minSize = STEP_SIZE;
+ }
+
+ // REC: we could investigate whether we can use a single rebasetool across operations instead of
+ // creating a new one every time (possibly expensive)
+ const tool = await config.rebaseTool(operation.id, editor);
+
+ const fromPos = selectionPositions
+ ? tool.invertMap.invert().map(selectionPositions.from())
+ : undefined;
+
+ const toPos = selectionPositions
+ ? tool.invertMap.invert().map(selectionPositions.to())
+ : undefined;
+
+ const jsonToolCall = await config.toJSONToolCall(editor, chunk);
+ if (!jsonToolCall) {
+ continue;
+ }
+
+ const steps = updateToReplaceSteps(
+ jsonToolCall,
+ tool.doc,
+ chunk.isPossiblyPartial,
+ fromPos,
+ toPos,
+ );
+
+ if (steps.length === 1 && chunk.isPossiblyPartial) {
+ // when replacing a larger piece of text (try translating a 3 paragraph document), we want to do this as one single operation
+ // we don't want to do this "sentence-by-sentence"
+
+ // if there's only a single replace step to be done and we're partial, let's wait for more content
+
+ // REC: unit test this and see if it's still needed even if we pass `dontReplaceContentAtEnd` to `updateToReplaceSteps`
+ continue;
+ }
+
+ const inverted = steps.map((step) => step.map(tool.invertMap)!);
+
+ const agentSteps = getStepsAsAgent(
+ editor.prosemirrorState.doc,
+ editor.pmSchema,
+ inverted,
+ );
+
+ for (const step of agentSteps) {
+ if (options.withDelays) {
+ await delayAgentStep(step);
+ }
+ editor.transact((tr) => {
+ agentStepToTr(tr, step);
+ });
+ options.onBlockUpdate?.(operation.id);
+ }
+ }
+ },
+ });
+ };
+}
diff --git a/packages/xl-ai/src/api/formats/base-tools/delete.ts b/packages/xl-ai/src/api/formats/base-tools/delete.ts
new file mode 100644
index 0000000000..cca1faabd1
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/base-tools/delete.ts
@@ -0,0 +1,115 @@
+import { BlockNoteEditor, removeAndInsertBlocks } from "@blocknote/core";
+import {
+ agentStepToTr,
+ delayAgentStep,
+ getStepsAsAgent,
+} from "../../../prosemirror/agent.js";
+import { streamTool } from "../../../streamTool/streamTool.js";
+
+/**
+ * Factory function to create a StreamTool that deletes a block from the document.
+ */
+export const deleteBlockTool = (
+ editor: BlockNoteEditor,
+ options: {
+ idsSuffixed: boolean;
+ withDelays: boolean;
+ onBlockUpdate?: (blockId: string) => void;
+ },
+) =>
+ streamTool({
+ name: "delete",
+ description: "Delete a block",
+ parameters: {
+ type: "object",
+ properties: {
+ id: {
+ type: "string",
+ description: "id of block to delete",
+ },
+ },
+ required: ["id"],
+ },
+ validate: (operation) => {
+ if (operation.type !== "delete") {
+ return {
+ ok: false,
+ error: "invalid operation type",
+ };
+ }
+
+ if (!operation.id) {
+ return {
+ ok: false,
+ error: "id is required",
+ };
+ }
+
+ let id = operation.id;
+ if (options.idsSuffixed) {
+ if (!id?.endsWith("$")) {
+ return {
+ ok: false,
+ error: "id must end with $",
+ };
+ }
+
+ id = id.slice(0, -1);
+ }
+
+ const block = editor.getBlock(id);
+
+ if (!block) {
+ return {
+ ok: false,
+ error: "block not found",
+ };
+ }
+
+ return {
+ ok: true,
+ value: {
+ type: "delete", // TODO
+ id,
+ },
+ };
+ },
+ // Note: functionality mostly tested in jsontools.test.ts
+ // would be nicer to add a direct unit test
+ execute: async function* (operationsStream) {
+ for await (const chunk of operationsStream) {
+ if (chunk.operation.type !== "delete") {
+ // pass through non-delete operations
+ yield chunk;
+ continue;
+ }
+
+ const operation = chunk.operation as DeleteBlockToolCall;
+
+ const tr = editor.prosemirrorState.tr;
+
+ removeAndInsertBlocks(tr, [operation.id], []);
+
+ const agentSteps = getStepsAsAgent(
+ editor.prosemirrorState.doc,
+ editor.pmSchema,
+ tr.steps,
+ );
+
+ for (const step of agentSteps) {
+ if (options.withDelays) {
+ await delayAgentStep(step);
+ }
+ editor.transact((tr) => {
+ agentStepToTr(tr, step);
+ });
+ options.onBlockUpdate?.(operation.id);
+ }
+ }
+ },
+ });
+
+export type DeleteBlockToolCall = {
+ type: "delete";
+ id: string;
+};
diff --git a/packages/xl-ai/src/api/formats/base-tools/util/validateBlockArray.ts b/packages/xl-ai/src/api/formats/base-tools/util/validateBlockArray.ts
new file mode 100644
index 0000000000..7f9dff6f6f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/base-tools/util/validateBlockArray.ts
@@ -0,0 +1,32 @@
+import { DeepPartial } from "ai";
+import { Result } from "../../../../streamTool/streamTool.js";
+
+export function validateBlockArray(
+ inputArray: DeepPartial>,
+ validateItem: (item: DeepPartial) => Result,
+): Result {
+ if (!inputArray || !Array.isArray(inputArray) || inputArray.length === 0) {
+ return {
+ ok: false,
+ error: "blocks is required",
+ };
+ }
+
+ const validatedBlocks: U[] = [];
+
+ for (const item of inputArray) {
+ const validationResult = validateItem(item as DeepPartial);
+ if (!validationResult.ok) {
+ return {
+ ok: false,
+ error: `Invalid block: ${validationResult.error}`,
+ };
+ }
+ validatedBlocks.push(validationResult.value);
+ }
+
+ return {
+ ok: true,
+ value: validatedBlocks,
+ };
+}
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/Add heading (h1) and code block_1_112bacb4ae22459e8e8b87c510a5a1ab.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/Add heading (h1) and code block_1_112bacb4ae22459e8e8b87c510a5a1ab.json
new file mode 100644
index 0000000000..ff7de6f5a5
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/Add heading (h1) and code block_1_112bacb4ae22459e8e8b87c510a5a1ab.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"at the end of doc, add a heading `Code` and a javascript code block with `console.log('hello world');`\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-ec40f7c0b274499f8c68dfc3186fdfbf\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-210790e35fc74749b75e1558ab0101e0\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"add\\\", \\\"referenceId\\\": \\\"ref2$\\\", \\\"position\\\": \\\"after\\\", \\\"blocks\\\": [\\\"
Code
\\\", \\\"
console.log('hello world');
\\\"]}] }\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169489,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":59,\"prompt_tokens\":1026,\"total_tokens\":1085,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add a list (end)_1_fd2cdf7edb597b5eee87ae1b4c9d8a9e.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add a list (end)_1_fd2cdf7edb597b5eee87ae1b4c9d8a9e.json
new file mode 100644
index 0000000000..6c0112dd36
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add a list (end)_1_fd2cdf7edb597b5eee87ae1b4c9d8a9e.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a list with the items 'Apples' and 'Bananas' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-c4ac36bf49814b25b694a205209509fc\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-04e44de6a8c044f5a41a0ae4285c3957\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"add\\\", \\\"referenceId\\\": \\\"ref2$\\\", \\\"position\\\": \\\"after\\\", \\\"blocks\\\": [\\\"
Apples
\\\", \\\"
Bananas
\\\"]}] }\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169487,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":55,\"prompt_tokens\":1019,\"total_tokens\":1074,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add a new paragraph (end)_1_f9f8cec49b3218519501c03ff5c4a3ba.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add a new paragraph (end)_1_f9f8cec49b3218519501c03ff5c4a3ba.json
new file mode 100644
index 0000000000..9edfa5d6a0
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add a new paragraph (end)_1_f9f8cec49b3218519501c03ff5c4a3ba.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-de4615e533824f098ad3dfc24150bfac\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-6c25776533b748c5a78e13dda4b79b4e\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"add\\\", \\\"referenceId\\\": \\\"ref2$\\\", \\\"position\\\": \\\"after\\\", \\\"blocks\\\": [\\\"
You look great today!
\\\"]}] }\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169486,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":40,\"prompt_tokens\":1017,\"total_tokens\":1057,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add a new paragraph (start)_1_d152c585ba7d2fa6e68b1d4b063f266c.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add a new paragraph (start)_1_d152c585ba7d2fa6e68b1d4b063f266c.json
new file mode 100644
index 0000000000..8f444d3742
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add a new paragraph (start)_1_d152c585ba7d2fa6e68b1d4b063f266c.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' before the first sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-a8a63b1b8fd842b7a4b95fe1ef392563\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-854f46b70ff44f2392df1e6bbff3321d\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"add\\\", \\\"referenceId\\\": \\\"ref1$\\\", \\\"position\\\": \\\"before\\\", \\\"blocks\\\": [\\\"
You look great today!
\\\"]}] }\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169395,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":40,\"prompt_tokens\":1017,\"total_tokens\":1057,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (streaming)/add a new paragraph (start)_1_ae61114b97c12fbf57d14d6c64ffd647.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (streaming)/add a new paragraph (start)_1_ae61114b97c12fbf57d14d6c64ffd647.json
new file mode 100644
index 0000000000..c37c2d1467
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (streaming)/add a new paragraph (start)_1_ae61114b97c12fbf57d14d6c64ffd647.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' before the first sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\" [{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\" \\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"\\\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\" \\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\" \\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"$\\\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\" \\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\" \\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"before\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"\\\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\" \\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\" [\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\">You\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\" look\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\" great\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\" today\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"\\\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"}]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\" }\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-ef5de584b13243d7be4fdacfbba056cc\",\"object\":\"chat.completion.chunk\",\"created\":1747169371,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"name\":\"json\",\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":\"stop\",\"stop_reason\":null}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/Add heading (h1) and code block_1_c9a31b6237ae08647b85c7348edd052f.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/Add heading (h1) and code block_1_c9a31b6237ae08647b85c7348edd052f.json
new file mode 100644
index 0000000000..0b093f96ec
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/Add heading (h1) and code block_1_c9a31b6237ae08647b85c7348edd052f.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"at the end of doc, add a heading `Code` and a javascript code block with `console.log('hello world');`\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-ce0f0554-8187-4ed4-9666-a56145673eb9\",\"object\":\"chat.completion\",\"created\":1747170025,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_7629\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"\\u003ch1\\u003eCode\\u003c/h1\\u003e\\\",\\\"\\u003cpre\\u003e\\u003ccode data-language=\\\\\\\"javascript\\\\\\\"\\u003econsole.log('hello world');\\u003c/code\\u003e\\u003c/pre\\u003e\\\"]}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.09505998100000002,\"prompt_tokens\":842,\"prompt_time\":0.054691882,\"completion_tokens\":55,\"completion_time\":0.2,\"total_tokens\":897,\"total_time\":0.254691882},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_3f3b593e33\",\"x_groq\":{\"id\":\"req_01jv5q5r0ff1erzqp9x2mt7vbc\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/Add heading and code block_1_c9a31b6237ae08647b85c7348edd052f.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/Add heading and code block_1_c9a31b6237ae08647b85c7348edd052f.json
new file mode 100644
index 0000000000..5084073956
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/Add heading and code block_1_c9a31b6237ae08647b85c7348edd052f.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"at the end of doc, add a heading `Code` and a javascript code block with `console.log('hello world');`\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-e9e28157-bc5c-471d-b273-1d66bac076e2\",\"object\":\"chat.completion\",\"created\":1747168998,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_vgf8\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"\\u003ch1\\u003eCode\\u003c/h1\\u003e\\\",\\\"\\u003cpre\\u003e\\u003ccode data-language=\\\\\\\"javascript\\\\\\\"\\u003econsole.log('hello world');\\u003c/code\\u003e\\u003c/pre\\u003e\\\"]}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.11221671899999999,\"prompt_tokens\":842,\"prompt_time\":0.054762096,\"completion_tokens\":55,\"completion_time\":0.2,\"total_tokens\":897,\"total_time\":0.254762096},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_9a8b91ba77\",\"x_groq\":{\"id\":\"req_01jv5p6da8e0asd5d2f47hx2q4\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add a list (end)_1_db45f2ba8778e15e8a5f7a320508be46.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add a list (end)_1_db45f2ba8778e15e8a5f7a320508be46.json
new file mode 100644
index 0000000000..35b3203366
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add a list (end)_1_db45f2ba8778e15e8a5f7a320508be46.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a list with the items 'Apples' and 'Bananas' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-4fe27609-db38-47c6-8e40-48f8cc6bb169\",\"object\":\"chat.completion\",\"created\":1747168998,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_ap0z\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"\\u003cul\\u003e\\u003cli\\u003eApples\\u003c/li\\u003e\\u003c/ul\\u003e\\\",\\\"\\u003cul\\u003e\\u003cli\\u003eBananas\\u003c/li\\u003e\\u003c/ul\\u003e\\\"]}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.09519743500000001,\"prompt_tokens\":835,\"prompt_time\":0.06535181,\"completion_tokens\":51,\"completion_time\":0.185454545,\"total_tokens\":886,\"total_time\":0.250806355},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_9a8b91ba77\",\"x_groq\":{\"id\":\"req_01jv5p6ctyezfvxb69h1pmzenh\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add a new paragraph (end)_1_f3eaf50ddad718f55acaa05dcc1a2809.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add a new paragraph (end)_1_f3eaf50ddad718f55acaa05dcc1a2809.json
new file mode 100644
index 0000000000..6b355e4a37
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add a new paragraph (end)_1_f3eaf50ddad718f55acaa05dcc1a2809.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-75b980c7-cf5c-4532-9353-ee4e145eb7bf\",\"object\":\"chat.completion\",\"created\":1747168998,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_gpqx\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"\\u003cp\\u003eYou look great today!\\u003c/p\\u003e\\\"]}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.109649134,\"prompt_tokens\":833,\"prompt_time\":0.063162432,\"completion_tokens\":35,\"completion_time\":0.127272727,\"total_tokens\":868,\"total_time\":0.190435159},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_9a8b91ba77\",\"x_groq\":{\"id\":\"req_01jv5p6cgdezf8n2akntvyqk38\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add a new paragraph (start)_1_33db3205ea17e8f6ea3a5e2728b6f10e.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add a new paragraph (start)_1_33db3205ea17e8f6ea3a5e2728b6f10e.json
new file mode 100644
index 0000000000..861e5d15a8
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add a new paragraph (start)_1_33db3205ea17e8f6ea3a5e2728b6f10e.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' before the first sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-8178d9b2-0922-44f7-b9bf-7ced73e9c70d\",\"object\":\"chat.completion\",\"created\":1747168997,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_4mhc\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref1$\\\",\\\"position\\\":\\\"before\\\",\\\"blocks\\\":[\\\"\\u003cp\\u003eYou look great today!\\u003c/p\\u003e\\\"]}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.26469998899999997,\"prompt_tokens\":833,\"prompt_time\":0.118430617,\"completion_tokens\":35,\"completion_time\":0.127272727,\"total_tokens\":868,\"total_time\":0.245703344},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_4e32347616\",\"x_groq\":{\"id\":\"req_01jv5p6bxke9bs55wxz3pnh86s\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/Add heading (h1) and code block_1_5790f7702887daff99c884204e6ae3df.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/Add heading (h1) and code block_1_5790f7702887daff99c884204e6ae3df.json
new file mode 100644
index 0000000000..c68d8e18ef
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/Add heading (h1) and code block_1_5790f7702887daff99c884204e6ae3df.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"at the end of doc, add a heading `Code` and a javascript code block with `console.log('hello world');`\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-c1717121-d770-449f-abed-8d926470bc4c\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5q5qchfwmv4hx0354zcmdj\"}}\n\ndata: {\"id\":\"chatcmpl-c1717121-d770-449f-abed-8d926470bc4c\",\"object\":\"chat.completion.chunk\",\"created\":1747170025,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_v8zn\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"\\u003ch1\\u003eCode\\u003c/h1\\u003e\\\",\\\"\\u003cpre\\u003e\\u003ccode data-language=\\\\\\\"javascript\\\\\\\"\\u003econsole.log('hello world');\\u003c/code\\u003e\\u003c/pre\\u003e\\\"]}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-c1717121-d770-449f-abed-8d926470bc4c\",\"object\":\"chat.completion.chunk\",\"created\":1747170025,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5q5qchfwmv4hx0354zcmdj\",\"usage\":{\"queue_time\":0.094995369,\"prompt_tokens\":842,\"prompt_time\":0.061812596,\"completion_tokens\":55,\"completion_time\":0.2,\"total_tokens\":897,\"total_time\":0.261812596}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/Add heading and code block_1_5790f7702887daff99c884204e6ae3df.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/Add heading and code block_1_5790f7702887daff99c884204e6ae3df.json
new file mode 100644
index 0000000000..0363c91ba1
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/Add heading and code block_1_5790f7702887daff99c884204e6ae3df.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"at the end of doc, add a heading `Code` and a javascript code block with `console.log('hello world');`\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-69c542c9-0659-4d2f-9873-7bd11b4f7c2f\",\"object\":\"chat.completion.chunk\",\"created\":1747168986,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p61kre98txh5sv1fzt9md\"}}\n\ndata: {\"id\":\"chatcmpl-69c542c9-0659-4d2f-9873-7bd11b4f7c2f\",\"object\":\"chat.completion.chunk\",\"created\":1747168987,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_jr7b\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"\\u003ch1\\u003eCode\\u003c/h1\\u003e\\\",\\\"\\u003cpre\\u003e\\u003ccode data-language=\\\\\\\"javascript\\\\\\\"\\u003econsole.log('hello world');\\u003c/code\\u003e\\u003c/pre\\u003e\\\"]}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-69c542c9-0659-4d2f-9873-7bd11b4f7c2f\",\"object\":\"chat.completion.chunk\",\"created\":1747168987,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p61kre98txh5sv1fzt9md\",\"usage\":{\"queue_time\":0.111869994,\"prompt_tokens\":842,\"prompt_time\":0.058347442,\"completion_tokens\":55,\"completion_time\":0.2,\"total_tokens\":897,\"total_time\":0.258347442}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a list (end)_1_321607ef45a4235ca02c411097005de2.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a list (end)_1_321607ef45a4235ca02c411097005de2.json
new file mode 100644
index 0000000000..87302de998
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a list (end)_1_321607ef45a4235ca02c411097005de2.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a list with the items 'Apples' and 'Bananas' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-6bc90ec3-5649-4f10-b596-9bd4f15788ed\",\"object\":\"chat.completion.chunk\",\"created\":1747168986,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p6133fzsrchcrhkz536jh\"}}\n\ndata: {\"id\":\"chatcmpl-6bc90ec3-5649-4f10-b596-9bd4f15788ed\",\"object\":\"chat.completion.chunk\",\"created\":1747168986,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_fd0e\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"\\u003cul\\u003e\\u003cli\\u003eApples\\u003c/li\\u003e\\u003c/ul\\u003e\\\",\\\"\\u003cul\\u003e\\u003cli\\u003eBananas\\u003c/li\\u003e\\u003c/ul\\u003e\\\"]}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-6bc90ec3-5649-4f10-b596-9bd4f15788ed\",\"object\":\"chat.completion.chunk\",\"created\":1747168986,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p6133fzsrchcrhkz536jh\",\"usage\":{\"queue_time\":0.095047051,\"prompt_tokens\":835,\"prompt_time\":0.148876645,\"completion_tokens\":51,\"completion_time\":0.185454545,\"total_tokens\":886,\"total_time\":0.33433119}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (end)_1_709e808af3f5fb39418413416804a03e.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (end)_1_709e808af3f5fb39418413416804a03e.json
new file mode 100644
index 0000000000..49fbb2ff33
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (end)_1_709e808af3f5fb39418413416804a03e.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-a6076c84-d162-4f18-8d98-29127684ac1a\",\"object\":\"chat.completion.chunk\",\"created\":1747168985,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p60r8ez7rte01zk6s5hkv\"}}\n\ndata: {\"id\":\"chatcmpl-a6076c84-d162-4f18-8d98-29127684ac1a\",\"object\":\"chat.completion.chunk\",\"created\":1747168986,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_6h17\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"\\u003cp\\u003eYou look great today!\\u003c/p\\u003e\\\"]}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-a6076c84-d162-4f18-8d98-29127684ac1a\",\"object\":\"chat.completion.chunk\",\"created\":1747168986,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p60r8ez7rte01zk6s5hkv\",\"usage\":{\"queue_time\":0.100163767,\"prompt_tokens\":833,\"prompt_time\":0.066282051,\"completion_tokens\":35,\"completion_time\":0.127272727,\"total_tokens\":868,\"total_time\":0.193554778}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (start)_1_034fd3f9b57eba789a6449d5ff3714c4.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (start)_1_034fd3f9b57eba789a6449d5ff3714c4.json
new file mode 100644
index 0000000000..df150cc834
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (start)_1_034fd3f9b57eba789a6449d5ff3714c4.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' before the first sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-e424e723-8091-45b4-939a-cfe33383ce6d\",\"object\":\"chat.completion.chunk\",\"created\":1747168985,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p60dsfzsssn77e49arqx4\"}}\n\ndata: {\"id\":\"chatcmpl-e424e723-8091-45b4-939a-cfe33383ce6d\",\"object\":\"chat.completion.chunk\",\"created\":1747168985,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_ad59\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref1$\\\",\\\"position\\\":\\\"before\\\",\\\"blocks\\\":[\\\"\\u003cp\\u003eYou look great today!\\u003c/p\\u003e\\\"]}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-e424e723-8091-45b4-939a-cfe33383ce6d\",\"object\":\"chat.completion.chunk\",\"created\":1747168985,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p60dsfzsssn77e49arqx4\",\"usage\":{\"queue_time\":0.10212511599999999,\"prompt_tokens\":833,\"prompt_time\":0.06505606,\"completion_tokens\":35,\"completion_time\":0.127272727,\"total_tokens\":868,\"total_time\":0.192328787}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/Add heading (h1) and code block_1_084f72a77d80ec6bb6cd2081b3b1d301.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/Add heading (h1) and code block_1_084f72a77d80ec6bb6cd2081b3b1d301.json
new file mode 100644
index 0000000000..3e969ef721
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/Add heading (h1) and code block_1_084f72a77d80ec6bb6cd2081b3b1d301.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"at the end of doc, add a heading `Code` and a javascript code block with `console.log('hello world');`\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr1bVrJF6POwBdo4bKwfnrBENaLn\",\n \"object\": \"chat.completion\",\n \"created\": 1747170023,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_JBA2F0JboQH96Zw5ch7nh7SA\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"
Code
\\\",\\\"
console.log('hello world');
\\\"]}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 564,\n \"completion_tokens\": 55,\n \"total_tokens\": 619,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/Add heading and code block_1_084f72a77d80ec6bb6cd2081b3b1d301.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/Add heading and code block_1_084f72a77d80ec6bb6cd2081b3b1d301.json
new file mode 100644
index 0000000000..30055ca03d
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/Add heading and code block_1_084f72a77d80ec6bb6cd2081b3b1d301.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"at the end of doc, add a heading `Code` and a javascript code block with `console.log('hello world');`\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkZneFFrUPs6hHtY2GyKC4MfVJK\",\n \"object\": \"chat.completion\",\n \"created\": 1747168967,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_iVcm6giwwVN4UTiKnubOTGss\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"
Code
\\\",\\\"
console.log('hello world');
\\\"]}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 564,\n \"completion_tokens\": 55,\n \"total_tokens\": 619,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a list (end)_1_5c081c7846ad89b59477ceda44c2a349.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a list (end)_1_5c081c7846ad89b59477ceda44c2a349.json
new file mode 100644
index 0000000000..7e085d33b7
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a list (end)_1_5c081c7846ad89b59477ceda44c2a349.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a list with the items 'Apples' and 'Bananas' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkVFRZzr3gAHqgMhNH0g78kNGXz\",\n \"object\": \"chat.completion\",\n \"created\": 1747168963,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_R8NR47jlWShpCRqlSjx0DzYD\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"
Apples
\\\",\\\"
Bananas
\\\"]}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 557,\n \"completion_tokens\": 50,\n \"total_tokens\": 607,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (end)_1_97770b1d0462a25cfacd049807a59110.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (end)_1_97770b1d0462a25cfacd049807a59110.json
new file mode 100644
index 0000000000..0e98f86962
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (end)_1_97770b1d0462a25cfacd049807a59110.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkVsPCI52z9bVPjgSFcBTiM8yo8\",\n \"object\": \"chat.completion\",\n \"created\": 1747168963,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_tB9Xr3ococ60oEsBY2RXfB1o\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"
You look great today!
\\\"]}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 555,\n \"completion_tokens\": 34,\n \"total_tokens\": 589,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (start)_1_ecf9943025fd7f7183aac8d86c4e0b6c.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (start)_1_ecf9943025fd7f7183aac8d86c4e0b6c.json
new file mode 100644
index 0000000000..0d58be97a9
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (start)_1_ecf9943025fd7f7183aac8d86c4e0b6c.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' before the first sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkUiGHmND0Kd10ig5rA2tmB71Jj\",\n \"object\": \"chat.completion\",\n \"created\": 1747168962,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_wyUoYP3YIkxjJnpvRn1OQY8I\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref1$\\\",\\\"position\\\":\\\"before\\\",\\\"blocks\\\":[\\\"
You look great today!
\\\"]}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 555,\n \"completion_tokens\": 34,\n \"total_tokens\": 589,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_b19471ad74a7a4bf4b288369edf35407.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_b19471ad74a7a4bf4b288369edf35407.json
new file mode 100644
index 0000000000..33b8d0647c
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_b19471ad74a7a4bf4b288369edf35407.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"at the end of doc, add a heading `Code` and a javascript code block with `console.log('hello world');`\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_8oiTouy8jkc45zd2sIjpDFXK\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"after\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"h\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Code\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"h\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"pre\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"><\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"code\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-language\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"javascript\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"console\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\".log\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"('\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"');\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"code\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"pre\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqpHwqW5yKxfDFGeQTCdakJMOL0u\",\"object\":\"chat.completion.chunk\",\"created\":1747169259,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading and code block_1_b19471ad74a7a4bf4b288369edf35407.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading and code block_1_b19471ad74a7a4bf4b288369edf35407.json
new file mode 100644
index 0000000000..bae398bd3b
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading and code block_1_b19471ad74a7a4bf4b288369edf35407.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"at the end of doc, add a heading `Code` and a javascript code block with `console.log('hello world');`\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_scRt1qMJACqjdlw2O11nmnF3\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"after\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"h\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Code\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"h\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"pre\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"><\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"code\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-language\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"javascript\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"console\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\".log\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"('\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"');\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"code\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"pre\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkC5gyNQ3bnydhPjeCIg5xJJH1B\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_8105f57bbca898c1626edd5cd33308ed.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_8105f57bbca898c1626edd5cd33308ed.json
new file mode 100644
index 0000000000..6166f25709
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_8105f57bbca898c1626edd5cd33308ed.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a list with the items 'Apples' and 'Bananas' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_icz1JvgarGNGn9uAMNUcGsNq\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"after\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ul\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"><\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"li\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Ap\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ples\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"li\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ul\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ul\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"><\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"li\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Ban\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"anas\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"li\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ul\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkCtFM7ednz07mzhelcCepGBnAH\",\"object\":\"chat.completion.chunk\",\"created\":1747168944,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_2f4aa2dfa4f6046506c9e133c5d60e76.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_2f4aa2dfa4f6046506c9e133c5d60e76.json
new file mode 100644
index 0000000000..f269e90ae8
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_2f4aa2dfa4f6046506c9e133c5d60e76.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_VZ90dCVlAULnpCNdNyjPyb8h\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"after\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">You\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" look\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" great\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" today\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkBRu4aGmTlobvdKqFNWgu5749k\",\"object\":\"chat.completion.chunk\",\"created\":1747168943,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_7352df4919df344c441fb32b5cdae62b.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_7352df4919df344c441fb32b5cdae62b.json
new file mode 100644
index 0000000000..235124ae1b
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_7352df4919df344c441fb32b5cdae62b.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' before the first sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_7yLOWPOIWngAicMcakWV2ovt\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"before\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">You\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" look\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" great\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" today\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkA2CLPft6AWhk9D1ZHDCNMW2Y4\",\"object\":\"chat.completion.chunk\",\"created\":1747168942,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add and update paragraph_1_861b7da5f0734c4350466fb42da57dfe.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add and update paragraph_1_861b7da5f0734c4350466fb42da57dfe.json
new file mode 100644
index 0000000000..6bd14bce6b
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add and update paragraph_1_861b7da5f0734c4350466fb42da57dfe.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the first paragraph and translate 'Hello, world' to dutch\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-04498315a0a04abd8e0ff31d9d75a154\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-e4cb5cfa4141454bafdcbb1318359b2c\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"add\\\", \\\"referenceId\\\": \\\"ref1$\\\", \\\"position\\\": \\\"after\\\", \\\"blocks\\\": [\\\"
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169520,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":66,\"prompt_tokens\":1122,\"total_tokens\":1188,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add paragraph and update selection_1_4821f5b399d9ebc5b564c530740345ea.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add paragraph and update selection_1_4821f5b399d9ebc5b564c530740345ea.json
new file mode 100644
index 0000000000..317d9e9c18
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/add paragraph and update selection_1_4821f5b399d9ebc5b564c530740345ea.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
Hello, world!
\\\"},{\\\"block\\\":\\\"
Hello, @John Doe! How are you doing?This text is blue!
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a paragraph with the text 'You look great today!' at the beginning and translate selection to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-55175dc862504391922b714fa7d681d5\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-b8539321243a4ea3b548ce5a9a7ecc1b\",\"function\":{\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref1$\\\",\\\"position\\\":\\\"before\\\",\\\"blocks\\\":[]}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169522,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":23,\"prompt_tokens\":966,\"total_tokens\":989,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add and update paragraph_1_0d6f9f822d5ba2310e9cb3b5330d1ef0.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add and update paragraph_1_0d6f9f822d5ba2310e9cb3b5330d1ef0.json
new file mode 100644
index 0000000000..ec15599ae2
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add and update paragraph_1_0d6f9f822d5ba2310e9cb3b5330d1ef0.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the first paragraph and translate 'Hello, world' to dutch\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-5aca0aea-cfd0-415a-81d3-acf8e63f425b\",\"object\":\"chat.completion\",\"created\":1747169009,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_w3yq\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHallo, wereld!\\u003c/p\\u003e\\\"},{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref1$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"\\u003cp\\u003eYou look great today!\\u003c/p\\u003e\\\"]}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.095180028,\"prompt_tokens\":938,\"prompt_time\":0.144985184,\"completion_tokens\":57,\"completion_time\":0.207272727,\"total_tokens\":995,\"total_time\":0.352257911},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_2ddfbb0da0\",\"x_groq\":{\"id\":\"req_01jv5p6qbeezk92zvhw3g2kjkt\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add paragraph and update selection_1_0ca431ee9c56812e10198e60552a536f.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add paragraph and update selection_1_0ca431ee9c56812e10198e60552a536f.json
new file mode 100644
index 0000000000..bc9c2fbbea
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/add paragraph and update selection_1_0ca431ee9c56812e10198e60552a536f.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
Hello, world!
\\\"},{\\\"block\\\":\\\"
Hello, @John Doe! How are you doing?This text is blue!
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a paragraph with the text 'You look great today!' at the beginning and translate selection to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-7e664e25-d5ab-4d73-a5d9-3da9a6433017\",\"object\":\"chat.completion\",\"created\":1747169009,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_3aqh\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"add\\\", \\\"referenceId\\\": \\\"ref2$\\\", \\\"position\\\": \\\"before\\\", \\\"blocks\\\": [\\\"\\u003cp\\u003eYou look great today!\\u003c/p\\u003e\\\"]}, {\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"\\u003cp\\u003eHallo\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.095283385,\"prompt_tokens\":777,\"prompt_time\":0.085452833,\"completion_tokens\":66,\"completion_time\":0.24,\"total_tokens\":843,\"total_time\":0.325452833},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_2ddfbb0da0\",\"x_groq\":{\"id\":\"req_01jv5p6qtwe9gbp34zbggh2vsg\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add and update paragraph_1_96cb428c4df1b42645632abe5969170c.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add and update paragraph_1_96cb428c4df1b42645632abe5969170c.json
new file mode 100644
index 0000000000..71beddb6df
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add and update paragraph_1_96cb428c4df1b42645632abe5969170c.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the first paragraph and translate 'Hello, world' to dutch\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-4982a6cb-0bda-411f-8db8-a30df43ce4fc\",\"object\":\"chat.completion.chunk\",\"created\":1747168996,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p6b2ye9brr1fwmdmvx0yc\"}}\n\ndata: {\"id\":\"chatcmpl-4982a6cb-0bda-411f-8db8-a30df43ce4fc\",\"object\":\"chat.completion.chunk\",\"created\":1747168996,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_znd1\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHallo, wereld!\\u003c/p\\u003e\\\"},{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref1$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"\\u003cp\\u003eYou look great today!\\u003c/p\\u003e\\\"]}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-4982a6cb-0bda-411f-8db8-a30df43ce4fc\",\"object\":\"chat.completion.chunk\",\"created\":1747168996,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p6b2ye9brr1fwmdmvx0yc\",\"usage\":{\"queue_time\":0.095262266,\"prompt_tokens\":938,\"prompt_time\":0.06851764,\"completion_tokens\":57,\"completion_time\":0.207272727,\"total_tokens\":995,\"total_time\":0.275790367}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add paragraph and update selection_1_04f9e76ff73eff953288564e5385dbd4.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add paragraph and update selection_1_04f9e76ff73eff953288564e5385dbd4.json
new file mode 100644
index 0000000000..b632a250a0
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add paragraph and update selection_1_04f9e76ff73eff953288564e5385dbd4.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
Hello, world!
\\\"},{\\\"block\\\":\\\"
Hello, @John Doe! How are you doing?This text is blue!
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a paragraph with the text 'You look great today!' at the beginning and translate selection to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-63c1458d-36d5-4fc8-855f-4300bd557d4f\",\"object\":\"chat.completion.chunk\",\"created\":1747168996,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p6bfzezfadg89p8nwdhxh\"}}\n\ndata: {\"id\":\"chatcmpl-63c1458d-36d5-4fc8-855f-4300bd557d4f\",\"object\":\"chat.completion.chunk\",\"created\":1747168997,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_7wpc\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"add\\\", \\\"referenceId\\\": \\\"ref2$\\\", \\\"position\\\": \\\"before\\\", \\\"blocks\\\": [\\\"\\u003cp\\u003eYou look great today!\\u003c/p\\u003e\\\"]}, {\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"\\u003cp\\u003eHallo\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-63c1458d-36d5-4fc8-855f-4300bd557d4f\",\"object\":\"chat.completion.chunk\",\"created\":1747168997,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p6bfzezfadg89p8nwdhxh\",\"usage\":{\"queue_time\":0.102718631,\"prompt_tokens\":777,\"prompt_time\":0.054679916,\"completion_tokens\":66,\"completion_time\":0.24,\"total_tokens\":843,\"total_time\":0.294679916}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add and update paragraph_1_80b906ff9d95e8b88b30c4efd246dc4b.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add and update paragraph_1_80b906ff9d95e8b88b30c4efd246dc4b.json
new file mode 100644
index 0000000000..0f47e96385
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add and update paragraph_1_80b906ff9d95e8b88b30c4efd246dc4b.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the first paragraph and translate 'Hello, world' to dutch\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkpYMM1nMsikrn7HnRPBmj8Gnqd\",\n \"object\": \"chat.completion\",\n \"created\": 1747168983,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_VZimuoiEvIWkn1qorkSubsrn\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref1$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[\\\"
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 660,\n \"completion_tokens\": 56,\n \"total_tokens\": 716,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_90122d973c\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add paragraph and update selection_1_f5cd402d603bead3d759ebb5485f39c3.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add paragraph and update selection_1_f5cd402d603bead3d759ebb5485f39c3.json
new file mode 100644
index 0000000000..66e7dfe4d6
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add paragraph and update selection_1_f5cd402d603bead3d759ebb5485f39c3.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
Hello, world!
\\\"},{\\\"block\\\":\\\"
Hello, @John Doe! How are you doing?This text is blue!
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a paragraph with the text 'You look great today!' at the beginning and translate selection to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkqkLBbb4NHx1Y5JgR257Olip9l\",\n \"object\": \"chat.completion\",\n \"created\": 1747168984,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_SrCj1m6a9VFzqvqWeji9X3TA\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"before\\\",\\\"blocks\\\":[\\\"
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 503,\n \"completion_tokens\": 54,\n \"total_tokens\": 557,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add and update paragraph_1_e0a277e6c9c61c532876788f8c914f42.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add and update paragraph_1_e0a277e6c9c61c532876788f8c914f42.json
new file mode 100644
index 0000000000..18c63ad343
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add and update paragraph_1_e0a277e6c9c61c532876788f8c914f42.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the first paragraph and translate 'Hello, world' to dutch\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_KScszp6NkG8VbimroAdCYBEo\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"after\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">You\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" look\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" great\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" today\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hallo\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" wereld\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkSgNCqbK834RhFdbikYZ8Fskrq\",\"object\":\"chat.completion.chunk\",\"created\":1747168960,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add paragraph and update selection_1_fc5837fa3ab53d1a511a8092a926d87d.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add paragraph and update selection_1_fc5837fa3ab53d1a511a8092a926d87d.json
new file mode 100644
index 0000000000..28f01acfa1
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add paragraph and update selection_1_fc5837fa3ab53d1a511a8092a926d87d.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
Hello, world!
\\\"},{\\\"block\\\":\\\"
Hello, @John Doe! How are you doing?This text is blue!
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a paragraph with the text 'You look great today!' at the beginning and translate selection to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_D3sfQ94TKdeWfmaks9ZihSUR\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"before\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">You\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" look\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" great\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" today\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hallo\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkTez3W6FUvtbUqGlaclGX6PgYI\",\"object\":\"chat.completion.chunk\",\"created\":1747168961,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/delete first block_1_ba835c26344e8e2082ee1f404bacb992.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/delete first block_1_ba835c26344e8e2082ee1f404bacb992.json
new file mode 100644
index 0000000000..967c9a6bb9
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/delete first block_1_ba835c26344e8e2082ee1f404bacb992.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"delete the first paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-6e95944df4694ffd83bd7f60a5423896\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-7a7494fb32e64001abdf9dce8a1e4647\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"delete\\\", \\\"id\\\": \\\"ref1$\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169519,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":19,\"prompt_tokens\":1099,\"total_tokens\":1118,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/delete first block_1_d857ced55373d86233599394800f1a63.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/delete first block_1_d857ced55373d86233599394800f1a63.json
new file mode 100644
index 0000000000..2cea7a0168
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/delete first block_1_d857ced55373d86233599394800f1a63.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"delete the first paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-c50f8aa1-9bb9-46a5-914a-276baa4aa515\",\"object\":\"chat.completion\",\"created\":1747169008,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_20eb\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"delete\\\", \\\"id\\\": \\\"ref1$\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.31206105399999995,\"prompt_tokens\":915,\"prompt_time\":0.09898587,\"completion_tokens\":21,\"completion_time\":0.076363636,\"total_tokens\":936,\"total_time\":0.175349506},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_4e32347616\",\"x_groq\":{\"id\":\"req_01jv5p6ppqe0rr7z3nzg9p6cqj\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/delete first block_1_f88ee2c9e0a85200bb5550e4502fc0e5.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/delete first block_1_f88ee2c9e0a85200bb5550e4502fc0e5.json
new file mode 100644
index 0000000000..2e86247e69
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/delete first block_1_f88ee2c9e0a85200bb5550e4502fc0e5.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"delete the first paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-43ab7b94-4a47-44f4-abcb-8f47a87734e8\",\"object\":\"chat.completion.chunk\",\"created\":1747168996,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_4e32347616\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p6af4e07tszdbw45zsfxa\"}}\n\ndata: {\"id\":\"chatcmpl-43ab7b94-4a47-44f4-abcb-8f47a87734e8\",\"object\":\"chat.completion.chunk\",\"created\":1747168996,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_4e32347616\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_vycn\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"delete\\\", \\\"id\\\": \\\"ref1$\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-43ab7b94-4a47-44f4-abcb-8f47a87734e8\",\"object\":\"chat.completion.chunk\",\"created\":1747168996,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_4e32347616\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p6af4e07tszdbw45zsfxa\",\"usage\":{\"queue_time\":0.40713977,\"prompt_tokens\":915,\"prompt_time\":0.10659224,\"completion_tokens\":21,\"completion_time\":0.076363636,\"total_tokens\":936,\"total_time\":0.182955876}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/delete first block_1_c2ce81529453c6009b31fc3e2d3f8aea.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/delete first block_1_c2ce81529453c6009b31fc3e2d3f8aea.json
new file mode 100644
index 0000000000..71ffd40b88
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/delete first block_1_c2ce81529453c6009b31fc3e2d3f8aea.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"delete the first paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkoGhA09lwtuyZ4R31tVrAOyrh9\",\n \"object\": \"chat.completion\",\n \"created\": 1747168982,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_mtcoiyjzKjRuuNqthHN5vYOt\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"delete\\\",\\\"id\\\":\\\"ref1$\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 637,\n \"completion_tokens\": 16,\n \"total_tokens\": 653,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/delete first block_1_90f8de8d41648f556395ecf223aa0e6e.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/delete first block_1_90f8de8d41648f556395ecf223aa0e6e.json
new file mode 100644
index 0000000000..f5c2b50565
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/delete first block_1_90f8de8d41648f556395ecf223aa0e6e.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"delete the first paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_RyXPxmKY4ilDk85jm6wS5Dh8\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"delete\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRpToUaGuc5XkjjBjBp2Eyq3XQ\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/drop mark and link and change text within mark_1_953804d0569e88c225ebe8711ac1d209.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/drop mark and link and change text within mark_1_953804d0569e88c225ebe8711ac1d209.json
new file mode 100644
index 0000000000..b1092ab011
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/drop mark and link and change text within mark_1_953804d0569e88c225ebe8711ac1d209.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change the last paragraph to 'Hi, world! Bold the text. Link.' without any markup like bold or link\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-23329a619a1b4cf4bb8a7dd6e7b98dca\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-e05d4299f35a4753900d7a23503f8dcf\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref3$\\\", \\\"block\\\": \\\"
Hi, world! Bold the text. Link.
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169513,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":37,\"prompt_tokens\":1118,\"total_tokens\":1155,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/drop mark and link_1_9cfdcdc629e0d2c8ba65e699037e007c.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/drop mark and link_1_9cfdcdc629e0d2c8ba65e699037e007c.json
new file mode 100644
index 0000000000..9715309252
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/drop mark and link_1_9cfdcdc629e0d2c8ba65e699037e007c.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the formatting (turn into plain text without styles or urls) from the last paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-4e162f78556c4995941d2da8b04e19b8\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-db65e094fa75484c90dc41531bf7cb03\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref3$\\\", \\\"block\\\": \\\"
Hello, world! Bold text. Link.
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169511,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":35,\"prompt_tokens\":1112,\"total_tokens\":1147,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/modify nested content_1_595e0413e677a7d0e1cf7024e2cdbf11.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/modify nested content_1_595e0413e677a7d0e1cf7024e2cdbf11.json
new file mode 100644
index 0000000000..55cdcc2d49
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/modify nested content_1_595e0413e677a7d0e1cf7024e2cdbf11.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make apples uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-19a5730de5474dbaa293aed1b2ff6a28\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-cbaf0e88054c4dcabc4f5e542d0ffc02\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"
APPLES
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169516,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":30,\"prompt_tokens\":1003,\"total_tokens\":1033,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/modify parent content_1_8a40e8e484dd5e6352b3019e81255567.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/modify parent content_1_8a40e8e484dd5e6352b3019e81255567.json
new file mode 100644
index 0000000000..cff5286ef1
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/modify parent content_1_8a40e8e484dd5e6352b3019e81255567.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-2e5ceb9082bd40c79886466163a642f2\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-0d52782debac406585a3345f4c4c6056\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref1$\\\", \\\"block\\\": \\\"
I NEED TO BUY:
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169517,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":31,\"prompt_tokens\":1005,\"total_tokens\":1036,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/plain source block, add mention_1_03e2c4dfae2ceb146b12fc9a266da98e.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/plain source block, add mention_1_03e2c4dfae2ceb146b12fc9a266da98e.json
new file mode 100644
index 0000000000..f3ae8335b4
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/plain source block, add mention_1_03e2c4dfae2ceb146b12fc9a266da98e.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"Change the first paragraph to Hello, Jane Doe! (use a mention)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-9515d6f8ab824a339bd9daec35700c66\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-9cef80f9065b4cb69952a5ac9d672c9f\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref1$\\\", \\\"block\\\": \\\"
Hello, @Jane Doe!
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169507,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":50,\"prompt_tokens\":1110,\"total_tokens\":1160,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/standard update_1_f65e23072a2f6be046fc618e0dbf3949.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/standard update_1_f65e23072a2f6be046fc618e0dbf3949.json
new file mode 100644
index 0000000000..5cafff6da9
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/standard update_1_f65e23072a2f6be046fc618e0dbf3949.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the first paragraph to german\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-1e4f12ee19344637abd4acb2e7ecd460\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-28d99cf7f55148feb52a5ff5e2987575\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref1$\\\", \\\"block\\\": \\\"
Hallo, Welt!
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169491,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":31,\"prompt_tokens\":1101,\"total_tokens\":1132,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, remove mark_1_3e4d4d1ba3f4c2e80cb1d38f35425665.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, remove mark_1_3e4d4d1ba3f4c2e80cb1d38f35425665.json
new file mode 100644
index 0000000000..418e7ffcca
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, remove mark_1_3e4d4d1ba3f4c2e80cb1d38f35425665.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the bold style from the second block\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-91dc37d2f7eb41cfb5ee4e39e69047ad\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-4a7d72d9194f4354b06b472730cade82\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"
Hello, @John Doe! How are you doing? This text is blue!
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169500,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":70,\"prompt_tokens\":1103,\"total_tokens\":1173,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, remove mention_1_7c0c0ebbf2e5eb36903b25d3e63f2a96.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, remove mention_1_7c0c0ebbf2e5eb36903b25d3e63f2a96.json
new file mode 100644
index 0000000000..857bdf4b4a
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, remove mention_1_7c0c0ebbf2e5eb36903b25d3e63f2a96.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change to say 'Hello! How are you doing? This text is blue!' (remove mention but keep bold text)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-b7631ae996f84bc7a3369082b578e8e3\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-a1e8711919754fc98f1b1cbabd47f531\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"
Hello! How are you doing? How are you doing?This text is blue!
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169503,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":58,\"prompt_tokens\":1119,\"total_tokens\":1177,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, replace content_1_f8c8827fbecd6977bdb2e5152b493530.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, replace content_1_f8c8827fbecd6977bdb2e5152b493530.json
new file mode 100644
index 0000000000..5faed790cc
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, replace content_1_f8c8827fbecd6977bdb2e5152b493530.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the content of the second block to 'Hello, updated content'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-ccbeb5fa764849ab90f6b1dcd1cc6689\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-1b6292feb2d9436c8f0ceb7ee0b695f0\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"
Hello, updated content
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169496,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":31,\"prompt_tokens\":1109,\"total_tokens\":1140,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, update mention prop_1_f4e5d300be72cb5a6c2ef33c32ce7325.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, update mention prop_1_f4e5d300be72cb5a6c2ef33c32ce7325.json
new file mode 100644
index 0000000000..91b934693f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, update mention prop_1_f4e5d300be72cb5a6c2ef33c32ce7325.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the mention to Jane Doe\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-7253251a3083401a9edaa00688f6f4f9\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-5d368ca709624dbf8fb0d0a10b7c2392\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"
Hello, @Jane Doe! How are you doing?This text is blue!
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169509,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":75,\"prompt_tokens\":1101,\"total_tokens\":1176,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, update text_1_388a274079ba06bcec0049a35278fc01.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, update text_1_388a274079ba06bcec0049a35278fc01.json
new file mode 100644
index 0000000000..e9cc26a59f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in source block, update text_1_388a274079ba06bcec0049a35278fc01.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the second block to german (use dir instead of Ihnen)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-7e85d108a02f4ee4b4d7ef5e0c1edc66\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-13a9b16e241d49e7803c220e657ade4a\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"
Hallo, @John Doe! Wie geht es dir?Dieser Text ist blau!
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169498,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":78,\"prompt_tokens\":1108,\"total_tokens\":1186,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in target block, add mark (paragraph)_1_c7be52683c9d405365815f334ed1f4db.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in target block, add mark (paragraph)_1_c7be52683c9d405365815f334ed1f4db.json
new file mode 100644
index 0000000000..ea15e42acd
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in target block, add mark (paragraph)_1_c7be52683c9d405365815f334ed1f4db.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make first paragraph bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-89fdf4bbe25c4c9e8fd828841eacc3d3\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-7862fea5749e40fdaad935f2180d60bd\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref1$\\\", \\\"block\\\": \\\"
Hello, world!
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169506,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":34,\"prompt_tokens\":1099,\"total_tokens\":1133,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in target block, add mark (word)_1_9bc0da43041ca4b3a188fbdfd9562bae.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in target block, add mark (word)_1_9bc0da43041ca4b3a188fbdfd9562bae.json
new file mode 100644
index 0000000000..5d8d306514
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/styles + ic in target block, add mark (word)_1_9bc0da43041ca4b3a188fbdfd9562bae.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make 'world!' (in the first block) bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-e99ffb2f99eb4f24a443a8b20496860f\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-d25c041b38994cb9b3d56bc23629f15a\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref1$\\\", \\\"block\\\": \\\"
Hello, world!
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169505,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":30,\"prompt_tokens\":1106,\"total_tokens\":1136,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/translate selection_1_6f0c6d98d9a99081b01869826a538c74.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/translate selection_1_6f0c6d98d9a99081b01869826a538c74.json
new file mode 100644
index 0000000000..730345d5f9
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/translate selection_1_6f0c6d98d9a99081b01869826a538c74.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
Hello, world!
\\\"},{\\\"block\\\":\\\"
Hello, @John Doe! How are you doing?This text is blue!
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-87ff736c96224847bb92adb7d75d8db7\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-da32c8d852904db8bdcbe44d164ecba2\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"
Hallo
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169492,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":29,\"prompt_tokens\":949,\"total_tokens\":978,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/turn paragraphs into list_1_122467a8b6979ad2a47b0417976218a9.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/turn paragraphs into list_1_122467a8b6979ad2a47b0417976218a9.json
new file mode 100644
index 0000000000..3ea315e201
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/turn paragraphs into list_1_122467a8b6979ad2a47b0417976218a9.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
I need to buy:
\\\"},{\\\"block\\\":\\\"
Apples
\\\"},{\\\"block\\\":\\\"
Bananas
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"turn into list (update existing blocks)\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-16da6d56786d46e09263a10129687cee\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-790acab9e86948bf98cdcbdf3f6b7cc7\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169514,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":63,\"prompt_tokens\":895,\"total_tokens\":958,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/update block type and content_1_ace9cde890d5c4b2a131f8867e7b5596.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/update block type and content_1_ace9cde890d5c4b2a131f8867e7b5596.json
new file mode 100644
index 0000000000..c8d4487c8b
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/update block type and content_1_ace9cde890d5c4b2a131f8867e7b5596.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading and update the content to 'What's up, world!'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-faa04a4cea4e426e8fe183a632f52a16\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-1d3587ec34c54fe0bf3d13ceabb897e6\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref1$\\\", \\\"block\\\": \\\"
What's up, world!
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169495,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":35,\"prompt_tokens\":1113,\"total_tokens\":1148,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/update block type_1_d356646093fb778e9c8bce47f7133ef8.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/update block type_1_d356646093fb778e9c8bce47f7133ef8.json
new file mode 100644
index 0000000000..9806bd84b9
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/albert-etalab.chat/neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8 (non-streaming)/update block type_1_d356646093fb778e9c8bce47f7133ef8.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=albert-etalab&url=https%3A%2F%2Falbert.api.etalab.gouv.fr%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-68c728cd49c44c3585631d01dd67b7ed\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\",\"refusal\":null,\"role\":\"assistant\",\"audio\":null,\"function_call\":null,\"tool_calls\":[{\"id\":\"chatcmpl-tool-3f206627165b4fe79aa3a1b981d98710\",\"function\":{\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref1$\\\", \\\"block\\\": \\\"
Hello, world!
\\\"}]}\",\"name\":\"json\"},\"type\":\"function\"}],\"reasoning_content\":null},\"stop_reason\":null}],\"created\":1747169494,\"model\":\"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8\",\"object\":\"chat.completion\",\"service_tier\":null,\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":32,\"prompt_tokens\":1101,\"total_tokens\":1133,\"completion_tokens_details\":null,\"prompt_tokens_details\":null},\"search_results\":[],\"prompt_logprobs\":null}",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/drop mark and link and change text within mark_1_6b9ad94993b0b3dc39ee8fab8057b967.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/drop mark and link and change text within mark_1_6b9ad94993b0b3dc39ee8fab8057b967.json
new file mode 100644
index 0000000000..475baeca5f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/drop mark and link and change text within mark_1_6b9ad94993b0b3dc39ee8fab8057b967.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change the last paragraph to 'Hi, world! Bold the text. Link.' without any markup like bold or link\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-49d17c3f-c752-4ab3-aa97-b9b565f2a44c\",\"object\":\"chat.completion\",\"created\":1747169007,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_06k2\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHi, world! Bold the text. Link.\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.098364483,\"prompt_tokens\":934,\"prompt_time\":0.082554559,\"completion_tokens\":35,\"completion_time\":0.127272727,\"total_tokens\":969,\"total_time\":0.209827286},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_9a8b91ba77\",\"x_groq\":{\"id\":\"req_01jv5p6na0e9f896v32fddvnq4\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/drop mark and link_1_bde418f70f7c93522d3cff713cb6e8b2.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/drop mark and link_1_bde418f70f7c93522d3cff713cb6e8b2.json
new file mode 100644
index 0000000000..a6193f0066
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/drop mark and link_1_bde418f70f7c93522d3cff713cb6e8b2.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the formatting (turn into plain text without styles or urls) from the last paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-5546de96-5f09-487c-a57b-c7a497a25f2c\",\"object\":\"chat.completion\",\"created\":1747169006,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_6dmy\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref3$\\\", \\\"block\\\": \\\"\\u003cp\\u003eHello, world! Bold text. Link.\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.09561196400000002,\"prompt_tokens\":928,\"prompt_time\":0.158490536,\"completion_tokens\":37,\"completion_time\":0.134545455,\"total_tokens\":965,\"total_time\":0.293035991},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_3f3b593e33\",\"x_groq\":{\"id\":\"req_01jv5p6mv2ezjts25tpbcs8y9c\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/modify nested content_1_6d6efada9f514cd6b5d479b784960905.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/modify nested content_1_6d6efada9f514cd6b5d479b784960905.json
new file mode 100644
index 0000000000..f40bf03473
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/modify nested content_1_6d6efada9f514cd6b5d479b784960905.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make apples uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-ddbed522-7b09-403f-96c4-95b07ffe7596\",\"object\":\"chat.completion\",\"created\":1747169007,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_9dwb\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"\\u003cp\\u003eAPPLES\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.094470532,\"prompt_tokens\":819,\"prompt_time\":0.081647207,\"completion_tokens\":28,\"completion_time\":0.101818182,\"total_tokens\":847,\"total_time\":0.183465389},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_2ddfbb0da0\",\"x_groq\":{\"id\":\"req_01jv5p6p2se0rr4a2dpw46na3n\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/modify parent content_1_0b00b5e42872d9f249427436ed23ca40.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/modify parent content_1_0b00b5e42872d9f249427436ed23ca40.json
new file mode 100644
index 0000000000..81357e3b2c
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/modify parent content_1_0b00b5e42872d9f249427436ed23ca40.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-02724330-1565-430e-9896-dc18c977315b\",\"object\":\"chat.completion\",\"created\":1747169008,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_64qc\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref1$\\\", \\\"block\\\": \\\"\\u003cp\\u003eI NEED TO BUY:\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.101928613,\"prompt_tokens\":821,\"prompt_time\":0.053447976,\"completion_tokens\":33,\"completion_time\":0.12,\"total_tokens\":854,\"total_time\":0.173447976},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_3f3b593e33\",\"x_groq\":{\"id\":\"req_01jv5p6pcse9fsnjerjck51cr3\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/plain source block, add mention_1_a0f2a68ef2f46c1a3c014966a1d41463.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/plain source block, add mention_1_a0f2a68ef2f46c1a3c014966a1d41463.json
new file mode 100644
index 0000000000..7966646c13
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/plain source block, add mention_1_a0f2a68ef2f46c1a3c014966a1d41463.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"Change the first paragraph to Hello, Jane Doe! (use a mention)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-a5138477-f8e6-473f-ace6-4c909773ee5a\",\"object\":\"chat.completion\",\"created\":1747169005,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_yd3a\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHello, \\u003cspan data-inline-content-type=\\\\\\\"mention\\\\\\\" data-user=\\\\\\\"Jane Doe\\\\\\\"\\u003e@Jane Doe\\u003c/span\\u003e!\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.09500302299999999,\"prompt_tokens\":926,\"prompt_time\":0.070934364,\"completion_tokens\":48,\"completion_time\":0.174545455,\"total_tokens\":974,\"total_time\":0.245479819},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_9a8b91ba77\",\"x_groq\":{\"id\":\"req_01jv5p6m00e0nv5kz1w1dj2zkz\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/standard update_1_69863686209bcd70d5d432c6c5646ec6.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/standard update_1_69863686209bcd70d5d432c6c5646ec6.json
new file mode 100644
index 0000000000..ebb31cedb7
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/standard update_1_69863686209bcd70d5d432c6c5646ec6.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the first paragraph to german\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-7f0824e4-e27d-472f-8239-3f34f8b231c3\",\"object\":\"chat.completion\",\"created\":1747168999,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_xsq6\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref1$\\\", \\\"block\\\": \\\"\\u003cp\\u003eHallo, Welt!\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.09570181099999997,\"prompt_tokens\":917,\"prompt_time\":0.373198536,\"completion_tokens\":33,\"completion_time\":0.12,\"total_tokens\":950,\"total_time\":0.493198536},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_3f3b593e33\",\"x_groq\":{\"id\":\"req_01jv5p6dpxe9crjg90590txymj\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, remove mark_1_26a2249225e49ac962f2ffc4d186f048.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, remove mark_1_26a2249225e49ac962f2ffc4d186f048.json
new file mode 100644
index 0000000000..c2ff4c5835
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, remove mark_1_26a2249225e49ac962f2ffc4d186f048.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the bold style from the second block\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-8aef3ca2-219f-478d-b598-3de4c4ff3f21\",\"object\":\"chat.completion\",\"created\":1747169004,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_svjp\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"\\u003cp\\u003eHello, \\u003cspan data-inline-content-type=\\\\\\\"mention\\\\\\\" data-user=\\\\\\\"John Doe\\\\\\\"\\u003e@John Doe\\u003c/span\\u003e! How are you doing? \\u003cspan data-text-color=\\\\\\\"blue\\\\\\\"\\u003eThis text is blue!\\u003c/span\\u003e\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.870878699,\"prompt_tokens\":919,\"prompt_time\":0.100599248,\"completion_tokens\":72,\"completion_time\":0.261818182,\"total_tokens\":991,\"total_time\":0.36241743},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_4e32347616\",\"x_groq\":{\"id\":\"req_01jv5p6hq4ezh93zz25mz9ar6e\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, remove mention_1_8a9dfa091990b0ea68d8b5e600e5ded4.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, remove mention_1_8a9dfa091990b0ea68d8b5e600e5ded4.json
new file mode 100644
index 0000000000..0e0b0ce73e
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, remove mention_1_8a9dfa091990b0ea68d8b5e600e5ded4.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change to say 'Hello! How are you doing? This text is blue!' (remove mention but keep bold text)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-e7ae62ba-bed9-4f36-9354-4475541ec411\",\"object\":\"chat.completion\",\"created\":1747169004,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_sgnj\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHello! \\u003cstrong\\u003eHow are you doing?\\u003c/strong\\u003e \\u003cspan data-text-color=\\\\\\\"blue\\\\\\\"\\u003eThis text is blue!\\u003c/span\\u003e\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.09507396900000001,\"prompt_tokens\":935,\"prompt_time\":0.067631896,\"completion_tokens\":51,\"completion_time\":0.185454545,\"total_tokens\":986,\"total_time\":0.253086441},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_2ddfbb0da0\",\"x_groq\":{\"id\":\"req_01jv5p6jz5e0jrq276bydfy1nh\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, replace content_1_b5da218448fab4a6144aee7b49fe7cfd.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, replace content_1_b5da218448fab4a6144aee7b49fe7cfd.json
new file mode 100644
index 0000000000..79a819f365
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, replace content_1_b5da218448fab4a6144aee7b49fe7cfd.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the content of the second block to 'Hello, updated content'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-5f78e6de-7f02-4294-9235-e2742e41be8e\",\"object\":\"chat.completion\",\"created\":1747169002,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_6y3c\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHello, updated content\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.10164246599999999,\"prompt_tokens\":925,\"prompt_time\":0.225538069,\"completion_tokens\":29,\"completion_time\":0.105454545,\"total_tokens\":954,\"total_time\":0.330992614},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_2ddfbb0da0\",\"x_groq\":{\"id\":\"req_01jv5p6gn4e0e9gzttg9ydhfs3\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, update mention prop_1_93cd31cde8f8a9d7bcc6ec163bd82e32.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, update mention prop_1_93cd31cde8f8a9d7bcc6ec163bd82e32.json
new file mode 100644
index 0000000000..8858ad2826
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, update mention prop_1_93cd31cde8f8a9d7bcc6ec163bd82e32.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the mention to Jane Doe\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-f5984d68-5cdf-49c1-b743-7be9fcfb0cf3\",\"object\":\"chat.completion\",\"created\":1747169006,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_mbhr\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHello, \\u003cspan data-inline-content-type=\\\\\\\"mention\\\\\\\" data-user=\\\\\\\"Jane Doe\\\\\\\"\\u003e@Jane Doe\\u003c/span\\u003e! \\u003cstrong\\u003eHow are you doing?\\u003c/strong\\u003e \\u003cspan data-text-color=\\\\\\\"blue\\\\\\\"\\u003eThis text is blue!\\u003c/span\\u003e\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.09555989399999999,\"prompt_tokens\":917,\"prompt_time\":0.076064445,\"completion_tokens\":73,\"completion_time\":0.265454545,\"total_tokens\":990,\"total_time\":0.34151899},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_9a8b91ba77\",\"x_groq\":{\"id\":\"req_01jv5p6mbze0pbz2chy18hqkjc\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, update text_1_98388769d4b6c534a448363e38006369.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, update text_1_98388769d4b6c534a448363e38006369.json
new file mode 100644
index 0000000000..cfcdc7e8d8
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in source block, update text_1_98388769d4b6c534a448363e38006369.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the second block to german (use dir instead of Ihnen)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-e4d0b660-4651-47f1-8686-3220911c5bd4\",\"object\":\"chat.completion\",\"created\":1747169002,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_nn1n\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"\\u003cp\\u003eHallo, \\u003cspan data-inline-content-type=\\\\\\\"mention\\\\\\\" data-user=\\\\\\\"John Doe\\\\\\\"\\u003e@John Doe\\u003c/span\\u003e! \\u003cstrong\\u003eWie geht es dir?\\u003c/strong\\u003e \\u003cspan data-text-color=\\\\\\\"blue\\\\\\\"\\u003eDieser Text ist blau!\\u003c/span\\u003e\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.09532773400000001,\"prompt_tokens\":924,\"prompt_time\":0.070841634,\"completion_tokens\":80,\"completion_time\":0.290909091,\"total_tokens\":1004,\"total_time\":0.361750725},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_9a8b91ba77\",\"x_groq\":{\"id\":\"req_01jv5p6h79e0ertx4vk7m46cab\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in target block, add mark (paragraph)_1_039df897cf40b1464a3e77597698630f.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in target block, add mark (paragraph)_1_039df897cf40b1464a3e77597698630f.json
new file mode 100644
index 0000000000..3163527f61
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in target block, add mark (paragraph)_1_039df897cf40b1464a3e77597698630f.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make first paragraph bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-6a4ecc21-976b-4644-a81f-e43271fc6f93\",\"object\":\"chat.completion\",\"created\":1747169005,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_0mrh\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003cp\\u003e\\u003cstrong\\u003eHello, world!\\u003c/strong\\u003e\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.09545125399999999,\"prompt_tokens\":915,\"prompt_time\":0.066395385,\"completion_tokens\":32,\"completion_time\":0.116363636,\"total_tokens\":947,\"total_time\":0.182759021},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_3f3b593e33\",\"x_groq\":{\"id\":\"req_01jv5p6knre0mvnnccs4xk7n5d\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in target block, add mark (word)_1_ecfba97d707a7df556c8be55a94491bd.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in target block, add mark (word)_1_ecfba97d707a7df556c8be55a94491bd.json
new file mode 100644
index 0000000000..c584ed303d
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/styles + ic in target block, add mark (word)_1_ecfba97d707a7df556c8be55a94491bd.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make 'world!' (in the first block) bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-6c5ce929-b040-4c8d-8d55-36d7b92799e2\",\"object\":\"chat.completion\",\"created\":1747169005,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_3p7j\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHello, \\u003cstrong\\u003eworld!\\u003c/strong\\u003e\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.09504306700000001,\"prompt_tokens\":922,\"prompt_time\":0.067196003,\"completion_tokens\":33,\"completion_time\":0.120556483,\"total_tokens\":955,\"total_time\":0.187752486},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_2ddfbb0da0\",\"x_groq\":{\"id\":\"req_01jv5p6kbhe9dsf7scbgq4ce8c\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/translate selection_1_674d4ec4b8af2ac528ec90892731f67a.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/translate selection_1_674d4ec4b8af2ac528ec90892731f67a.json
new file mode 100644
index 0000000000..bc23cca4c5
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/translate selection_1_674d4ec4b8af2ac528ec90892731f67a.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
Hello, world!
\\\"},{\\\"block\\\":\\\"
Hello, @John Doe! How are you doing?This text is blue!
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-03aed7cc-1d95-4570-9f50-b94ef0f78a7b\",\"object\":\"chat.completion\",\"created\":1747169001,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_mcxr\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"\\u003cp\\u003eHallo\\u003c/p\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":1.270603073,\"prompt_tokens\":760,\"prompt_time\":0.100671792,\"completion_tokens\":31,\"completion_time\":0.112727273,\"total_tokens\":791,\"total_time\":0.213399065},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_fcc3b74982\",\"x_groq\":{\"id\":\"req_01jv5p6eaqe9csfv7t5n67jsza\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/turn paragraphs into list_1_1ec910c96203d1d86b7dcce97e352e91.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/turn paragraphs into list_1_1ec910c96203d1d86b7dcce97e352e91.json
new file mode 100644
index 0000000000..11975b5efc
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/turn paragraphs into list_1_1ec910c96203d1d86b7dcce97e352e91.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
I need to buy:
\\\"},{\\\"block\\\":\\\"
Apples
\\\"},{\\\"block\\\":\\\"
Bananas
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"turn into list (update existing blocks)\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-29f6b203-42d6-4182-84e8-c6141b39a9bc\",\"object\":\"chat.completion\",\"created\":1747169007,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_bqsm\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"\\u003cul\\u003e\\u003cli\\u003eApples\\u003c/li\\u003e\\u003c/ul\\u003e\\\"},{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":\\\"\\u003cul\\u003e\\u003cli\\u003eBananas\\u003c/li\\u003e\\u003c/ul\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.11009905499999999,\"prompt_tokens\":706,\"prompt_time\":0.052804217,\"completion_tokens\":57,\"completion_time\":0.207272727,\"total_tokens\":763,\"total_time\":0.260076944},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_9a8b91ba77\",\"x_groq\":{\"id\":\"req_01jv5p6nnbe0racwjrzc9f952a\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/update block type and content_1_56b6b0d7b3b4585a4ca5598979ccc319.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/update block type and content_1_56b6b0d7b3b4585a4ca5598979ccc319.json
new file mode 100644
index 0000000000..11210369af
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/update block type and content_1_56b6b0d7b3b4585a4ca5598979ccc319.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading and update the content to 'What's up, world!'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-ac2e1ad1-4bd6-4e46-83c7-9c34c959c2d2\",\"object\":\"chat.completion\",\"created\":1747169001,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_3ymh\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003ch1\\u003eWhat's up, world!\\u003c/h1\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.107864571,\"prompt_tokens\":929,\"prompt_time\":0.094435472,\"completion_tokens\":33,\"completion_time\":0.12,\"total_tokens\":962,\"total_time\":0.214435472},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_3f3b593e33\",\"x_groq\":{\"id\":\"req_01jv5p6g87e0e9h8ejew4tr0fg\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/update block type_1_cec06b764f3e6538c0a0baeb04d60587.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/update block type_1_cec06b764f3e6538c0a0baeb04d60587.json
new file mode 100644
index 0000000000..e75057e091
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/update block type_1_cec06b764f3e6538c0a0baeb04d60587.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\"id\":\"chatcmpl-d380c74a-ca54-4f25-86d8-438b7a1d8080\",\"object\":\"chat.completion\",\"created\":1747169001,\"model\":\"llama-3.3-70b-versatile\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_ppa8\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003ch1\\u003eHello, world!\\u003c/h1\\u003e\\\"}]}\"}}]},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"usage\":{\"queue_time\":0.11170175899999998,\"prompt_tokens\":917,\"prompt_time\":0.170071797,\"completion_tokens\":30,\"completion_time\":0.109090909,\"total_tokens\":947,\"total_time\":0.279162706},\"usage_breakdown\":{\"models\":null},\"system_fingerprint\":\"fp_3f3b593e33\",\"x_groq\":{\"id\":\"req_01jv5p6ftjezhbw4ay2a9b9x8b\"}}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/drop mark and link and change text within mark_1_60a05ae4a6b034fe6eaafb2b7bfb9638.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/drop mark and link and change text within mark_1_60a05ae4a6b034fe6eaafb2b7bfb9638.json
new file mode 100644
index 0000000000..0985195d1e
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/drop mark and link and change text within mark_1_60a05ae4a6b034fe6eaafb2b7bfb9638.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change the last paragraph to 'Hi, world! Bold the text. Link.' without any markup like bold or link\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-b8579ec0-b884-43ab-a371-cabaeab0f6bc\",\"object\":\"chat.completion.chunk\",\"created\":1747168994,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p692ge04ab5wby5qh1fxx\"}}\n\ndata: {\"id\":\"chatcmpl-b8579ec0-b884-43ab-a371-cabaeab0f6bc\",\"object\":\"chat.completion.chunk\",\"created\":1747168994,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_qahe\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHi, world! Bold the text. Link.\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-b8579ec0-b884-43ab-a371-cabaeab0f6bc\",\"object\":\"chat.completion.chunk\",\"created\":1747168994,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p692ge04ab5wby5qh1fxx\",\"usage\":{\"queue_time\":0.094737869,\"prompt_tokens\":934,\"prompt_time\":0.07943074,\"completion_tokens\":35,\"completion_time\":0.127272727,\"total_tokens\":969,\"total_time\":0.206703467}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/drop mark and link_1_df81f4ea9e9cda25c1ef6b1d0de62e6e.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/drop mark and link_1_df81f4ea9e9cda25c1ef6b1d0de62e6e.json
new file mode 100644
index 0000000000..0237042346
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/drop mark and link_1_df81f4ea9e9cda25c1ef6b1d0de62e6e.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the formatting (turn into plain text without styles or urls) from the last paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-0f12f646-ec0c-4023-9681-ad70b4f957f1\",\"object\":\"chat.completion.chunk\",\"created\":1747168994,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p68qwezds9mj1z6y1scch\"}}\n\ndata: {\"id\":\"chatcmpl-0f12f646-ec0c-4023-9681-ad70b4f957f1\",\"object\":\"chat.completion.chunk\",\"created\":1747168994,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_hrpq\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref3$\\\", \\\"block\\\": \\\"\\u003cp\\u003eHello, world! Bold text. Link.\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-0f12f646-ec0c-4023-9681-ad70b4f957f1\",\"object\":\"chat.completion.chunk\",\"created\":1747168994,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p68qwezds9mj1z6y1scch\",\"usage\":{\"queue_time\":0.095316706,\"prompt_tokens\":928,\"prompt_time\":0.072032452,\"completion_tokens\":37,\"completion_time\":0.134545455,\"total_tokens\":965,\"total_time\":0.206577907}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify nested content_1_c473102de44b6890149109c418f224a7.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify nested content_1_c473102de44b6890149109c418f224a7.json
new file mode 100644
index 0000000000..3e3c1faea7
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify nested content_1_c473102de44b6890149109c418f224a7.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make apples uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-8c7ffe38-ffd7-4332-8f63-bfad4446d7b8\",\"object\":\"chat.completion.chunk\",\"created\":1747168995,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p69tse9asrznvk7h8tpg9\"}}\n\ndata: {\"id\":\"chatcmpl-8c7ffe38-ffd7-4332-8f63-bfad4446d7b8\",\"object\":\"chat.completion.chunk\",\"created\":1747168995,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_eqp6\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"\\u003cp\\u003eAPPLES\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-8c7ffe38-ffd7-4332-8f63-bfad4446d7b8\",\"object\":\"chat.completion.chunk\",\"created\":1747168995,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p69tse9asrznvk7h8tpg9\",\"usage\":{\"queue_time\":0.094981271,\"prompt_tokens\":819,\"prompt_time\":0.075476925,\"completion_tokens\":32,\"completion_time\":0.116363636,\"total_tokens\":851,\"total_time\":0.191840561}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify parent content_1_c8cc1e445e2ea3a61af98fae49719bb2.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify parent content_1_c8cc1e445e2ea3a61af98fae49719bb2.json
new file mode 100644
index 0000000000..8ec9fca967
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify parent content_1_c8cc1e445e2ea3a61af98fae49719bb2.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-9e394fd0-a3eb-4347-bdf2-c9fde5aea778\",\"object\":\"chat.completion.chunk\",\"created\":1747168995,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p6a4ye069h4q24zswf3e9\"}}\n\ndata: {\"id\":\"chatcmpl-9e394fd0-a3eb-4347-bdf2-c9fde5aea778\",\"object\":\"chat.completion.chunk\",\"created\":1747168995,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_89h7\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003cp\\u003eI NEED TO BUY:\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-9e394fd0-a3eb-4347-bdf2-c9fde5aea778\",\"object\":\"chat.completion.chunk\",\"created\":1747168995,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p6a4ye069h4q24zswf3e9\",\"usage\":{\"queue_time\":0.09492940100000001,\"prompt_tokens\":821,\"prompt_time\":0.0685514,\"completion_tokens\":29,\"completion_time\":0.121086512,\"total_tokens\":850,\"total_time\":0.189637912}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/plain source block, add mention_1_e6db90ec1ad4b48b7e225a5ef7b7ea08.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/plain source block, add mention_1_e6db90ec1ad4b48b7e225a5ef7b7ea08.json
new file mode 100644
index 0000000000..fc6c07f865
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/plain source block, add mention_1_e6db90ec1ad4b48b7e225a5ef7b7ea08.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"Change the first paragraph to Hello, Jane Doe! (use a mention)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-11ea6475-2176-4403-9491-dada8d5b4f44\",\"object\":\"chat.completion.chunk\",\"created\":1747168993,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p67tte03ara9gjxpe6p3z\"}}\n\ndata: {\"id\":\"chatcmpl-11ea6475-2176-4403-9491-dada8d5b4f44\",\"object\":\"chat.completion.chunk\",\"created\":1747168993,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_6h7t\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHello, \\u003cspan data-inline-content-type=\\\\\\\"mention\\\\\\\" data-user=\\\\\\\"Jane Doe\\\\\\\"\\u003e@Jane Doe\\u003c/span\\u003e!\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-11ea6475-2176-4403-9491-dada8d5b4f44\",\"object\":\"chat.completion.chunk\",\"created\":1747168993,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p67tte03ara9gjxpe6p3z\",\"usage\":{\"queue_time\":0.09443048300000001,\"prompt_tokens\":926,\"prompt_time\":0.12522345,\"completion_tokens\":48,\"completion_time\":0.174545455,\"total_tokens\":974,\"total_time\":0.299768905}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/standard update_1_afb308d981984d812bf89191d498ddac.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/standard update_1_afb308d981984d812bf89191d498ddac.json
new file mode 100644
index 0000000000..e060c6876e
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/standard update_1_afb308d981984d812bf89191d498ddac.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the first paragraph to german\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-28d002e2-5dc5-45c9-9d7c-4d4181b85809\",\"object\":\"chat.completion.chunk\",\"created\":1747168987,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p620vez8shnsresbz0n0h\"}}\n\ndata: {\"id\":\"chatcmpl-28d002e2-5dc5-45c9-9d7c-4d4181b85809\",\"object\":\"chat.completion.chunk\",\"created\":1747168987,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_0vgk\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref1$\\\", \\\"block\\\": \\\"\\u003cp\\u003eHallo, Welt!\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-28d002e2-5dc5-45c9-9d7c-4d4181b85809\",\"object\":\"chat.completion.chunk\",\"created\":1747168987,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p620vez8shnsresbz0n0h\",\"usage\":{\"queue_time\":0.10461503899999999,\"prompt_tokens\":917,\"prompt_time\":0.066683093,\"completion_tokens\":33,\"completion_time\":0.12,\"total_tokens\":950,\"total_time\":0.186683093}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, remove mark_1_7d6962e90a2fb300f8efab2620d77389.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, remove mark_1_7d6962e90a2fb300f8efab2620d77389.json
new file mode 100644
index 0000000000..f2b181e61d
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, remove mark_1_7d6962e90a2fb300f8efab2620d77389.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the bold style from the second block\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-c10bc875-0b26-4aab-b05a-04646472a33d\",\"object\":\"chat.completion.chunk\",\"created\":1747168989,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p647ce9997axb7wdgaqk5\"}}\n\ndata: {\"id\":\"chatcmpl-c10bc875-0b26-4aab-b05a-04646472a33d\",\"object\":\"chat.completion.chunk\",\"created\":1747168989,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_9rz7\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHello, \\u003cspan data-inline-content-type=\\\\\\\"mention\\\\\\\" data-user=\\\\\\\"John Doe\\\\\\\"\\u003e@John Doe\\u003c/span\\u003e! How are you doing? \\u003cspan data-text-color=\\\\\\\"blue\\\\\\\"\\u003eThis text is blue!\\u003c/span\\u003e\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-c10bc875-0b26-4aab-b05a-04646472a33d\",\"object\":\"chat.completion.chunk\",\"created\":1747168989,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p647ce9997axb7wdgaqk5\",\"usage\":{\"queue_time\":0.095037715,\"prompt_tokens\":919,\"prompt_time\":0.067275524,\"completion_tokens\":68,\"completion_time\":0.247272727,\"total_tokens\":987,\"total_time\":0.314548251}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, remove mention_1_a13d0c4ae92fddfbcbef8c619c092951.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, remove mention_1_a13d0c4ae92fddfbcbef8c619c092951.json
new file mode 100644
index 0000000000..47ec892794
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, remove mention_1_a13d0c4ae92fddfbcbef8c619c092951.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change to say 'Hello! How are you doing? This text is blue!' (remove mention but keep bold text)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-f2a2e28c-cd6d-4680-9d80-8057cfa97670\",\"object\":\"chat.completion.chunk\",\"created\":1747168989,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p64nqe00bbm4ytnqbtkhe\"}}\n\ndata: {\"id\":\"chatcmpl-f2a2e28c-cd6d-4680-9d80-8057cfa97670\",\"object\":\"chat.completion.chunk\",\"created\":1747168991,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_sa63\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"\\u003cp\\u003eHello! \\u003cstrong\\u003eHow are you doing?\\u003c/strong\\u003e \\u003cspan data-text-color=\\\\\\\"blue\\\\\\\"\\u003eThis text is blue!\\u003c/span\\u003e\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-f2a2e28c-cd6d-4680-9d80-8057cfa97670\",\"object\":\"chat.completion.chunk\",\"created\":1747168991,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p64nqe00bbm4ytnqbtkhe\",\"usage\":{\"queue_time\":0.09508124200000001,\"prompt_tokens\":935,\"prompt_time\":0.807303716,\"completion_tokens\":55,\"completion_time\":0.517512297,\"total_tokens\":990,\"total_time\":1.324816013}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, replace content_1_8d4842fb70ad278064faa2c3c6efa73e.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, replace content_1_8d4842fb70ad278064faa2c3c6efa73e.json
new file mode 100644
index 0000000000..25a0b8e187
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, replace content_1_8d4842fb70ad278064faa2c3c6efa73e.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the content of the second block to 'Hello, updated content'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-b82a1733-8872-4694-87c2-90c42a139008\",\"object\":\"chat.completion.chunk\",\"created\":1747168988,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p63dxez99mdvbtnw0rhdn\"}}\n\ndata: {\"id\":\"chatcmpl-b82a1733-8872-4694-87c2-90c42a139008\",\"object\":\"chat.completion.chunk\",\"created\":1747168988,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_vkq0\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHello, updated content\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-b82a1733-8872-4694-87c2-90c42a139008\",\"object\":\"chat.completion.chunk\",\"created\":1747168988,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p63dxez99mdvbtnw0rhdn\",\"usage\":{\"queue_time\":0.095449962,\"prompt_tokens\":925,\"prompt_time\":0.067087974,\"completion_tokens\":29,\"completion_time\":0.105454545,\"total_tokens\":954,\"total_time\":0.172542519}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, update mention prop_1_70a3e6c68033303f4dce207ea802bba9.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, update mention prop_1_70a3e6c68033303f4dce207ea802bba9.json
new file mode 100644
index 0000000000..e84a4645c6
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, update mention prop_1_70a3e6c68033303f4dce207ea802bba9.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the mention to Jane Doe\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-2ab1f8f8-c0e3-4392-9b46-926deae0bbea\",\"object\":\"chat.completion.chunk\",\"created\":1747168993,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p688pe9ar5pfn8e1gy2x7\"}}\n\ndata: {\"id\":\"chatcmpl-2ab1f8f8-c0e3-4392-9b46-926deae0bbea\",\"object\":\"chat.completion.chunk\",\"created\":1747168993,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_kh6g\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHello, \\u003cspan data-inline-content-type=\\\\\\\"mention\\\\\\\" data-user=\\\\\\\"Jane Doe\\\\\\\"\\u003e@Jane Doe\\u003c/span\\u003e! \\u003cstrong\\u003eHow are you doing?\\u003c/strong\\u003e \\u003cspan data-text-color=\\\\\\\"blue\\\\\\\"\\u003eThis text is blue!\\u003c/span\\u003e\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-2ab1f8f8-c0e3-4392-9b46-926deae0bbea\",\"object\":\"chat.completion.chunk\",\"created\":1747168993,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p688pe9ar5pfn8e1gy2x7\",\"usage\":{\"queue_time\":0.095318089,\"prompt_tokens\":917,\"prompt_time\":0.083429069,\"completion_tokens\":73,\"completion_time\":0.265454545,\"total_tokens\":990,\"total_time\":0.348883614}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, update text_1_3f639531f292bf1edb20bbb65c6ad0e0.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, update text_1_3f639531f292bf1edb20bbb65c6ad0e0.json
new file mode 100644
index 0000000000..9e5ff4618a
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, update text_1_3f639531f292bf1edb20bbb65c6ad0e0.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the second block to german (use dir instead of Ihnen)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-e6d9a7f3-1e40-4baa-9a9d-4143dd7cdf1d\",\"object\":\"chat.completion.chunk\",\"created\":1747168989,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p63qkfzya38eehxgrc4sy\"}}\n\ndata: {\"id\":\"chatcmpl-e6d9a7f3-1e40-4baa-9a9d-4143dd7cdf1d\",\"object\":\"chat.completion.chunk\",\"created\":1747168989,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_htsn\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"\\u003cp\\u003eHallo, \\u003cspan data-inline-content-type=\\\\\\\"mention\\\\\\\" data-user=\\\\\\\"John Doe\\\\\\\"\\u003e@John Doe\\u003c/span\\u003e! \\u003cstrong\\u003eWie geht es dir?\\u003c/strong\\u003e \\u003cspan data-text-color=\\\\\\\"blue\\\\\\\"\\u003eDieser Text ist blau!\\u003c/span\\u003e\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-e6d9a7f3-1e40-4baa-9a9d-4143dd7cdf1d\",\"object\":\"chat.completion.chunk\",\"created\":1747168989,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p63qkfzya38eehxgrc4sy\",\"usage\":{\"queue_time\":0.095162129,\"prompt_tokens\":924,\"prompt_time\":0.066936286,\"completion_tokens\":80,\"completion_time\":0.290909091,\"total_tokens\":1004,\"total_time\":0.357845377}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in target block, add mark (paragraph)_1_ca41f979b0669b1a9285363b55a53b23.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in target block, add mark (paragraph)_1_ca41f979b0669b1a9285363b55a53b23.json
new file mode 100644
index 0000000000..b66bbe04c2
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in target block, add mark (paragraph)_1_ca41f979b0669b1a9285363b55a53b23.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make first paragraph bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-c13ba3a7-28ad-46b1-a62a-0cb88c29dc1e\",\"object\":\"chat.completion.chunk\",\"created\":1747168992,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p67dve9at7qc2d0jch4a6\"}}\n\ndata: {\"id\":\"chatcmpl-c13ba3a7-28ad-46b1-a62a-0cb88c29dc1e\",\"object\":\"chat.completion.chunk\",\"created\":1747168993,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_67hz\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003cp\\u003e\\u003cstrong\\u003eHello, world!\\u003c/strong\\u003e\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-c13ba3a7-28ad-46b1-a62a-0cb88c29dc1e\",\"object\":\"chat.completion.chunk\",\"created\":1747168993,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p67dve9at7qc2d0jch4a6\",\"usage\":{\"queue_time\":0.11093209799999998,\"prompt_tokens\":915,\"prompt_time\":0.133566801,\"completion_tokens\":32,\"completion_time\":0.120453958,\"total_tokens\":947,\"total_time\":0.254020759}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in target block, add mark (word)_1_f3cba828671b95cae0b485ad554942cd.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in target block, add mark (word)_1_f3cba828671b95cae0b485ad554942cd.json
new file mode 100644
index 0000000000..9fc44bd0f1
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in target block, add mark (word)_1_f3cba828671b95cae0b485ad554942cd.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make 'world!' (in the first block) bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-f0ffeed7-619c-4436-8b28-a7ecc030b392\",\"object\":\"chat.completion.chunk\",\"created\":1747168991,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p6643e9abh80xea5jf2bz\"}}\n\ndata: {\"id\":\"chatcmpl-f0ffeed7-619c-4436-8b28-a7ecc030b392\",\"object\":\"chat.completion.chunk\",\"created\":1747168992,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_36y4\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003cp\\u003eHello, \\u003cstrong\\u003eworld!\\u003c/strong\\u003e\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-f0ffeed7-619c-4436-8b28-a7ecc030b392\",\"object\":\"chat.completion.chunk\",\"created\":1747168992,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_3f3b593e33\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p6643e9abh80xea5jf2bz\",\"usage\":{\"queue_time\":0.598447683,\"prompt_tokens\":922,\"prompt_time\":0.569092729,\"completion_tokens\":33,\"completion_time\":0.12307244,\"total_tokens\":955,\"total_time\":0.692165169}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/translate selection_1_54ec8515dd6ab214d8b92c5cf4f09529.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/translate selection_1_54ec8515dd6ab214d8b92c5cf4f09529.json
new file mode 100644
index 0000000000..74d8c45b06
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/translate selection_1_54ec8515dd6ab214d8b92c5cf4f09529.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
Hello, world!
\\\"},{\\\"block\\\":\\\"
Hello, @John Doe! How are you doing?This text is blue!
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-87a5823d-b4e4-460f-868f-75305557a2d6\",\"object\":\"chat.completion.chunk\",\"created\":1747168987,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p62b9fzttsm8fxcam7mg7\"}}\n\ndata: {\"id\":\"chatcmpl-87a5823d-b4e4-460f-868f-75305557a2d6\",\"object\":\"chat.completion.chunk\",\"created\":1747168987,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_dbb8\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"\\u003cp\\u003eHallo\\u003c/p\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-87a5823d-b4e4-460f-868f-75305557a2d6\",\"object\":\"chat.completion.chunk\",\"created\":1747168987,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p62b9fzttsm8fxcam7mg7\",\"usage\":{\"queue_time\":0.103731913,\"prompt_tokens\":760,\"prompt_time\":0.084372711,\"completion_tokens\":31,\"completion_time\":0.112727273,\"total_tokens\":791,\"total_time\":0.197099984}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/turn paragraphs into list_1_ec7bd4074c354be223256a9d0ab17e64.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/turn paragraphs into list_1_ec7bd4074c354be223256a9d0ab17e64.json
new file mode 100644
index 0000000000..a77aef3abe
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/turn paragraphs into list_1_ec7bd4074c354be223256a9d0ab17e64.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
I need to buy:
\\\"},{\\\"block\\\":\\\"
Apples
\\\"},{\\\"block\\\":\\\"
Bananas
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"turn into list (update existing blocks)\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-48491325-7c71-4ad7-b19e-0bbf2959fda7\",\"object\":\"chat.completion.chunk\",\"created\":1747168994,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p69daezeb6pbt4prjpzfe\"}}\n\ndata: {\"id\":\"chatcmpl-48491325-7c71-4ad7-b19e-0bbf2959fda7\",\"object\":\"chat.completion.chunk\",\"created\":1747168995,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_dte8\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\": [{\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref2$\\\", \\\"block\\\": \\\"\\u003cul\\u003e\\u003cli\\u003eApples\\u003c/li\\u003e\\u003c/ul\\u003e\\\"}, {\\\"type\\\": \\\"update\\\", \\\"id\\\": \\\"ref3$\\\", \\\"block\\\": \\\"\\u003cul\\u003e\\u003cli\\u003eBananas\\u003c/li\\u003e\\u003c/ul\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-48491325-7c71-4ad7-b19e-0bbf2959fda7\",\"object\":\"chat.completion.chunk\",\"created\":1747168995,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p69daezeb6pbt4prjpzfe\",\"usage\":{\"queue_time\":0.09465785099999999,\"prompt_tokens\":706,\"prompt_time\":0.055568379,\"completion_tokens\":66,\"completion_time\":0.24,\"total_tokens\":772,\"total_time\":0.295568379}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/update block type and content_1_d0dca6e4fab1bc2c56ba2099e199fb05.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/update block type and content_1_d0dca6e4fab1bc2c56ba2099e199fb05.json
new file mode 100644
index 0000000000..54f0cb7bdd
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/update block type and content_1_d0dca6e4fab1bc2c56ba2099e199fb05.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading and update the content to 'What's up, world!'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-09438909-65b7-4164-99a2-833919d10918\",\"object\":\"chat.completion.chunk\",\"created\":1747168988,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p62ztez9b8r27ddwc39z8\"}}\n\ndata: {\"id\":\"chatcmpl-09438909-65b7-4164-99a2-833919d10918\",\"object\":\"chat.completion.chunk\",\"created\":1747168988,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_wyne\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003ch1\\u003eWhat's up, world!\\u003c/h1\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-09438909-65b7-4164-99a2-833919d10918\",\"object\":\"chat.completion.chunk\",\"created\":1747168988,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_2ddfbb0da0\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p62ztez9b8r27ddwc39z8\",\"usage\":{\"queue_time\":0.094996571,\"prompt_tokens\":929,\"prompt_time\":0.071901079,\"completion_tokens\":33,\"completion_time\":0.12,\"total_tokens\":962,\"total_time\":0.191901079}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/update block type_1_18c554c2e45b6f5a1f491396916dcb46.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/update block type_1_18c554c2e45b6f5a1f491396916dcb46.json
new file mode 100644
index 0000000000..be1ca490e5
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/update block type_1_18c554c2e45b6f5a1f491396916dcb46.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=groq&url=https%3A%2F%2Fapi.groq.com%2Fopenai%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-19d04d37-0254-4ccf-b7ef-8d4c4db327d6\",\"object\":\"chat.completion.chunk\",\"created\":1747168987,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01jv5p62nxez8stwc9631mearz\"}}\n\ndata: {\"id\":\"chatcmpl-19d04d37-0254-4ccf-b7ef-8d4c4db327d6\",\"object\":\"chat.completion.chunk\",\"created\":1747168988,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"call_fe2v\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"\\u003ch1\\u003eHello, world!\\u003c/h1\\u003e\\\"}]}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-19d04d37-0254-4ccf-b7ef-8d4c4db327d6\",\"object\":\"chat.completion.chunk\",\"created\":1747168988,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_9a8b91ba77\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01jv5p62nxez8stwc9631mearz\",\"usage\":{\"queue_time\":0.095165881,\"prompt_tokens\":917,\"prompt_time\":0.066734428,\"completion_tokens\":30,\"completion_time\":0.109090909,\"total_tokens\":947,\"total_time\":0.175825337}}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link and change text within mark_1_feb4bd702156a044fe3c72729f12d83c.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link and change text within mark_1_feb4bd702156a044fe3c72729f12d83c.json
new file mode 100644
index 0000000000..9a7d1e698e
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link and change text within mark_1_feb4bd702156a044fe3c72729f12d83c.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change the last paragraph to 'Hi, world! Bold the text. Link.' without any markup like bold or link\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqklB9EGeteTKKksY3Yz7KdAPADv\",\n \"object\": \"chat.completion\",\n \"created\": 1747168979,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_oGpuyFOGNfzr13RpSMkT0sa8\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":\\\"
Hi, world! Bold the text. Link.
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 656,\n \"completion_tokens\": 34,\n \"total_tokens\": 690,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link_1_1e8bbd364a267db768002ed243692a79.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link_1_1e8bbd364a267db768002ed243692a79.json
new file mode 100644
index 0000000000..071515a25a
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link_1_1e8bbd364a267db768002ed243692a79.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the formatting (turn into plain text without styles or urls) from the last paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqklXGBoMNLlU7Q3X0GOYx3agSnT\",\n \"object\": \"chat.completion\",\n \"created\": 1747168979,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_oVjaLJli44c9RVwlw0rTbuZU\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":\\\"
Hello, world! Bold text. Link.
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 650,\n \"completion_tokens\": 32,\n \"total_tokens\": 682,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify nested content_1_b48a9c33b3a0d37850bd38f4c95b310f.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify nested content_1_b48a9c33b3a0d37850bd38f4c95b310f.json
new file mode 100644
index 0000000000..fe8437f494
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify nested content_1_b48a9c33b3a0d37850bd38f4c95b310f.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make apples uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqknGAoyZtrMWhQu5TUenlnfaFoP\",\n \"object\": \"chat.completion\",\n \"created\": 1747168981,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_IopLOlDzkvNq3z2SbrX33iPh\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
APPLES
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 541,\n \"completion_tokens\": 27,\n \"total_tokens\": 568,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_90122d973c\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify parent content_1_b8c66592925ae0e551a329b7b2f3b3e2.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify parent content_1_b8c66592925ae0e551a329b7b2f3b3e2.json
new file mode 100644
index 0000000000..acef7a6daf
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify parent content_1_b8c66592925ae0e551a329b7b2f3b3e2.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkop4GFqnLZXmpiMwjBdtTPRzE0\",\n \"object\": \"chat.completion\",\n \"created\": 1747168982,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_iP3Y3gCRCXhXMwxXz71mT6LB\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
I NEED TO BUY:
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 543,\n \"completion_tokens\": 28,\n \"total_tokens\": 571,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/plain source block, add mention_1_196e976a8d5748fd3b667cc39b96cc4d.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/plain source block, add mention_1_196e976a8d5748fd3b667cc39b96cc4d.json
new file mode 100644
index 0000000000..d1f94762b6
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/plain source block, add mention_1_196e976a8d5748fd3b667cc39b96cc4d.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"Change the first paragraph to Hello, Jane Doe! (use a mention)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkjNNoQvQ69VtfzGLfofAmiLDtE\",\n \"object\": \"chat.completion\",\n \"created\": 1747168977,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_eUYfczfJ58NjjBlpi2e4FEJe\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
Hello, @Jane Doe!
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 648,\n \"completion_tokens\": 47,\n \"total_tokens\": 695,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/standard update_1_62ccc02aa192415d17e9a1f5c53dffb1.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/standard update_1_62ccc02aa192415d17e9a1f5c53dffb1.json
new file mode 100644
index 0000000000..d1250f0d06
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/standard update_1_62ccc02aa192415d17e9a1f5c53dffb1.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the first paragraph to german\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkbgZaU3rw0cS9hxADP8BI88Gb6\",\n \"object\": \"chat.completion\",\n \"created\": 1747168969,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_jpdfl8ulA2P1Bzlnbit8koVr\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
Hallo, Welt!
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 639,\n \"completion_tokens\": 28,\n \"total_tokens\": 667,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mark_1_ab9642000a9e81712bf7bf3292769536.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mark_1_ab9642000a9e81712bf7bf3292769536.json
new file mode 100644
index 0000000000..4682fdb378
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mark_1_ab9642000a9e81712bf7bf3292769536.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the bold style from the second block\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkg7742tsvz3Vw2KqTVDTDoVHy0\",\n \"object\": \"chat.completion\",\n \"created\": 1747168974,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_bAj2M3Ys3KLWeIGFrhY7Z5x9\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello, @John Doe! How are you doing? This text is blue!
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 641,\n \"completion_tokens\": 67,\n \"total_tokens\": 708,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mention_1_aedf9aba96ec8de63204dc0bd079cce0.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mention_1_aedf9aba96ec8de63204dc0bd079cce0.json
new file mode 100644
index 0000000000..f1b1f34ecf
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mention_1_aedf9aba96ec8de63204dc0bd079cce0.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change to say 'Hello! How are you doing? This text is blue!' (remove mention but keep bold text)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkgpOzkqHLvdNcMo8lQGkI9UXox\",\n \"object\": \"chat.completion\",\n \"created\": 1747168974,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_1DycPDLwfdDFdMArxeXPOKcW\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello! How are you doing?This text is blue!
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 657,\n \"completion_tokens\": 50,\n \"total_tokens\": 707,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, replace content_1_4032f8de849b4d06146cea086f5faee0.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, replace content_1_4032f8de849b4d06146cea086f5faee0.json
new file mode 100644
index 0000000000..a8977a8cc5
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, replace content_1_4032f8de849b4d06146cea086f5faee0.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the content of the second block to 'Hello, updated content'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkegG3PZmqLVm1meiXbHmrGwf8C\",\n \"object\": \"chat.completion\",\n \"created\": 1747168972,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_fwGBaGYdH2xUlCuNxx234ywU\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello, updated content
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 647,\n \"completion_tokens\": 28,\n \"total_tokens\": 675,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update mention prop_1_37c8ad3a742c0e37960ee3c688ecff05.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update mention prop_1_37c8ad3a742c0e37960ee3c688ecff05.json
new file mode 100644
index 0000000000..edc59f1d7f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update mention prop_1_37c8ad3a742c0e37960ee3c688ecff05.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the mention to Jane Doe\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkkJAZDzWzkCHB9MQxwvczzyRlm\",\n \"object\": \"chat.completion\",\n \"created\": 1747168978,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_c6jd3ZEfnfQPQkJtSBV9iyoW\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello, @Jane Doe! How are you doing?This text is blue!
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 639,\n \"completion_tokens\": 72,\n \"total_tokens\": 711,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update text_1_34b0f8d08eec54b64843fe3f13048db5.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update text_1_34b0f8d08eec54b64843fe3f13048db5.json
new file mode 100644
index 0000000000..f03561ce87
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update text_1_34b0f8d08eec54b64843fe3f13048db5.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the second block to german (use dir instead of Ihnen)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkeYm8vvu5pA3qQjJpWggdHIYA6\",\n \"object\": \"chat.completion\",\n \"created\": 1747168972,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_4H2rxFWEiIn56TjuLtRUXanW\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hallo, @John Doe! Wie geht es dir?Dieser Text ist blau!
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 646,\n \"completion_tokens\": 73,\n \"total_tokens\": 719,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (paragraph)_1_15ae85e2a52e28738a9cd2f4585a5e87.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (paragraph)_1_15ae85e2a52e28738a9cd2f4585a5e87.json
new file mode 100644
index 0000000000..4e8b8eec86
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (paragraph)_1_15ae85e2a52e28738a9cd2f4585a5e87.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make first paragraph bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkiruFq0drWUJNkaILrokIvismb\",\n \"object\": \"chat.completion\",\n \"created\": 1747168976,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_lvFqJSQTq9rKxWxxxcC0lna1\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
Hello, world!
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 637,\n \"completion_tokens\": 31,\n \"total_tokens\": 668,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (word)_1_49c10b96b8a5342b3afe37277f0b2ec0.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (word)_1_49c10b96b8a5342b3afe37277f0b2ec0.json
new file mode 100644
index 0000000000..72795bf190
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (word)_1_49c10b96b8a5342b3afe37277f0b2ec0.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make 'world!' (in the first block) bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkhH7ZkRMzXcPEyPyMtAfSl0q7M\",\n \"object\": \"chat.completion\",\n \"created\": 1747168975,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_dc9AaXzRl8SZJGemA4fj9O3C\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
Hello, world!
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 644,\n \"completion_tokens\": 32,\n \"total_tokens\": 676,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/translate selection_1_83bf8aa261516bf197d1391294bbcb06.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/translate selection_1_83bf8aa261516bf197d1391294bbcb06.json
new file mode 100644
index 0000000000..626afba42e
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/translate selection_1_83bf8aa261516bf197d1391294bbcb06.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
Hello, world!
\\\"},{\\\"block\\\":\\\"
Hello, @John Doe! How are you doing?This text is blue!
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkcal3aOZF5sNUOnO2DA4ELI4iE\",\n \"object\": \"chat.completion\",\n \"created\": 1747168970,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_tgvHk6geMECeFHlcsypMz7qv\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hallo
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 486,\n \"completion_tokens\": 26,\n \"total_tokens\": 512,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/turn paragraphs into list_1_5aa207db4b8600962363d2352bf0b1c4.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/turn paragraphs into list_1_5aa207db4b8600962363d2352bf0b1c4.json
new file mode 100644
index 0000000000..d6618a5bba
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/turn paragraphs into list_1_5aa207db4b8600962363d2352bf0b1c4.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
I need to buy:
\\\"},{\\\"block\\\":\\\"
Apples
\\\"},{\\\"block\\\":\\\"
Bananas
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"turn into list (update existing blocks)\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkmieGpQtfts5lKnjlCp8T5CeoL\",\n \"object\": \"chat.completion\",\n \"created\": 1747168980,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_r7mVrgv8IXbHrj68ly8624uD\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 432,\n \"completion_tokens\": 56,\n \"total_tokens\": 488,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type and content_1_fa30ce9145d3237fa4a0b86a61965fb3.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type and content_1_fa30ce9145d3237fa4a0b86a61965fb3.json
new file mode 100644
index 0000000000..e19ea541dc
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type and content_1_fa30ce9145d3237fa4a0b86a61965fb3.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading and update the content to 'What's up, world!'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkd9pJn9E1Z10s4u84REH0YaeeA\",\n \"object\": \"chat.completion\",\n \"created\": 1747168971,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_neNUR3kpEptJ792Tsmcjxav1\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
What's up, world!
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 650,\n \"completion_tokens\": 31,\n \"total_tokens\": 681,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type_1_e5c648bb981ba9ce20b93054446c721d.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type_1_e5c648bb981ba9ce20b93054446c721d.json
new file mode 100644
index 0000000000..66a99e8e25
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type_1_e5c648bb981ba9ce20b93054446c721d.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWqkchw6SJ4PhIfFtYUXhYpmb8L9a\",\n \"object\": \"chat.completion\",\n \"created\": 1747168970,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_vRohlIT6lo5riUfJ4Hz9hbX7\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
Hello, world!
\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 639,\n \"completion_tokens\": 29,\n \"total_tokens\": 668,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link and change text within mark_1_148394a5f5658c93445adc9e68410296.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link and change text within mark_1_148394a5f5658c93445adc9e68410296.json
new file mode 100644
index 0000000000..d1d27a6242
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link and change text within mark_1_148394a5f5658c93445adc9e68410296.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change the last paragraph to 'Hi, world! Bold the text. Link.' without any markup like bold or link\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_Ywudl1L4gDgCPUFVKkp26zOR\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"3\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hi\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Bold\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" the\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\".\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Link\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\".\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkOjLUePMqz2QAuhJATQR1oSWGz\",\"object\":\"chat.completion.chunk\",\"created\":1747168956,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link_1_b61d90f1021054f8bcf1258cf9d11fe4.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link_1_b61d90f1021054f8bcf1258cf9d11fe4.json
new file mode 100644
index 0000000000..53977a3aaa
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link_1_b61d90f1021054f8bcf1258cf9d11fe4.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the formatting (turn into plain text without styles or urls) from the last paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_d9ZE4NvY8J9Mty8ZHgLCuxfl\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"3\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Bold\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\".\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Link\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\".\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkN7tbkbvLWO8PjXOXTN3RoZjbv\",\"object\":\"chat.completion.chunk\",\"created\":1747168955,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify nested content_1_6dcc3499f6996bd4b16327d079c23b21.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify nested content_1_6dcc3499f6996bd4b16327d079c23b21.json
new file mode 100644
index 0000000000..7da24d6f68
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify nested content_1_6dcc3499f6996bd4b16327d079c23b21.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make apples uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_k59S1viUoYxxLprsCaBxRtd8\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"APP\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"LES\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkQDnTr7Q2auXqwWTO4EKDXQVc2\",\"object\":\"chat.completion.chunk\",\"created\":1747168958,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify parent content_1_efbe6b2b8f77c628de12b4ae99dc6939.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify parent content_1_efbe6b2b8f77c628de12b4ae99dc6939.json
new file mode 100644
index 0000000000..67b6cc555a
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify parent content_1_efbe6b2b8f77c628de12b4ae99dc6939.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_TwvjyLsNJYpFoIaBbuo6wWoM\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">I\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" NEED\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" TO\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" BUY\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkRTiWVG7hyLw56o6FKEeBff0j1\",\"object\":\"chat.completion.chunk\",\"created\":1747168959,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/plain source block, add mention_1_c3ec555a7988880acc8c448befdc501d.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/plain source block, add mention_1_c3ec555a7988880acc8c448befdc501d.json
new file mode 100644
index 0000000000..32f0803abb
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/plain source block, add mention_1_c3ec555a7988880acc8c448befdc501d.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"Change the first paragraph to Hello, Jane Doe! (use a mention)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_0dUoQVzwhkWYr3VI0DMuss8e\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" <\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-inline\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"mention\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-user\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Jane\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Doe\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"@\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Jane\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Doe\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkLlStJknAs3KFCjOZ2bbWndZ2A\",\"object\":\"chat.completion.chunk\",\"created\":1747168953,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/standard update_1_7f328ec2574aff0eba83678fedea486a.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/standard update_1_7f328ec2574aff0eba83678fedea486a.json
new file mode 100644
index 0000000000..5deb24e441
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/standard update_1_7f328ec2574aff0eba83678fedea486a.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the first paragraph to german\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_IJ8IpdMlslzhzfdwBboizrUH\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hallo\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Welt\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkDbVtRvJz2liSgRrwiTNMTs9ds\",\"object\":\"chat.completion.chunk\",\"created\":1747168945,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mark_1_2246a490805512b4459ec130c3f7b028.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mark_1_2246a490805512b4459ec130c3f7b028.json
new file mode 100644
index 0000000000..ed8e5f7bff
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mark_1_2246a490805512b4459ec130c3f7b028.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the bold style from the second block\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_QbyVmagsf2w4MsiEXDEbbcP5\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" <\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-inline\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"mention\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-user\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"John\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Doe\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"@\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"John\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Doe\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" How\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" are\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" you\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" doing\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"?\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" <\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-color\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"This\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" is\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkIqocpARJWkUq0YTzldJh1Inm5\",\"object\":\"chat.completion.chunk\",\"created\":1747168950,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mention_1_089c1b96e5eef0e337d6ae0646f3670d.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mention_1_089c1b96e5eef0e337d6ae0646f3670d.json
new file mode 100644
index 0000000000..0e6bb7226f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mention_1_089c1b96e5eef0e337d6ae0646f3670d.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change to say 'Hello! How are you doing? This text is blue!' (remove mention but keep bold text)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_wwIQpmkHe8SQ3USVu06o21Be\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" <\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"strong\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"How\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" are\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" you\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" doing\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"?\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"strong\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" <\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-color\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"This\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" is\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkJDC6ot8bMQtPexyrBTlswOSUT\",\"object\":\"chat.completion.chunk\",\"created\":1747168951,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, replace content_1_1b70479170637ef990c696b81982a9ff.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, replace content_1_1b70479170637ef990c696b81982a9ff.json
new file mode 100644
index 0000000000..d0e0f1189e
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, replace content_1_1b70479170637ef990c696b81982a9ff.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the content of the second block to 'Hello, updated content'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_T8WXnadY1zixXWU46VH5q9G5\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" updated\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkG0QzWFMfbHTlApj79mDnYifdJ\",\"object\":\"chat.completion.chunk\",\"created\":1747168948,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update mention prop_1_8fc18a40e2b4ccc90a9be4a3a826572b.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update mention prop_1_8fc18a40e2b4ccc90a9be4a3a826572b.json
new file mode 100644
index 0000000000..ac8eef2246
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update mention prop_1_8fc18a40e2b4ccc90a9be4a3a826572b.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the mention to Jane Doe\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_hokkOq370TmEwqpfuLhIJ4St\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" <\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-inline\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"mention\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-user\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Jane\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Doe\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"@\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Jane\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Doe\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" <\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"strong\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"How\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" are\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" you\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" doing\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"?\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"strong\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" <\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-color\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"This\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" is\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkMNbYsFehuF5xG00FsShvcK4OC\",\"object\":\"chat.completion.chunk\",\"created\":1747168954,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update text_1_7187509500683cd511ef79bc79adf45e.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update text_1_7187509500683cd511ef79bc79adf45e.json
new file mode 100644
index 0000000000..4eb5b3b881
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update text_1_7187509500683cd511ef79bc79adf45e.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the second block to german (use dir instead of Ihnen)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_frjyNtG0IpYqmxLpQwQOG5Y4\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hallo\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" <\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-inline\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"mention\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-user\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"John\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Doe\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"@\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"John\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Doe\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" <\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"strong\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Wie\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" geht\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" es\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" dir\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"?\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"strong\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" <\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" data\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"-color\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"=\\\\\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\\\\\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Dieser\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" ist\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" blau\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"span\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkHogZhQ3zKtcCybq64BLBicrav\",\"object\":\"chat.completion.chunk\",\"created\":1747168949,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (paragraph)_1_263f9c25f7a85f762b255a3778136737.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (paragraph)_1_263f9c25f7a85f762b255a3778136737.json
new file mode 100644
index 0000000000..b6a12d093f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (paragraph)_1_263f9c25f7a85f762b255a3778136737.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make first paragraph bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_wgPCxMlbD9DHuAJwtg38ehxz\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"><\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"strong\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"strong\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkK05kQqI4KRs1Ur1DdRBfajY8S\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (word)_1_030b36dcdf89ff60ac373c9797f5caa8.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (word)_1_030b36dcdf89ff60ac373c9797f5caa8.json
new file mode 100644
index 0000000000..3dbcb9eabf
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (word)_1_030b36dcdf89ff60ac373c9797f5caa8.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make 'world!' (in the first block) bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_geCwkiPxyVrvig4NRdgkmyRI\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" <\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"strong\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"strong\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkKySFjjxWJ0IxN9yEYqDpF6PIl\",\"object\":\"chat.completion.chunk\",\"created\":1747168952,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/translate selection_1_8cfca4c1847085a8a31be1818346738e.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/translate selection_1_8cfca4c1847085a8a31be1818346738e.json
new file mode 100644
index 0000000000..f7a50bf1ef
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/translate selection_1_8cfca4c1847085a8a31be1818346738e.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
Hello
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
Hello, world!
\\\"},{\\\"block\\\":\\\"
Hello, @John Doe! How are you doing?This text is blue!
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_zfp1IUk7MXxKLSvkBi2PtTI9\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hallo\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"p\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkEIPvCGeGIb7CtsVFhSVDE2FLe\",\"object\":\"chat.completion.chunk\",\"created\":1747168946,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_2f31610c836b996af773c3856634d5c3.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_2f31610c836b996af773c3856634d5c3.json
new file mode 100644
index 0000000000..2f978dc6b0
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_2f31610c836b996af773c3856634d5c3.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using HTML blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n This is the selection as an array of html blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":\\\"
I need to buy:
\\\"},{\\\"block\\\":\\\"
Apples
\\\"},{\\\"block\\\":\\\"
Bananas
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"turn into list (update existing blocks)\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_pPMwmIHfpO78UT2ykRTVpvyc\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ul\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"><\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"li\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Ap\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ples\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"li\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ul\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"3\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ul\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"><\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"li\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Ban\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"anas\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"li\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ul\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkPO8f1ejPGxfuh5bD6KvITfC5O\",\"object\":\"chat.completion.chunk\",\"created\":1747168957,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type and content_1_6bc68512d0085273aa59c32b20ff22b9.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type and content_1_6bc68512d0085273aa59c32b20ff22b9.json
new file mode 100644
index 0000000000..da3e985d09
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type and content_1_6bc68512d0085273aa59c32b20ff22b9.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading and update the content to 'What's up, world!'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_IX7LlAzM6PPGOI1Qnpr6bOpm\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"h\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"What's\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" up\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"h\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkFGCEOYzwx2GQHjFEOVgxl7hKh\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type_1_171c87db8855dba2d6bbcd06ae45fbb5.json b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type_1_171c87db8855dba2d6bbcd06ae45fbb5.json
new file mode 100644
index 0000000000..a0c964cc22
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type_1_171c87db8855dba2d6bbcd06ae45fbb5.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using HTML blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n List items are 1 block with 1 list item each, so block content `
item1
` is valid, but `
item1
item2
` is invalid. We'll merge them automatically.\\n For code blocks, you can use the `data-language` attribute on a code block to specify the language.\\n This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"
\\\"}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"block\":{\"type\":\"string\",\"description\":\"html of block (MUST be a single HTML element)\"}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_uez7hpYYOHyE6FnFSOC9goav\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"<\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"h\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"h\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\">\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWqkF74wFw0p90zCFHF8ZdxO2b3mk\",\"object\":\"chat.completion.chunk\",\"created\":1747168947,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/html-blocks/defaultHTMLPromptBuilder.ts b/packages/xl-ai/src/api/formats/html-blocks/defaultHTMLPromptBuilder.ts
new file mode 100644
index 0000000000..ad332657e2
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/defaultHTMLPromptBuilder.ts
@@ -0,0 +1,172 @@
+import { CoreMessage } from "ai";
+import type { PromptBuilder } from "../PromptBuilder.js";
+import {
+ getDataForPromptNoSelection,
+ getDataForPromptWithSelection,
+} from "./htmlPromptData.js";
+
+function promptManipulateSelectionHTMLBlocks(opts: {
+ userPrompt: string;
+ htmlSelectedBlocks: {
+ id: string;
+ block: string;
+ }[];
+ htmlDocument: {
+ block: string;
+ }[];
+}): Array {
+ return [
+ {
+ role: "system",
+ content: `You're manipulating a selected part of a text document using HTML blocks.
+ Make sure to follow the json schema provided and always include the trailing $ in ids.
+ List items are 1 block with 1 list item each, so block content \`
item1
\` is valid, but \`
item1
item2
\` is invalid. We'll merge them automatically.
+ This is the selection as an array of html blocks:`,
+ },
+ {
+ role: "system",
+ content: JSON.stringify(opts.htmlSelectedBlocks),
+ },
+ {
+ role: "system",
+ content:
+ "This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:",
+ },
+ {
+ role: "system",
+ content: JSON.stringify(opts.htmlDocument),
+ },
+ {
+ role: "system",
+ content: "The user asks you to do the following:",
+ },
+ {
+ role: "user",
+ content: opts.userPrompt,
+ },
+ ];
+}
+
+function promptManipulateDocumentUseHTMLBlocks(opts: {
+ userPrompt: string;
+ htmlBlocks: Array<
+ | {
+ id: string;
+ block: string;
+ }
+ | {
+ cursor: true;
+ }
+ >;
+}): Array {
+ return [
+ {
+ role: "system",
+ content: `You're manipulating a text document using HTML blocks.
+ Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $).
+ List items are 1 block with 1 list item each, so block content \`
item1
\` is valid, but \`
item1
item2
\` is invalid. We'll merge them automatically.
+ For code blocks, you can use the \`data-language\` attribute on a code block to specify the language.
+ This is the document as an array of html blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):`,
+ },
+ {
+ role: "system",
+ content: JSON.stringify(opts.htmlBlocks),
+ },
+ {
+ role: "system",
+ content: "The user asks you to do the following:",
+ },
+ {
+ role: "user",
+ content: opts.userPrompt,
+ },
+ {
+ role: "system",
+ content: `First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.
+ EXAMPLE: if user says "below" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor.
+ EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need \`referenceId\` to point to the block before the cursor with position \`after\` (or block below and \`before\`).
+
+ Prefer updating existing blocks over removing and adding (but this also depends on the user's question).`,
+ },
+ ];
+}
+
+export const defaultHTMLPromptBuilder: PromptBuilder = async (editor, opts) => {
+ if (opts.selectedBlocks) {
+ const data = await getDataForPromptWithSelection(editor, {
+ selectedBlocks: opts.selectedBlocks,
+ });
+
+ if (opts.previousMessages) {
+ return [
+ ...opts.previousMessages,
+ {
+ role: "system",
+ content: `After processing the previous response, this is the updated selection.
+ Ignore previous documents, you MUST issue operations against this latest version of the document:`,
+ },
+ {
+ role: "system",
+ content: JSON.stringify(data.htmlSelectedBlocks),
+ },
+ {
+ role: "system",
+ content: "This is the updated entire document:",
+ },
+ {
+ role: "system",
+ content: JSON.stringify(data.htmlDocument),
+ },
+ {
+ role: "system",
+ content: `You SHOULD use "update" operations to update blocks you added / edited previously
+ (unless the user explicitly asks you otherwise to add or delete other blocks).
+
+ The user now asks you to do the following:`,
+ },
+ {
+ role: "user",
+ content: opts.userPrompt,
+ },
+ ];
+ }
+
+ return promptManipulateSelectionHTMLBlocks({
+ ...data,
+ userPrompt: opts.userPrompt,
+ });
+ } else {
+ const data = await getDataForPromptNoSelection(editor, opts);
+
+ if (opts.previousMessages) {
+ return [
+ ...opts.previousMessages,
+ {
+ role: "system",
+ content: `After processing the previous response, this is the updated document.
+ Ignore previous documents, you MUST issue operations against this latest version of the document:`,
+ },
+ {
+ role: "system",
+ content: JSON.stringify(data.htmlBlocks),
+ },
+ {
+ role: "system",
+ content: `You SHOULD use "update" operations to update blocks you added / edited previously
+ (unless the user explicitly asks you otherwise to add or delete other blocks).
+
+ The user now asks you to do the following:`,
+ },
+ {
+ role: "user",
+ content: opts.userPrompt,
+ },
+ ];
+ }
+
+ return promptManipulateDocumentUseHTMLBlocks({
+ ...data,
+ userPrompt: opts.userPrompt,
+ });
+ }
+};
diff --git a/packages/xl-ai/src/api/formats/html-blocks/htmlBlocks.test.ts b/packages/xl-ai/src/api/formats/html-blocks/htmlBlocks.test.ts
new file mode 100644
index 0000000000..594ffaa262
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/htmlBlocks.test.ts
@@ -0,0 +1,132 @@
+import { getCurrentTest } from "@vitest/runner";
+import { getSortedEntries, snapshot, toHashString } from "msw-snapshot";
+import { setupServer } from "msw/node";
+import path from "path";
+import { afterAll, afterEach, beforeAll, describe } from "vitest";
+import { testAIModels } from "../../../testUtil/testAIModels.js";
+import { doLLMRequest } from "../../LLMRequest.js";
+import { generateSharedTestCases } from "../tests/sharedTestCases.js";
+import { htmlBlockLLMFormat } from "./htmlBlocks.js";
+
+const BASE_FILE_PATH = path.resolve(
+ __dirname,
+ "__snapshots__",
+ path.basename(__filename),
+);
+
+const fetchCountMap: Record = {};
+
+async function createRequestHash(req: Request) {
+ const url = new URL(req.url);
+ return [
+ // url.host,
+ // url.pathname,
+ toHashString([
+ req.method,
+ url.origin,
+ url.pathname,
+ getSortedEntries(url.searchParams),
+ getSortedEntries(req.headers),
+ // getSortedEntries(req.cookies),
+ new TextDecoder("utf-8").decode(await req.arrayBuffer()),
+ ]),
+ ].join("/");
+}
+
+// Main test suite with snapshot middleware
+describe("Models", () => {
+ // Define server with snapshot middleware for the main tests
+ const server = setupServer(
+ snapshot({
+ updateSnapshots: "missing",
+ // onSnapshotUpdated: "all",
+ // ignoreSnapshots: true,
+ async createSnapshotPath(info) {
+ // use a unique path for each model
+ const t = getCurrentTest()!;
+ const mswPath = path.join(
+ t.suite!.name, // same directory as the test snapshot
+ "__msw_snapshots__",
+ t.suite!.suite!.name, // model / streaming params
+ t.name,
+ );
+ // in case there are multiple requests in a test, we need to use a separate snapshot for each request
+ fetchCountMap[mswPath] = (fetchCountMap[mswPath] || 0) + 1;
+ const hash = await createRequestHash(info.request);
+ return mswPath + `_${fetchCountMap[mswPath]}_${hash}.json`;
+ },
+ basePath: BASE_FILE_PATH,
+ // onFetchFromSnapshot(info, snapshot) {
+ // console.log("onFetchFromSnapshot", info, snapshot);
+ // },
+ // onFetchFromServer(info, snapshot) {
+ // console.log("onFetchFromServer", info, snapshot);
+ // },
+ }),
+ );
+
+ beforeAll(() => {
+ server.listen();
+ });
+
+ afterAll(() => {
+ server.close();
+ });
+
+ afterEach(() => {
+ delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS;
+ });
+
+ const testMatrix = [
+ {
+ model: testAIModels.openai,
+ stream: true,
+ },
+ {
+ model: testAIModels.openai,
+ stream: false,
+ },
+ {
+ model: testAIModels.groq,
+ stream: true,
+ },
+ {
+ model: testAIModels.groq,
+ stream: false,
+ },
+ // currently doesn't support streaming
+ // https://github.com/vercel/ai/issues/5350
+ // {
+ // model: testAIModels.albert,
+ // stream: true,
+ // },
+ // This works for most prompts, but not all (would probably need a llama upgrade?)
+ // {
+ // model: testAIModels.albert,
+ // stream: false,
+ // },
+ ];
+
+ for (const params of testMatrix) {
+ describe(`${params.model.provider}/${params.model.modelId} (${
+ params.stream ? "streaming" : "non-streaming"
+ })`, () => {
+ generateSharedTestCases(
+ (editor, options) =>
+ doLLMRequest(editor, {
+ ...options,
+ dataFormat: htmlBlockLLMFormat,
+ model: params.model,
+ maxRetries: 0,
+ stream: params.stream,
+ withDelays: false,
+ }),
+ // TODO: remove when matthew's parsing PR is merged
+ {
+ textAlignment: true,
+ blockColor: true,
+ },
+ );
+ });
+ }
+});
diff --git a/packages/xl-ai/src/api/formats/html-blocks/htmlBlocks.ts b/packages/xl-ai/src/api/formats/html-blocks/htmlBlocks.ts
new file mode 100644
index 0000000000..e819271f58
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/htmlBlocks.ts
@@ -0,0 +1,74 @@
+import { BlockNoteEditor } from "@blocknote/core";
+import { StreamTool } from "../../../streamTool/streamTool.js";
+
+import { defaultHTMLPromptBuilder } from "./defaultHTMLPromptBuilder.js";
+import {
+ getDataForPromptNoSelection,
+ getDataForPromptWithSelection,
+} from "./htmlPromptData.js";
+import { tools } from "./tools/index.js";
+
+function getStreamTools(
+ editor: BlockNoteEditor,
+ withDelays: boolean,
+ defaultStreamTools?: {
+ /** Enable the add tool (default: true) */
+ add?: boolean;
+ /** Enable the update tool (default: true) */
+ update?: boolean;
+ /** Enable the delete tool (default: true) */
+ delete?: boolean;
+ },
+ selectionInfo?: {
+ from: number;
+ to: number;
+ },
+ onBlockUpdate?: (blockId: string) => void,
+) {
+ const mergedStreamTools = {
+ add: true,
+ update: true,
+ delete: true,
+ ...defaultStreamTools,
+ };
+
+ const streamTools: StreamTool[] = [
+ ...(mergedStreamTools.update
+ ? [
+ tools.update(editor, {
+ idsSuffixed: true,
+ withDelays,
+ updateSelection: selectionInfo,
+ onBlockUpdate,
+ }),
+ ]
+ : []),
+ ...(mergedStreamTools.add
+ ? [tools.add(editor, { idsSuffixed: true, withDelays, onBlockUpdate })]
+ : []),
+ ...(mergedStreamTools.delete
+ ? [tools.delete(editor, { idsSuffixed: true, withDelays, onBlockUpdate })]
+ : []),
+ ];
+
+ return streamTools;
+}
+
+export const htmlBlockLLMFormat = {
+ /**
+ * Function to get the stream tools that can apply HTML block updates to the editor
+ */
+ getStreamTools,
+ /**
+ * The default PromptBuilder that determines how a userPrompt is converted to an array of
+ * LLM Messages (CoreMessage[])
+ */
+ defaultPromptBuilder: defaultHTMLPromptBuilder,
+ /**
+ * Helper functions which can be used when implementing a custom PromptBuilder
+ */
+ promptHelpers: {
+ getDataForPromptNoSelection,
+ getDataForPromptWithSelection,
+ },
+};
diff --git a/packages/xl-ai/src/api/formats/html-blocks/htmlPromptData.ts b/packages/xl-ai/src/api/formats/html-blocks/htmlPromptData.ts
new file mode 100644
index 0000000000..5949509702
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/htmlPromptData.ts
@@ -0,0 +1,53 @@
+import { Block, BlockNoteEditor } from "@blocknote/core";
+import { addCursorPosition } from "../../promptHelpers/addCursorPosition.js";
+import { convertBlocks } from "../../promptHelpers/convertBlocks.js";
+import { flattenBlocks } from "../../promptHelpers/flattenBlocks.js";
+import { suffixIDs } from "../../promptHelpers/suffixIds.js";
+import { trimEmptyBlocks } from "../../promptHelpers/trimEmptyBlocks.js";
+
+export async function getDataForPromptNoSelection(
+ editor: BlockNoteEditor,
+ opts: {
+ excludeBlockIds?: string[];
+ },
+) {
+ const input = trimEmptyBlocks(editor.document);
+ const blockArray = await convertBlocks(
+ flattenBlocks(input),
+ async (block) => {
+ return editor.blocksToHTMLLossy([block]);
+ },
+ );
+ const withCursor = addCursorPosition(editor, blockArray);
+ const filtered = withCursor.filter(
+ (b) => "cursor" in b || !(opts.excludeBlockIds || []).includes(b.id),
+ );
+ const suffixed = suffixIDs(filtered);
+ return {
+ htmlBlocks: suffixed,
+ };
+}
+
+export async function getDataForPromptWithSelection(
+ editor: BlockNoteEditor,
+ opts: {
+ selectedBlocks: Block[];
+ },
+) {
+ const blockArray = await convertBlocks(
+ flattenBlocks(opts.selectedBlocks),
+ async (block) => {
+ return editor.blocksToHTMLLossy([block]);
+ },
+ );
+ const suffixed = suffixIDs(blockArray);
+
+ return {
+ htmlSelectedBlocks: suffixed,
+ htmlDocument: (
+ await convertBlocks(flattenBlocks(editor.document), async (block) => {
+ return editor.blocksToHTMLLossy([block]);
+ })
+ ).map(({ block }) => ({ block })), // strip ids so LLM can't accidentally issue updates to ids not in selection
+ };
+}
diff --git a/packages/xl-ai/src/api/formats/html-blocks/tools/getPartialHTML.test.ts b/packages/xl-ai/src/api/formats/html-blocks/tools/getPartialHTML.test.ts
new file mode 100644
index 0000000000..e0cd84b92a
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/tools/getPartialHTML.test.ts
@@ -0,0 +1,76 @@
+import { describe, expect, it } from "vitest";
+import { getPartialHTML } from "./getPartialHTML.js";
+
+describe("getPartialHTML", () => {
+ // Test cases from the function's documentation
+ it("completes simple paragraph tag", () => {
+ expect(getPartialHTML("
hello")).toBe("
hello
");
+ });
+
+ it("handles incomplete tag at the end", () => {
+ expect(getPartialHTML("
hello hello
");
+ });
+
+ it("handles incomplete tag with content", () => {
+ expect(getPartialHTML("
");
+ });
+
+ it("returns undefined for only incomplete tag", () => {
+ expect(getPartialHTML("<")).toBeUndefined();
+ });
+
+ it("handles attributes in incomplete tags", () => {
+ expect(getPartialHTML('
hello ->
hello
+ *
hello
hello
+ *
hello
hello
+ *
hello ->
hello
+ *
hello world ->
hello world
+ *
hello world ->
hello world
+ *
+ * @param html A potentially incomplete HTML string
+ * @returns A properly formed HTML string with all tags closed
+ */
+export function getPartialHTML(html: string): string | undefined {
+ // Simple check: if the last '<' doesn't have a matching '>',
+ // then we have an incomplete tag at the end
+ const lastOpenBracket = html.lastIndexOf("<");
+ const lastCloseBracket = html.lastIndexOf(">");
+
+ // Handle incomplete tags by removing everything after the last complete tag
+ let htmlToProcess = html;
+ if (lastOpenBracket > lastCloseBracket) {
+ htmlToProcess = html.substring(0, lastOpenBracket);
+ // If nothing remains after removing the incomplete tag, return empty string
+ if (!htmlToProcess.trim()) {
+ return undefined;
+ }
+ }
+
+ // if we're half-way through an entity tag that isn't closed, we need to remove the entity tag
+ const match = htmlToProcess.match(/&[a-zA-Z0-9]*$/);
+ if (match) {
+ htmlToProcess = htmlToProcess.substring(
+ 0,
+ htmlToProcess.length - match[0].length,
+ );
+ }
+
+ // Parse the HTML
+ const parser = new DOMParser();
+ const doc = parser.parseFromString(
+ `
${htmlToProcess}
`,
+ "text/html",
+ );
+ const el = doc.body.firstChild as HTMLElement;
+ return el ? el.innerHTML : "";
+}
diff --git a/packages/xl-ai/src/api/formats/html-blocks/tools/index.ts b/packages/xl-ai/src/api/formats/html-blocks/tools/index.ts
new file mode 100644
index 0000000000..054d809823
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/tools/index.ts
@@ -0,0 +1,112 @@
+import { PartialBlock } from "@blocknote/core";
+import {
+ AddBlocksToolCall,
+ createAddBlocksTool,
+} from "../../base-tools/createAddBlocksTool.js";
+import {
+ createUpdateBlockTool,
+ UpdateBlockToolCall,
+} from "../../base-tools/createUpdateBlockTool.js";
+import { deleteBlockTool } from "../../base-tools/delete.js";
+import { getPartialHTML } from "./getPartialHTML.js";
+import { createHTMLRebaseTool } from "./rebaseTool.js";
+import { validateBlockFunction } from "./validate.js";
+
+export const tools = {
+ add: createAddBlocksTool({
+ description: "Insert new blocks",
+ schema: {
+ block: {
+ $ref: "#/$defs/block",
+ },
+ $defs: {
+ block: {
+ type: "string",
+ description: "html of block (MUST be a single HTML element)",
+ },
+ },
+ },
+ validateBlock: validateBlockFunction,
+ rebaseTool: createHTMLRebaseTool,
+ toJSONToolCall: async (editor, chunk) => {
+ const initialMockID = (window as any).__TEST_OPTIONS?.mockID;
+
+ const blocks = (
+ await Promise.all(
+ chunk.operation.blocks.map(async (html) => {
+ const parsedHtml = chunk.isPossiblyPartial
+ ? getPartialHTML(html)
+ : html;
+ if (!parsedHtml) {
+ return [];
+ }
+ return (await editor.tryParseHTMLToBlocks(parsedHtml)).map(
+ (block) => {
+ delete (block as any).id;
+ return block;
+ },
+ );
+ }),
+ )
+ ).flat();
+
+ // hacky
+ if ((window as any).__TEST_OPTIONS) {
+ (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS.mockID =
+ initialMockID;
+ }
+
+ if (blocks.length === 0) {
+ return undefined;
+ }
+
+ return {
+ ...chunk.operation,
+ blocks,
+ } satisfies AddBlocksToolCall>;
+ },
+ }),
+ update: createUpdateBlockTool({
+ description: "Update a block",
+ schema: {
+ block: {
+ $ref: "#/$defs/block",
+ },
+ $defs: {
+ block: {
+ type: "string",
+ description: "html of block (MUST be a single HTML element)",
+ },
+ },
+ },
+ validateBlock: validateBlockFunction,
+ rebaseTool: createHTMLRebaseTool,
+ toJSONToolCall: async (editor, chunk) => {
+ const html = chunk.isPossiblyPartial
+ ? getPartialHTML(chunk.operation.block)
+ : chunk.operation.block;
+
+ if (!html) {
+ return undefined;
+ }
+
+ const block = (await editor.tryParseHTMLToBlocks(html))[0];
+
+ // console.log("update", operation.block);
+ // console.log("html", html);
+ // hacky
+ if ((window as any).__TEST_OPTIONS) {
+ (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS.mockID =
+ undefined;
+ }
+
+ delete (block as any).id;
+
+ return {
+ ...chunk.operation,
+ block,
+ } satisfies UpdateBlockToolCall>;
+ },
+ }),
+ delete: deleteBlockTool,
+};
diff --git a/packages/xl-ai/src/api/formats/html-blocks/tools/rebaseTool.ts b/packages/xl-ai/src/api/formats/html-blocks/tools/rebaseTool.ts
new file mode 100644
index 0000000000..7e949c02f6
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/tools/rebaseTool.ts
@@ -0,0 +1,56 @@
+import { BlockNoteEditor, getBlock } from "@blocknote/core";
+import { updateToReplaceSteps } from "../../../../prosemirror/changeset.js";
+import {
+ getApplySuggestionsTr,
+ rebaseTool,
+} from "../../../../prosemirror/rebaseTool.js";
+
+export async function createHTMLRebaseTool(
+ id: string,
+ editor: BlockNoteEditor,
+) {
+ const tr = getApplySuggestionsTr(editor);
+ const block = getBlock(tr.doc, id);
+ if (!block) {
+ throw new Error("block not found");
+ }
+
+ const html = await editor.blocksToHTMLLossy([
+ {
+ ...block,
+ children: [],
+ },
+ ]);
+
+ const initialMockID = (window as any).__TEST_OPTIONS?.mockID;
+
+ const blocks = await editor.tryParseHTMLToBlocks(html);
+
+ // hacky
+ if ((window as any).__TEST_OPTIONS) {
+ (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS.mockID =
+ initialMockID;
+ }
+
+ if (blocks.length !== 1) {
+ throw new Error("html diff invalid block count");
+ }
+
+ const htmlBlock = blocks[0];
+ htmlBlock.id = id;
+
+ const steps = updateToReplaceSteps(
+ {
+ id,
+ block: htmlBlock,
+ },
+ tr.doc,
+ );
+
+ if (steps.length) {
+ // console.error("html diff", steps);
+ throw new Error("html diff");
+ }
+
+ return rebaseTool(editor, tr);
+}
diff --git a/packages/xl-ai/src/api/formats/html-blocks/tools/validate.ts b/packages/xl-ai/src/api/formats/html-blocks/tools/validate.ts
new file mode 100644
index 0000000000..3468cdd80f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/html-blocks/tools/validate.ts
@@ -0,0 +1,15 @@
+import { Result } from "../../../../streamTool/streamTool.js";
+
+export function validateBlockFunction(block: any): Result {
+ if (typeof block !== "string") {
+ return {
+ ok: false,
+ error: "block must be a string",
+ };
+ }
+
+ return {
+ ok: true,
+ value: block,
+ };
+}
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/Add heading (h1) and code block_1_4b13d164d4335cc9e201d217c288f3a0.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/Add heading (h1) and code block_1_4b13d164d4335cc9e201d217c288f3a0.json
new file mode 100644
index 0000000000..f0671f8fd7
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/Add heading (h1) and code block_1_4b13d164d4335cc9e201d217c288f3a0.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you?\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"at the end of doc, add a heading `Code` and a javascript code block with `console.log('hello world');`\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2AMNdfuG1UAvkIdveRgKv6wNFK\",\n \"object\": \"chat.completion\",\n \"created\": 1747170058,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_TSfObvANWFlGvEOirpLR0epC\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[{\\\"type\\\":\\\"heading\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Code\\\"}],\\\"props\\\":{\\\"level\\\":1}},{\\\"type\\\":\\\"codeBlock\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"console.log('hello world');\\\"}],\\\"props\\\":{\\\"language\\\":\\\"javascript\\\"}}]}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1008,\n \"completion_tokens\": 76,\n \"total_tokens\": 1084,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a list (end)_1_2e1b3d58032f40317616d76bf4fea81c.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a list (end)_1_2e1b3d58032f40317616d76bf4fea81c.json
new file mode 100644
index 0000000000..cd831726d5
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a list (end)_1_2e1b3d58032f40317616d76bf4fea81c.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you?\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a list with the items 'Apples' and 'Bananas' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr29cfCUtDL6hK2Dj6iOMZ2KZUTk\",\n \"object\": \"chat.completion\",\n \"created\": 1747170057,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_Iz91l1XPLjQqC5EepqST2XSR\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[{\\\"type\\\":\\\"bulletListItem\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Apples\\\"}]},{\\\"type\\\":\\\"bulletListItem\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bananas\\\"}]}]}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1001,\n \"completion_tokens\": 64,\n \"total_tokens\": 1065,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (end)_1_4267ae57d44c64aa8b70a89aab67f159.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (end)_1_4267ae57d44c64aa8b70a89aab67f159.json
new file mode 100644
index 0000000000..6c6de3f846
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (end)_1_4267ae57d44c64aa8b70a89aab67f159.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you?\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr29vZEkGEHxkfNYp3WHCQ4huupX\",\n \"object\": \"chat.completion\",\n \"created\": 1747170057,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_XjLKo0rgaSknQZErwIhOqyUf\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"You look great today!\\\"}]}]}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 999,\n \"completion_tokens\": 45,\n \"total_tokens\": 1044,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (start)_1_9d50ec65e996e7a56294ea29bc698367.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (start)_1_9d50ec65e996e7a56294ea29bc698367.json
new file mode 100644
index 0000000000..409dd5c3ac
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (start)_1_9d50ec65e996e7a56294ea29bc698367.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you?\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' before the first sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr28QV79sU9VNbz5iR3rCvDGZxhP\",\n \"object\": \"chat.completion\",\n \"created\": 1747170056,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_UmGWzZFbrTUAVsNPEW1zvcoy\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref1$\\\",\\\"position\\\":\\\"before\\\",\\\"blocks\\\":[{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"You look great today!\\\"}]}]}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 999,\n \"completion_tokens\": 45,\n \"total_tokens\": 1044,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_8c55f5cd009ab351956e1b40605abc34.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_8c55f5cd009ab351956e1b40605abc34.json
new file mode 100644
index 0000000000..ab6f99258f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_8c55f5cd009ab351956e1b40605abc34.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you?\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"at the end of doc, add a heading `Code` and a javascript code block with `console.log('hello world');`\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_wkllzjAegdRWuKyZRmNb3VDy\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"after\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"heading\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Code\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"],\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"props\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"level\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}},\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"code\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"console\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\".log\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"('\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"');\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"],\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"props\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"language\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"javascript\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1fNMOnQrRLjp6dNR9fNKHsDNCV\",\"object\":\"chat.completion.chunk\",\"created\":1747170027,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_eabec381f0f6973116f9e49dc86810d4.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_eabec381f0f6973116f9e49dc86810d4.json
new file mode 100644
index 0000000000..27525c939b
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_eabec381f0f6973116f9e49dc86810d4.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you?\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a list with the items 'Apples' and 'Bananas' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_caywPO0uICoiGF8oJIYI31VB\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"after\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"bullet\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"List\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Item\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Ap\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ples\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"bullet\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"List\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Item\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Ban\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"anas\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1eDdWKPqWZ2t8s1V06CFp7Xb7o\",\"object\":\"chat.completion.chunk\",\"created\":1747170026,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_018cc4d3757dfb60819403609f61a74d.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_018cc4d3757dfb60819403609f61a74d.json
new file mode 100644
index 0000000000..70cc9fdd4c
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_018cc4d3757dfb60819403609f61a74d.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you?\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the last sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_Owj2dfSjZTDn2Sf26SZ7WmwY\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"after\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"You\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" look\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" great\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" today\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1c0I8SWap6MzlipQD3iocoRUVW\",\"object\":\"chat.completion.chunk\",\"created\":1747170024,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_aeee8d53d8e28d27a45229e9f04bfd02.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_aeee8d53d8e28d27a45229e9f04bfd02.json
new file mode 100644
index 0000000000..025494a88d
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_aeee8d53d8e28d27a45229e9f04bfd02.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you?\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' before the first sentence\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_02KMh9cqtvpBvkDT512bI8RV\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"before\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"You\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" look\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" great\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" today\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1b9mkJ5M2Ay8NYUTuVMW2JZPBj\",\"object\":\"chat.completion.chunk\",\"created\":1747170023,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add and update paragraph_1_46911433377fbe117de27b4ebef430f5.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add and update paragraph_1_46911433377fbe117de27b4ebef430f5.json
new file mode 100644
index 0000000000..741a8b9699
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add and update paragraph_1_46911433377fbe117de27b4ebef430f5.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the first paragraph and translate 'Hello, world' to dutch\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr3ppCb4KP9rhO932vp8RoNxm7uV\",\n \"object\": \"chat.completion\",\n \"created\": 1747170161,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_tLio8rGymY04EAu4QFWab06E\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref1$\\\",\\\"position\\\":\\\"after\\\",\\\"blocks\\\":[{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"You look great today!\\\"}]}]},{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hallo, wereld!\\\"}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1180,\n \"completion_tokens\": 77,\n \"total_tokens\": 1257,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add paragraph and update selection_1_caeb25fbcd6743ad509ab18526f09180.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add paragraph and update selection_1_caeb25fbcd6743ad509ab18526f09180.json
new file mode 100644
index 0000000000..83a3811197
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add paragraph and update selection_1_caeb25fbcd6743ad509ab18526f09180.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using JSON blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n This is the selection as an array of JSON blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello\\\",\\\"styles\\\":{}}],\\\"children\\\":[]}}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a paragraph with the text 'You look great today!' at the beginning and translate selection to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr3qwMTWNoKl1SsHDwvxufkoJxtj\",\n \"object\": \"chat.completion\",\n \"created\": 1747170162,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_td5YTSgLfpJKehFLvqN1nzha\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"add\\\",\\\"referenceId\\\":\\\"ref2$\\\",\\\"position\\\":\\\"before\\\",\\\"blocks\\\":[{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"You look great today!\\\"}]}]},{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hallo\\\"}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1071,\n \"completion_tokens\": 75,\n \"total_tokens\": 1146,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_55d88aaf2f\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add and update paragraph_1_049c64f71763963c05852957cdcd40bd.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add and update paragraph_1_049c64f71763963c05852957cdcd40bd.json
new file mode 100644
index 0000000000..fab9e4a9ef
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add and update paragraph_1_049c64f71763963c05852957cdcd40bd.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the first paragraph and translate 'Hello, world' to dutch\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_WBI2V0Bmnu80r8YonCye5Tzm\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"after\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"You\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" look\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" great\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" today\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hallo\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" wereld\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4TH6dP2Dh3clIYufEVSM4pDD8i\",\"object\":\"chat.completion.chunk\",\"created\":1747170201,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add paragraph and update selection_1_d7907adc86da5742363bfc4422e490e6.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add paragraph and update selection_1_d7907adc86da5742363bfc4422e490e6.json
new file mode 100644
index 0000000000..c83a3021c6
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add paragraph and update selection_1_d7907adc86da5742363bfc4422e490e6.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using JSON blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n This is the selection as an array of JSON blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello\\\",\\\"styles\\\":{}}],\\\"children\\\":[]}}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"add a paragraph with the text 'You look great today!' at the beginning and translate selection to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_ViesLC46LzlOoWWXRKheDiMz\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"add\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"reference\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"position\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"before\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blocks\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"You\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" look\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" great\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" today\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hallo\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4UliREX8IzDzKcYFHQSmM4h7fU\",\"object\":\"chat.completion.chunk\",\"created\":1747170202,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/delete first block_1_5515f1ecee9bd348f415319f4a843add.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/delete first block_1_5515f1ecee9bd348f415319f4a843add.json
new file mode 100644
index 0000000000..fd5d087f54
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/delete first block_1_5515f1ecee9bd348f415319f4a843add.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"delete the first paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr3mOmkBqSlICyjNDRHEhG2nSONm\",\n \"object\": \"chat.completion\",\n \"created\": 1747170158,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_ALzb6pegTbWtNsVSAEi4WUib\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"delete\\\",\\\"id\\\":\\\"ref1$\\\"}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1157,\n \"completion_tokens\": 16,\n \"total_tokens\": 1173,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 1152,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/delete first block_1_7c35b931bd8677fa1920b9e5f8128f4a.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/delete first block_1_7c35b931bd8677fa1920b9e5f8128f4a.json
new file mode 100644
index 0000000000..1c9b5f37cc
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/delete first block_1_7c35b931bd8677fa1920b9e5f8128f4a.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"delete the first paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_yeTVbcnLx55qZZEpHPPsgTBx\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"delete\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr4SWP5sGsjH9i4xKFjpYSUgvIMV\",\"object\":\"chat.completion.chunk\",\"created\":1747170200,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/clear block formatting_1_25bc98ef490234deedb61e16a00d439e.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/clear block formatting_1_25bc98ef490234deedb61e16a00d439e.json
new file mode 100644
index 0000000000..04f14bcf6e
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/clear block formatting_1_25bc98ef490234deedb61e16a00d439e.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"red\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Colored text\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"right\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Aligned text\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"clear the formatting (colors and alignment)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr4MmahIURHAGdJD55icQ6F3kC7Y\",\n \"object\": \"chat.completion\",\n \"created\": 1747170194,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_1SbbgcxwCjYcDSkmnwHRY4Co\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Colored text\\\",\\\"styles\\\":{}}]}},{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Aligned text\\\",\\\"styles\\\":{}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 986,\n \"completion_tokens\": 74,\n \"total_tokens\": 1060,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link and change text within mark_1_c94d4dbaf7e20ccafc3a87f8933afd6a.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link and change text within mark_1_c94d4dbaf7e20ccafc3a87f8933afd6a.json
new file mode 100644
index 0000000000..f7c736bbd9
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link and change text within mark_1_c94d4dbaf7e20ccafc3a87f8933afd6a.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change the last paragraph to 'Hi, world! Bold the text. Link.' without any markup like bold or link\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2RJh3LlCQuhvs3kVfyQsaTSmwN\",\n \"object\": \"chat.completion\",\n \"created\": 1747170075,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_yTcTmvMYV9Xruk1d1oGXBaoQ\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hi, world! Bold the text. Link.\\\"}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1176,\n \"completion_tokens\": 43,\n \"total_tokens\": 1219,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 1152,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link_1_164602425b43f343ccbfb3c2f1509b58.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link_1_164602425b43f343ccbfb3c2f1509b58.json
new file mode 100644
index 0000000000..12a4ce09e0
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link_1_164602425b43f343ccbfb3c2f1509b58.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the formatting (turn into plain text without styles or urls) from the last paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2QryET6quDGTuv0xwnUcbYG7jw\",\n \"object\": \"chat.completion\",\n \"created\": 1747170074,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_N5qiD9jZxvBto4LkdbudCKp4\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! Bold text. Link.\\\"}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1170,\n \"completion_tokens\": 42,\n \"total_tokens\": 1212,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_90122d973c\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify nested content_1_60470c62411dbe76f9d1ebb97160e62c.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify nested content_1_60470c62411dbe76f9d1ebb97160e62c.json
new file mode 100644
index 0000000000..0668296878
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify nested content_1_60470c62411dbe76f9d1ebb97160e62c.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"I need to buy:\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Apples\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make apples uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2RQo4Y00eQ4fmXXShAEVkm8KxI\",\n \"object\": \"chat.completion\",\n \"created\": 1747170075,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_56hEOpWhFaN3uX5FNqybQSJb\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"APPLES\\\",\\\"styles\\\":{}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 984,\n \"completion_tokens\": 40,\n \"total_tokens\": 1024,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify parent content_1_603268f548d2c26969d79e4e170bd524.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify parent content_1_603268f548d2c26969d79e4e170bd524.json
new file mode 100644
index 0000000000..7334986a99
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify parent content_1_603268f548d2c26969d79e4e170bd524.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"I need to buy:\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Apples\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr4MQcroWmT8iLM3CBoeRzrXcZSK\",\n \"object\": \"chat.completion\",\n \"created\": 1747170194,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_9cFf2xZszJe8vi7e8gQ9yfRP\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"I NEED TO BUY:\\\",\\\"styles\\\":{}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 986,\n \"completion_tokens\": 43,\n \"total_tokens\": 1029,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/plain source block, add mention_1_dc3adc84764ea9dd8f20a906a4633334.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/plain source block, add mention_1_dc3adc84764ea9dd8f20a906a4633334.json
new file mode 100644
index 0000000000..60728a27b7
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/plain source block, add mention_1_dc3adc84764ea9dd8f20a906a4633334.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"Change the first paragraph to Hello, Jane Doe! (use a mention)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2NSgO7UjWQrb1bhFWE5gKhRnsP\",\n \"object\": \"chat.completion\",\n \"created\": 1747170071,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_VbObZWb4CRfcAVNle6UwFRtj\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"Jane Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"!\\\",\\\"styles\\\":{}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1168,\n \"completion_tokens\": 64,\n \"total_tokens\": 1232,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 1152,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/standard update_1_6330ddde52ebd48c1e8914a970ad7849.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/standard update_1_6330ddde52ebd48c1e8914a970ad7849.json
new file mode 100644
index 0000000000..7452d1e80e
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/standard update_1_6330ddde52ebd48c1e8914a970ad7849.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the first paragraph to german\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2BjayY4K4V3jOPh94L0zgh9pl6\",\n \"object\": \"chat.completion\",\n \"created\": 1747170059,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_lk39ph3EG9RWvvkrBS7vS7sk\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hallo, Welt!\\\",\\\"styles\\\":{}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1159,\n \"completion_tokens\": 42,\n \"total_tokens\": 1201,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 1152,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mark_1_aa396a89a86700c7c1531127331c95b9.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mark_1_aa396a89a86700c7c1531127331c95b9.json
new file mode 100644
index 0000000000..78386efe41
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mark_1_aa396a89a86700c7c1531127331c95b9.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the bold style from the second block\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2JEgifYZFs9ATBitUjN2CVwo8H\",\n \"object\": \"chat.completion\",\n \"created\": 1747170067,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_yOXhWOSYbfToDeMRmNYZ0tLk\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1161,\n \"completion_tokens\": 128,\n \"total_tokens\": 1289,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_90122d973c\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mention_1_e1de4a145c9a98804f8d1fd1ae811da4.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mention_1_e1de4a145c9a98804f8d1fd1ae811da4.json
new file mode 100644
index 0000000000..cc37626dec
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mention_1_e1de4a145c9a98804f8d1fd1ae811da4.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change to say 'Hello! How are you doing? This text is blue!' (remove mention but keep bold text)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2KNaJiYp3aY7SSY5fXW8TDJCob\",\n \"object\": \"chat.completion\",\n \"created\": 1747170068,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_cTgZfbKHca9uT0NeNV1JfCDi\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1177,\n \"completion_tokens\": 89,\n \"total_tokens\": 1266,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 1152,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, replace content_1_ce587e62f1783dd0652ffea5d558fda6.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, replace content_1_ce587e62f1783dd0652ffea5d558fda6.json
new file mode 100644
index 0000000000..eff17d5d03
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, replace content_1_ce587e62f1783dd0652ffea5d558fda6.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the content of the second block to 'Hello, updated content'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2HsxUKhnsevUSJROXsa404rwEO\",\n \"object\": \"chat.completion\",\n \"created\": 1747170065,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_FHhTnlrueDIB2caxRFJM32Bb\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, updated content\\\"}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1167,\n \"completion_tokens\": 38,\n \"total_tokens\": 1205,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_90122d973c\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update mention prop_1_c2fb024d9d7218c5051012323c39fa0d.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update mention prop_1_c2fb024d9d7218c5051012323c39fa0d.json
new file mode 100644
index 0000000000..e5f0f9fbb3
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update mention prop_1_c2fb024d9d7218c5051012323c39fa0d.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the mention to Jane Doe\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2OgEMQ6IWh4wavNqgT9RVskgvU\",\n \"object\": \"chat.completion\",\n \"created\": 1747170072,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_U6ouZPjqz9o3oIlFViEUUMHC\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"Jane Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1159,\n \"completion_tokens\": 113,\n \"total_tokens\": 1272,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update text_1_e2f62ab4415528c63105a90c35e202f3.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update text_1_e2f62ab4415528c63105a90c35e202f3.json
new file mode 100644
index 0000000000..97aef25a85
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update text_1_e2f62ab4415528c63105a90c35e202f3.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the second block to german (use dir instead of Ihnen)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2I5bB9X30kEO5gDlDZnQGamOwi\",\n \"object\": \"chat.completion\",\n \"created\": 1747170066,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_kPkxFKCq8PYIgrsi4mO4eSox\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hallo, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Wie geht es dir?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Dieser Text ist blau!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1166,\n \"completion_tokens\": 113,\n \"total_tokens\": 1279,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (paragraph)_1_fb966bb5f366d489cd267e48a7455c72.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (paragraph)_1_fb966bb5f366d489cd267e48a7455c72.json
new file mode 100644
index 0000000000..8f5891ae2e
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (paragraph)_1_fb966bb5f366d489cd267e48a7455c72.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make first paragraph bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2Ngb4I3pKgDAvJai1Zkct8rqCK\",\n \"object\": \"chat.completion\",\n \"created\": 1747170071,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_zrGHo6812U38jvL7k4Sies15\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{\\\"bold\\\":true}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1157,\n \"completion_tokens\": 44,\n \"total_tokens\": 1201,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (word)_1_10409eb8f8e256c2c07ee05c2558a2a9.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (word)_1_10409eb8f8e256c2c07ee05c2558a2a9.json
new file mode 100644
index 0000000000..c0fc0df459
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (word)_1_10409eb8f8e256c2c07ee05c2558a2a9.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make 'world!' (in the first block) bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2MY8OO2Ne0HcgNV03C0IPlhDy5\",\n \"object\": \"chat.completion\",\n \"created\": 1747170070,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_jJHddSYtax9suFnK55VEjiHa\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"world!\\\",\\\"styles\\\":{\\\"bold\\\":true}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1164,\n \"completion_tokens\": 55,\n \"total_tokens\": 1219,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 1152,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/translate selection_1_e06a86826098274cfb35046f8f5f67a5.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/translate selection_1_e06a86826098274cfb35046f8f5f67a5.json
new file mode 100644
index 0000000000..778fffed4c
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/translate selection_1_e06a86826098274cfb35046f8f5f67a5.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using JSON blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n This is the selection as an array of JSON blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello\\\",\\\"styles\\\":{}}],\\\"children\\\":[]}}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2CwuirEtsRMMwjE8OC4lSvmIj9\",\n \"object\": \"chat.completion\",\n \"created\": 1747170060,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_3WJRZVAIXQwTM3nROt6eK4Pq\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hallo\\\",\\\"styles\\\":{}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1054,\n \"completion_tokens\": 39,\n \"total_tokens\": 1093,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 1024,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_55d88aaf2f\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/turn paragraphs into list_1_c704dd8060467f285e008fcfa10bd3b9.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/turn paragraphs into list_1_c704dd8060467f285e008fcfa10bd3b9.json
new file mode 100644
index 0000000000..25816cfd88
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/turn paragraphs into list_1_c704dd8060467f285e008fcfa10bd3b9.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using JSON blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n This is the selection as an array of JSON blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Apples\\\",\\\"styles\\\":{}}],\\\"children\\\":[]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bananas\\\",\\\"styles\\\":{}}],\\\"children\\\":[]}}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"I need to buy:\\\",\\\"styles\\\":{}}]}},{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Apples\\\",\\\"styles\\\":{}}]}},{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bananas\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"turn into list (update existing blocks)\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr4L5SLUilmEsFgMtHk7j0CEwL3R\",\n \"object\": \"chat.completion\",\n \"created\": 1747170193,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_faPrQZMNUUp6ik7KVEsEmL8C\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"type\\\":\\\"bulletListItem\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Apples\\\",\\\"styles\\\":{}}]}},{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"type\\\":\\\"bulletListItem\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bananas\\\",\\\"styles\\\":{}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 997,\n \"completion_tokens\": 78,\n \"total_tokens\": 1075,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_55d88aaf2f\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block prop and content_1_be4a66aa5ee43a3fd916166e56052ad0.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block prop and content_1_be4a66aa5ee43a3fd916166e56052ad0.json
new file mode 100644
index 0000000000..fa56c57d2b
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block prop and content_1_be4a66aa5ee43a3fd916166e56052ad0.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph right aligned and update the content to 'What's up, world!'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2GbA8MY1aTukXEpGM6eoR2FJfO\",\n \"object\": \"chat.completion\",\n \"created\": 1747170064,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_gmu0lEA5zzVhekO8jM4QMbB9\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textAlignment\\\":\\\"right\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"What's up, world!\\\"}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1170,\n \"completion_tokens\": 46,\n \"total_tokens\": 1216,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 1152,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block prop_1_697c8f64d854e5a824cb735c81d9b7ea.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block prop_1_697c8f64d854e5a824cb735c81d9b7ea.json
new file mode 100644
index 0000000000..a4b12ee069
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block prop_1_697c8f64d854e5a824cb735c81d9b7ea.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph right aligned\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2E0WvxqliRTS23U2A9Q3rIYQcT\",\n \"object\": \"chat.completion\",\n \"created\": 1747170062,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_kPnsZC5ifB5vd0gH9ktWwaYA\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"right\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1159,\n \"completion_tokens\": 60,\n \"total_tokens\": 1219,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type and content_1_6b93af6e60c455fec9f8bde5b44e587d.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type and content_1_6b93af6e60c455fec9f8bde5b44e587d.json
new file mode 100644
index 0000000000..b25226e00c
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type and content_1_6b93af6e60c455fec9f8bde5b44e587d.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading and update the content to 'What's up, world!'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2F2e7S9PJz4QirHiSIluh9pUXD\",\n \"object\": \"chat.completion\",\n \"created\": 1747170063,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_NGDYHqgFZY2DnrusIl7RcevD\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"type\\\":\\\"heading\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"What's up, world!\\\"}],\\\"props\\\":{\\\"level\\\":1}}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1170,\n \"completion_tokens\": 45,\n \"total_tokens\": 1215,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type_1_fd7ea265becc91c2e55258021a82a016.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type_1_fd7ea265becc91c2e55258021a82a016.json
new file mode 100644
index 0000000000..2a99e292c0
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type_1_fd7ea265becc91c2e55258021a82a016.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}]}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "{\n \"id\": \"chatcmpl-BWr2D4x64mp1RUCel6WJfyfEbyXKu\",\n \"object\": \"chat.completion\",\n \"created\": 1747170061,\n \"model\": \"gpt-4o-2024-08-06\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_HSsmerEzlbVcZxh9eFH94ejx\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"json\",\n \"arguments\": \"{\\\"operations\\\":[{\\\"type\\\":\\\"update\\\",\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"type\\\":\\\"heading\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}],\\\"props\\\":{\\\"level\\\":1}}}]}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1159,\n \"completion_tokens\": 48,\n \"total_tokens\": 1207,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 1152,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_d8864f8b6b\"\n}\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/clear block formatting_1_e9409ed44af8d5b1f3ec7d3b7125386a.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/clear block formatting_1_e9409ed44af8d5b1f3ec7d3b7125386a.json
new file mode 100644
index 0000000000..abe205f3e3
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/clear block formatting_1_e9409ed44af8d5b1f3ec7d3b7125386a.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"red\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Colored text\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"right\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Aligned text\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"clear the formatting (colors and alignment)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_IdmQkUYiftaUuMtOrrGpsV3R\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Colored\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Aligned\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr241857RaEoeWLZ8cPJxcZ2Zlq3\",\"object\":\"chat.completion.chunk\",\"created\":1747170052,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link and change text within mark_1_35579261c0f297cf664524f0c5e08ff1.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link and change text within mark_1_35579261c0f297cf664524f0c5e08ff1.json
new file mode 100644
index 0000000000..b2905a613c
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link and change text within mark_1_35579261c0f297cf664524f0c5e08ff1.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change the last paragraph to 'Hi, world! Bold the text. Link.' without any markup like bold or link\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_drti56WxXTZbyFFWV8dEQBj1\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"3\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hi\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Bold\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" the\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\".\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Link\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\".\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr20mHV7hBlkdyHRXhIcszeCc0yi\",\"object\":\"chat.completion.chunk\",\"created\":1747170048,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link_1_d7303b2c5a80c7a016ba6caa2ae7be04.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link_1_d7303b2c5a80c7a016ba6caa2ae7be04.json
new file mode 100644
index 0000000000..d87e498b7b
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link_1_d7303b2c5a80c7a016ba6caa2ae7be04.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the formatting (turn into plain text without styles or urls) from the last paragraph\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_RCDZZuvhsUpThBuXDH9Rknjr\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"3\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Bold\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\".\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Link\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\".\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1zMH3MBYmVmZcRCsrLcowB1dD2\",\"object\":\"chat.completion.chunk\",\"created\":1747170047,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify nested content_1_55d150e200dccb9c1ac1b325aa8d5a43.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify nested content_1_55d150e200dccb9c1ac1b325aa8d5a43.json
new file mode 100644
index 0000000000..1175c8b8fa
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify nested content_1_55d150e200dccb9c1ac1b325aa8d5a43.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"I need to buy:\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Apples\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make apples uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_cmKz9ixUz4VoINOkUaa97MrD\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"APP\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"LES\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr229nE9OomK57nqBbVjt1iohgAT\",\"object\":\"chat.completion.chunk\",\"created\":1747170050,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify parent content_1_34fba8f0eb2af6cd8d1af416390d9dc4.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify parent content_1_34fba8f0eb2af6cd8d1af416390d9dc4.json
new file mode 100644
index 0000000000..dc64c8fc06
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify parent content_1_34fba8f0eb2af6cd8d1af416390d9dc4.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"I need to buy:\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Apples\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph uppercase\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_GvzDUxoJXCBP9llRqzP9YR4A\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"I\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" NEED\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" TO\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" BUY\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr23aumkXt8G3kOydyxHXX6aagDt\",\"object\":\"chat.completion.chunk\",\"created\":1747170051,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/plain source block, add mention_1_ae41cefb5832864a8a9b2e67c04c65b4.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/plain source block, add mention_1_ae41cefb5832864a8a9b2e67c04c65b4.json
new file mode 100644
index 0000000000..d1f13d06ef
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/plain source block, add mention_1_ae41cefb5832864a8a9b2e67c04c65b4.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"Change the first paragraph to Hello, Jane Doe! (use a mention)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_nhuvx7T4Cp8mZhcbTh2381qy\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"mention\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"props\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"user\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Jane\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Doe\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1tzJ8hPMUiPhqJ05L4auwDazd2\",\"object\":\"chat.completion.chunk\",\"created\":1747170041,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/standard update_1_a7a20bf9510adbbafe889498aa22f0ce.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/standard update_1_a7a20bf9510adbbafe889498aa22f0ce.json
new file mode 100644
index 0000000000..1cb4c1411b
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/standard update_1_a7a20bf9510adbbafe889498aa22f0ce.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the first paragraph to german\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_rOVU6tCc46CvpKIzVcmAfFc4\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hallo\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Welt\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1gATibTlH8BAYyUToBRGYMYfSP\",\"object\":\"chat.completion.chunk\",\"created\":1747170028,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mark_1_db2880a42dbde80ff9950f502ef1ab8f.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mark_1_db2880a42dbde80ff9950f502ef1ab8f.json
new file mode 100644
index 0000000000..5623de114a
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mark_1_db2880a42dbde80ff9950f502ef1ab8f.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"remove the bold style from the second block\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_78nlx7HJ7G2yBSqYOyiA53wb\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"mention\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"props\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"user\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"John\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Doe\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"How\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" are\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" you\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" doing\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"?\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"This\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" is\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Color\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"],\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"props\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Color\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"default\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"background\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Color\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"default\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Alignment\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"left\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1oz45R2qP3OkequMNprEbQ0gOH\",\"object\":\"chat.completion.chunk\",\"created\":1747170036,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mention_1_48523af48bae8448f99a3d4108bb8a55.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mention_1_48523af48bae8448f99a3d4108bb8a55.json
new file mode 100644
index 0000000000..43711a84d5
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mention_1_48523af48bae8448f99a3d4108bb8a55.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"change to say 'Hello! How are you doing? This text is blue!' (remove mention but keep bold text)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_IfainOSSQ57DXPoTy37xGbVh\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"How\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" are\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" you\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" doing\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"?\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"bold\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"true\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}},\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"This\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" is\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Color\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1pJbamqlopP9HRtAF6oCLKXuDA\",\"object\":\"chat.completion.chunk\",\"created\":1747170037,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, replace content_1_024c55cd1b3177f362a2d606090ca19a.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, replace content_1_024c55cd1b3177f362a2d606090ca19a.json
new file mode 100644
index 0000000000..a1a3a5365c
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, replace content_1_024c55cd1b3177f362a2d606090ca19a.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the content of the second block to 'Hello, updated content'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_CsAeebREelm6qyfvQuZNXduk\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" updated\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1mLwS7cmp0rBVmz9uZuiChbcaH\",\"object\":\"chat.completion.chunk\",\"created\":1747170034,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update mention prop_1_549dd0fe54084e4a98588be963db9361.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update mention prop_1_549dd0fe54084e4a98588be963db9361.json
new file mode 100644
index 0000000000..b643a07868
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update mention prop_1_549dd0fe54084e4a98588be963db9361.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"update the mention to Jane Doe\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_9JOdQydbiGOHDNE59BB7bAWq\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"mention\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"props\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"user\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Jane\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Doe\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"How\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" are\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" you\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" doing\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"?\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"bold\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"true\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}},\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"This\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" is\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Color\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1uXKWU7hTwyq1qaUN7Vvl4jRue\",\"object\":\"chat.completion.chunk\",\"created\":1747170042,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update text_1_dbf2fb610e354e0daa60de0cbdd77aba.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update text_1_dbf2fb610e354e0daa60de0cbdd77aba.json
new file mode 100644
index 0000000000..64f58c3a69
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update text_1_dbf2fb610e354e0daa60de0cbdd77aba.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate the second block to german (use dir instead of Ihnen)\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_xwZpuJRlj9aGUbdkEybGiCFz\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hallo\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"mention\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"props\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"user\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"John\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Doe\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Wie\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" geht\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" es\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" dir\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"?\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"bold\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"true\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}},\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Dieser\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" Text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" ist\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" blau\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Color\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"blue\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1n4UAFFYYdHxWMLqoLJBtqiHnx\",\"object\":\"chat.completion.chunk\",\"created\":1747170035,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (paragraph)_1_8369c3cd3da93d0e734ed7092c0acf40.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (paragraph)_1_8369c3cd3da93d0e734ed7092c0acf40.json
new file mode 100644
index 0000000000..554e52d2c4
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (paragraph)_1_8369c3cd3da93d0e734ed7092c0acf40.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make first paragraph bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_o41zbRsl9ksfftYZUvYuM1HT\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"bold\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"true\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1sLJYMxn0euqs7mKZzgdVlkfWR\",\"object\":\"chat.completion.chunk\",\"created\":1747170040,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (word)_1_7033d19147879fada8c8142ee2be4803.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (word)_1_7033d19147879fada8c8142ee2be4803.json
new file mode 100644
index 0000000000..eb57334ea2
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (word)_1_7033d19147879fada8c8142ee2be4803.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make 'world!' (in the first block) bold\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_jWrmwvNMfxM1Gg87zYTlQtac\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" \\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"bold\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"true\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1rdxQxrg4cpdSKtk6pRpHpnb3j\",\"object\":\"chat.completion.chunk\",\"created\":1747170039,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/translate selection_1_3f8ef537734ef9b7d2142c49bde8cbdd.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/translate selection_1_3f8ef537734ef9b7d2142c49bde8cbdd.json
new file mode 100644
index 0000000000..a4a63795d9
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/translate selection_1_3f8ef537734ef9b7d2142c49bde8cbdd.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using JSON blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n This is the selection as an array of JSON blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello\\\",\\\"styles\\\":{}}],\\\"children\\\":[]}}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"translate to German\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_l4sixuVM0IMdPWcrgQhfTpwQ\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hallo\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1hB6PXzeiMq8PggMQ1lyTtQwpV\",\"object\":\"chat.completion.chunk\",\"created\":1747170029,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_f8fd91cad88cfec6db2a906b564d39d3.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_f8fd91cad88cfec6db2a906b564d39d3.json
new file mode 100644
index 0000000000..31c32ca8d2
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_f8fd91cad88cfec6db2a906b564d39d3.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a selected part of a text document using JSON blocks. \\n Make sure to follow the json schema provided and always include the trailing $ in ids. \\n This is the selection as an array of JSON blocks:\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Apples\\\",\\\"styles\\\":{}}],\\\"children\\\":[]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bananas\\\",\\\"styles\\\":{}}],\\\"children\\\":[]}}]\"},{\"role\":\"system\",\"content\":\"This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:\"},{\"role\":\"system\",\"content\":\"[{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"I need to buy:\\\",\\\"styles\\\":{}}]}},{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Apples\\\",\\\"styles\\\":{}}]}},{\\\"block\\\":{\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bananas\\\",\\\"styles\\\":{}}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"turn into list (update existing blocks)\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_rhwZMhwBsPGv6zO3MdOpg6zx\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"2\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"bullet\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"List\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Item\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Ap\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ples\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"},{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"3\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"bullet\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"List\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Item\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Ban\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"anas\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr21IOdPVM1xeOpxEg7fksEB2jTo\",\"object\":\"chat.completion.chunk\",\"created\":1747170049,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_55d88aaf2f\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block prop and content_1_708c779a29da274a24e34cea53755e3b.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block prop and content_1_708c779a29da274a24e34cea53755e3b.json
new file mode 100644
index 0000000000..234e682cb8
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block prop and content_1_708c779a29da274a24e34cea53755e3b.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph right aligned and update the content to 'What's up, world!'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_ufuN825KOmCW9W4QGmzbrzcN\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"props\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Alignment\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"right\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"What's\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" up\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1lddXS5DYZtCNtuMGxWgJNx2uB\",\"object\":\"chat.completion.chunk\",\"created\":1747170033,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block prop_1_67d9ce65ebaaf76b1dde8492176299fc.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block prop_1_67d9ce65ebaaf76b1dde8492176299fc.json
new file mode 100644
index 0000000000..1efcc446cb
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block prop_1_67d9ce65ebaaf76b1dde8492176299fc.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph right aligned\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_FBQol3RfRsGyFqeQulH8CHq1\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"paragraph\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"props\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Color\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"default\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"background\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Color\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"default\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Alignment\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"right\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1j6PrtSiuZXeDNG6O1WsylqO6I\",\"object\":\"chat.completion.chunk\",\"created\":1747170031,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type and content_1_f9b7241b0cb9e9e098e13a58b47bfa62.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type and content_1_f9b7241b0cb9e9e098e13a58b47bfa62.json
new file mode 100644
index 0000000000..546ca62387
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type and content_1_f9b7241b0cb9e9e098e13a58b47bfa62.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading and update the content to 'What's up, world!'\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_61qIRsV49e6jjQ8iwyMlfSTW\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"heading\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"What's\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" up\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"],\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"props\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"level\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1kq8sSSH78R1APM1FaZCkM5cl3\",\"object\":\"chat.completion.chunk\",\"created\":1747170032,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type_1_dbb1b2b807becf642bb03a71e34b8e21.json b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type_1_dbb1b2b807becf642bb03a71e34b8e21.json
new file mode 100644
index 0000000000..170bfcff12
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type_1_dbb1b2b807becf642bb03a71e34b8e21.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://localhost:3000/ai?provider=openai&url=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"temperature\":0,\"messages\":[{\"role\":\"system\",\"content\":\"You're manipulating a text document using JSON blocks. \\n Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $). \\n This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):\"},{\"role\":\"system\",\"content\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref1\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world!\\\",\\\"styles\\\":{}}]}},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref2\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"mention\\\",\\\"props\\\":{\\\"user\\\":\\\"John Doe\\\"}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"How are you doing?\\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\" \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"This text is blue!\\\",\\\"styles\\\":{\\\"textColor\\\":\\\"blue\\\"}}]}},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":{\\\"id\\\":\\\"ref3\\\",\\\"type\\\":\\\"paragraph\\\",\\\"props\\\":{\\\"textColor\\\":\\\"default\\\",\\\"backgroundColor\\\":\\\"default\\\",\\\"textAlignment\\\":\\\"left\\\"},\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Hello, world! \\\",\\\"styles\\\":{}},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Bold text. \\\",\\\"styles\\\":{\\\"bold\\\":true}},{\\\"type\\\":\\\"link\\\",\\\"href\\\":\\\"https://www.google.com\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Link.\\\",\\\"styles\\\":{}}]}]}}]\"},{\"role\":\"system\",\"content\":\"The user asks you to do the following:\"},{\"role\":\"user\",\"content\":\"make the first paragraph a heading\"},{\"role\":\"system\",\"content\":\"First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.\\n EXAMPLE: if user says \\\"below\\\" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor. \\n EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need `referenceId` to point to the block before the cursor with position `after` (or block below and `before`).\\n \\n Prefer updating blocks over adding or removing (but this also depends on the user's question).\"}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"json\"}},\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"json\",\"description\":\"Respond with a JSON object.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Update a block, the new block will replace the existing block.\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"update\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to update\"},\"block\":{\"$ref\":\"#/$defs/block\"}},\"required\":[\"type\",\"id\",\"block\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Insert new blocks\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"add\"]},\"referenceId\":{\"type\":\"string\",\"description\":\"MUST be an id of a block in the document\"},\"position\":{\"type\":\"string\",\"enum\":[\"before\",\"after\"],\"description\":\"`after` to add blocks AFTER (below) the block with `referenceId`, `before` to add the block BEFORE (above)\"},\"blocks\":{\"items\":{\"$ref\":\"#/$defs/block\"},\"type\":\"array\"}},\"required\":[\"type\",\"referenceId\",\"position\",\"blocks\"],\"additionalProperties\":false},{\"type\":\"object\",\"description\":\"Delete a block\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"delete\"]},\"id\":{\"type\":\"string\",\"description\":\"id of block to delete\"}},\"required\":[\"type\",\"id\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"],\"$defs\":{\"styles\":{\"type\":\"object\",\"properties\":{\"bold\":{\"type\":\"boolean\"},\"italic\":{\"type\":\"boolean\"},\"underline\":{\"type\":\"boolean\"},\"strike\":{\"type\":\"boolean\"},\"code\":{\"type\":\"boolean\"},\"textColor\":{\"type\":\"string\"},\"backgroundColor\":{\"type\":\"string\"}},\"additionalProperties\":false},\"styledtext\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"text\"]},\"text\":{\"type\":\"string\"},\"styles\":{\"$ref\":\"#/$defs/styles\"}},\"additionalProperties\":false,\"required\":[\"type\",\"text\"]},\"inlinecontent\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"mention\"]},\"props\":{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"$ref\":\"#/$defs/styledtext\"},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"link\"]},\"content\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/styledtext\"}},\"href\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\",\"href\",\"content\"]}]}},\"block\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"paragraph\",\"quote\",\"bulletListItem\",\"numberedListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"heading\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"level\":{\"type\":\"number\",\"enum\":[1,2,3]}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"codeBlock\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"checkListItem\"]},\"content\":{\"$ref\":\"#/$defs/inlinecontent\"},\"props\":{\"type\":\"object\",\"properties\":{\"checked\":{\"type\":\"boolean\"}},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]},{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"table\"]},\"content\":{\"type\":\"object\",\"properties\":{}},\"props\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false}},\"additionalProperties\":false,\"required\":[\"type\"]}]}}}}}],\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_1RDlNuzYxSLsO4IkZ02NO65C\",\"type\":\"function\",\"function\":{\"name\":\"json\",\"arguments\":\"\"}}],\"refusal\":null},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"operations\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"update\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"id\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"ref\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"$\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"block\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"heading\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":[\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"type\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"text\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hello\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" world\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"styles\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"],\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"props\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":{\\\"\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"level\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"1\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"]}\"}}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-BWr1iY6CLhgZ4w6MTsDEFS9RzVTbz\",\"object\":\"chat.completion.chunk\",\"created\":1747170030,\"model\":\"gpt-4o-2024-08-06\",\"service_tier\":\"default\",\"system_fingerprint\":\"fp_d8864f8b6b\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/json/defaultJSONPromptBuilder.ts b/packages/xl-ai/src/api/formats/json/defaultJSONPromptBuilder.ts
new file mode 100644
index 0000000000..73b18cd464
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/defaultJSONPromptBuilder.ts
@@ -0,0 +1,100 @@
+import { CoreMessage } from "ai";
+import { PromptBuilder } from "../PromptBuilder.js";
+import {
+ getDataForPromptNoSelection,
+ getDataForPromptWithSelection,
+} from "./jsonPromptData.js";
+
+function promptManipulateSelectionJSONBlocks(opts: {
+ userPrompt: string;
+ jsonSelectedBlocks: any[];
+ jsonDocument: any[];
+}): Array {
+ return [
+ {
+ role: "system",
+ content: `You're manipulating a selected part of a text document using JSON blocks.
+ Make sure to follow the json schema provided and always include the trailing $ in ids.
+ This is the selection as an array of JSON blocks:`,
+ },
+ {
+ role: "system",
+ content: JSON.stringify(opts.jsonSelectedBlocks),
+ },
+
+ {
+ role: "system",
+ content:
+ "This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:",
+ },
+ {
+ role: "system",
+ content: JSON.stringify(opts.jsonDocument),
+ },
+ {
+ role: "system",
+ content: "The user asks you to do the following:",
+ },
+ {
+ role: "user",
+ content: opts.userPrompt,
+ },
+ ];
+}
+
+function promptManipulateDocumentUseJSONBlocks(opts: {
+ userPrompt: string;
+ jsonBlocks: Array<
+ | any
+ | {
+ cursor: true;
+ }
+ >;
+}): Array {
+ return [
+ {
+ role: "system",
+ content: `You're manipulating a text document using JSON blocks.
+ Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $).
+ This is the document as an array of JSON blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):`,
+ },
+ {
+ role: "system",
+ content: JSON.stringify(opts.jsonBlocks),
+ },
+ {
+ role: "system",
+ content: "The user asks you to do the following:",
+ },
+ {
+ role: "user",
+ content: opts.userPrompt,
+ },
+ {
+ role: "system",
+ content: `First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.
+ EXAMPLE: if user says "below" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor.
+ EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need \`referenceId\` to point to the block before the cursor with position \`after\` (or block below and \`before\`).
+
+ Prefer updating blocks over adding or removing (but this also depends on the user's question).`,
+ },
+ ];
+}
+
+export const defaultJSONPromptBuilder: PromptBuilder = async (editor, opts) => {
+ if (opts.selectedBlocks) {
+ const data = await getDataForPromptWithSelection(editor, {
+ selectedBlocks: opts.selectedBlocks,
+ });
+ return promptManipulateSelectionJSONBlocks({
+ ...data,
+ userPrompt: opts.userPrompt,
+ });
+ } else {
+ const data = await getDataForPromptNoSelection(editor, opts);
+ return promptManipulateDocumentUseJSONBlocks({
+ ...data,
+ userPrompt: opts.userPrompt,
+ });
+ }
+};
diff --git a/packages/xl-ai/src/api/formats/json/errorHandling.test.ts b/packages/xl-ai/src/api/formats/json/errorHandling.test.ts
new file mode 100644
index 0000000000..5edee6b452
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/errorHandling.test.ts
@@ -0,0 +1,94 @@
+import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";
+
+import { createOpenAI } from "@ai-sdk/openai";
+import { BlockNoteEditor } from "@blocknote/core";
+import { HttpResponse, http } from "msw";
+import { setupServer } from "msw/node";
+import { createBlockNoteAIClient } from "../../../blocknoteAIClient/client.js";
+import { doLLMRequest } from "../../LLMRequest.js";
+import { jsonLLMFormat } from "./json.js";
+
+// Create client and models outside of test suites so they can be shared
+const client = createBlockNoteAIClient({
+ baseURL: "https://localhost:3000/ai",
+ apiKey: "PLACEHOLDER",
+});
+
+const openai = createOpenAI({
+ ...client.getProviderSettings("openai"),
+})("gpt-4o-2024-08-06", {});
+
+// Separate test suite for error handling with its own server
+describe("Error handling", () => {
+ // Create a separate server for error tests with custom handlers
+ const errorServer = setupServer();
+
+ beforeAll(() => {
+ errorServer.listen();
+ });
+
+ afterAll(() => {
+ errorServer.close();
+ });
+
+ afterEach(() => {
+ errorServer.resetHandlers();
+ });
+
+ it("handles 429 Too Many Requests error", async () => {
+ // Set up handler for this specific test
+ errorServer.use(
+ http.post("*", () => {
+ return new HttpResponse(
+ JSON.stringify({
+ error: {
+ message: "Rate limit exceeded, please try again later",
+ type: "rate_limit_exceeded",
+ code: "rate_limit_exceeded",
+ },
+ }),
+ {
+ status: 429,
+ headers: {
+ "Content-Type": "application/json",
+ },
+ },
+ );
+ }),
+ );
+
+ const editor = BlockNoteEditor.create({
+ initialContent: [
+ {
+ type: "paragraph",
+ content: "Hello world",
+ },
+ ],
+ });
+
+ // Use a flag to track if an error was thrown
+ let errorThrown = false;
+ let caughtError: any = null;
+
+ try {
+ const result = await doLLMRequest(editor, {
+ stream: true,
+ userPrompt: "translate to Spanish",
+ model: openai,
+ maxRetries: 0,
+ dataFormat: jsonLLMFormat,
+ });
+ await result.execute();
+ } catch (error: any) {
+ errorThrown = true;
+ caughtError = error;
+ }
+
+ // Assertions outside the try/catch
+ expect(errorThrown).toBe(true);
+ expect(caughtError).toBeDefined();
+ expect(caughtError.message || caughtError.toString()).toContain(
+ "Rate limit exceeded, please try again later",
+ );
+ });
+});
diff --git a/packages/xl-ai/src/api/formats/json/json.test.ts b/packages/xl-ai/src/api/formats/json/json.test.ts
new file mode 100644
index 0000000000..540c56d0f1
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/json.test.ts
@@ -0,0 +1,127 @@
+import { afterAll, afterEach, beforeAll, describe } from "vitest";
+
+import { getCurrentTest } from "@vitest/runner";
+import { getSortedEntries, snapshot, toHashString } from "msw-snapshot";
+import { setupServer } from "msw/node";
+import path from "path";
+import { generateSharedTestCases } from "../tests/sharedTestCases.js";
+
+import { testAIModels } from "../../../testUtil/testAIModels.js";
+import { doLLMRequest } from "../../LLMRequest.js";
+import { jsonLLMFormat } from "./json.js";
+
+const BASE_FILE_PATH = path.resolve(
+ __dirname,
+ "__snapshots__",
+ path.basename(__filename),
+);
+
+const fetchCountMap: Record = {};
+
+async function createRequestHash(req: Request) {
+ const url = new URL(req.url);
+ return [
+ // url.host,
+ // url.pathname,
+ toHashString([
+ req.method,
+ url.origin,
+ url.pathname,
+ getSortedEntries(url.searchParams),
+ getSortedEntries(req.headers),
+ // getSortedEntries(req.cookies),
+ new TextDecoder("utf-8").decode(await req.arrayBuffer()),
+ ]),
+ ].join("/");
+}
+
+// Main test suite with snapshot middleware
+describe("Models", () => {
+ // Define server with snapshot middleware for the main tests
+ const server = setupServer(
+ snapshot({
+ updateSnapshots: "missing",
+ // updateSnapshots: "all",
+ // ignoreSnapshots: true,
+ async createSnapshotPath(info) {
+ // use a unique path for each model
+ const t = getCurrentTest()!;
+ const mswPath = path.join(
+ t.suite!.name, // same directory as the test snapshot
+ "__msw_snapshots__",
+ t.suite!.suite!.name, // model / streaming params
+ t.name,
+ );
+ // in case there are multiple requests in a test, we need to use a separate snapshot for each request
+ fetchCountMap[mswPath] = (fetchCountMap[mswPath] || 0) + 1;
+ const hash = await createRequestHash(info.request);
+ return mswPath + `_${fetchCountMap[mswPath]}_${hash}.json`;
+ },
+ basePath: BASE_FILE_PATH,
+ // onFetchFromSnapshot(info, snapshot) {
+ // console.log("onFetchFromSnapshot", info, snapshot);
+ // },
+ // onFetchFromServer(info, snapshot) {
+ // console.log("onFetchFromServer", info, snapshot);
+ // },
+ }),
+ );
+
+ beforeAll(() => {
+ server.listen();
+ });
+
+ afterAll(() => {
+ server.close();
+ });
+
+ afterEach(() => {
+ delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS;
+ });
+
+ const testMatrix = [
+ {
+ model: testAIModels.openai,
+ stream: true,
+ },
+ {
+ model: testAIModels.openai,
+ stream: false,
+ },
+ // this model doesn't work well with json format
+ // {
+ // model: testAIModels.groq,
+ // stream: true,
+ // },
+ // {
+ // model: testAIModels.groq,
+ // stream: false,
+ // },
+ // this model doesn't work well with json format
+ // {
+ // model: albert,
+ // stream: true,
+ // },
+ // {
+ // model: albert,
+ // stream: false,
+ // },
+ ];
+
+ for (const params of testMatrix) {
+ describe(`${params.model.provider}/${params.model.modelId} (${
+ params.stream ? "streaming" : "non-streaming"
+ })`, () => {
+ generateSharedTestCases((editor, options) =>
+ doLLMRequest(editor, {
+ ...options,
+ stream: params.stream,
+ model: params.model,
+ maxRetries: 0,
+ withDelays: false,
+ dataFormat: jsonLLMFormat,
+ }),
+ );
+ });
+ }
+});
diff --git a/packages/xl-ai/src/api/formats/json/json.ts b/packages/xl-ai/src/api/formats/json/json.ts
new file mode 100644
index 0000000000..cceba2d5c3
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/json.ts
@@ -0,0 +1,71 @@
+import { BlockNoteEditor } from "@blocknote/core";
+import { StreamTool } from "../../../streamTool/streamTool.js";
+import { defaultJSONPromptBuilder } from "./defaultJSONPromptBuilder.js";
+import {
+ getDataForPromptNoSelection,
+ getDataForPromptWithSelection,
+} from "./jsonPromptData.js";
+import { tools } from "./tools/index.js";
+
+function getStreamTools(
+ editor: BlockNoteEditor,
+ withDelays: boolean,
+ defaultStreamTools?: {
+ /** Enable the add tool (default: true) */
+ add?: boolean;
+ /** Enable the update tool (default: true) */
+ update?: boolean;
+ /** Enable the delete tool (default: true) */
+ delete?: boolean;
+ },
+ selectionInfo?: {
+ from: number;
+ to: number;
+ },
+) {
+ const mergedStreamTools = {
+ add: true,
+ update: true,
+ delete: true,
+ ...defaultStreamTools,
+ };
+
+ const streamTools: StreamTool[] = [
+ ...(mergedStreamTools.update
+ ? [
+ tools.update(editor, {
+ idsSuffixed: true,
+ withDelays,
+ updateSelection: selectionInfo,
+ }),
+ ]
+ : []),
+ ...(mergedStreamTools.add
+ ? [tools.add(editor, { idsSuffixed: true, withDelays })]
+ : []),
+ ...(mergedStreamTools.delete
+ ? [tools.delete(editor, { idsSuffixed: true, withDelays })]
+ : []),
+ ];
+
+ return streamTools;
+}
+
+export const jsonLLMFormat = {
+ /**
+ * Function to get the stream tools that can apply BlockNote JSON block updates to the editor
+ */
+ getStreamTools,
+ /**
+ * The default PromptBuilder that determines how a userPrompt is converted to an array of
+ * LLM Messages (CoreMessage[])
+ */
+ defaultPromptBuilder: defaultJSONPromptBuilder,
+ /**
+ * Helper functions which can be used when implementing a custom PromptBuilder
+ */
+ promptHelpers: {
+ getDataForPromptNoSelection,
+ getDataForPromptWithSelection,
+ },
+};
diff --git a/packages/xl-ai/src/api/formats/json/jsonPromptData.ts b/packages/xl-ai/src/api/formats/json/jsonPromptData.ts
new file mode 100644
index 0000000000..72480f929f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/jsonPromptData.ts
@@ -0,0 +1,60 @@
+import { Block, BlockNoteEditor } from "@blocknote/core";
+import { addCursorPosition } from "../../promptHelpers/addCursorPosition.js";
+import { convertBlocks } from "../../promptHelpers/convertBlocks.js";
+import { flattenBlocks } from "../../promptHelpers/flattenBlocks.js";
+import { suffixIDs } from "../../promptHelpers/suffixIds.js";
+import { trimEmptyBlocks } from "../../promptHelpers/trimEmptyBlocks.js";
+
+export async function getDataForPromptNoSelection(
+ editor: BlockNoteEditor,
+ opts: {
+ excludeBlockIds?: string[];
+ },
+) {
+ const input = trimEmptyBlocks(editor.document);
+ const blockArray = await convertBlocks(
+ flattenBlocks(input),
+ async (block) => {
+ return {
+ ...block,
+ children: undefined,
+ };
+ },
+ );
+ const withCursor = addCursorPosition(editor, blockArray);
+ const filtered = withCursor.filter(
+ (b) => "cursor" in b || !(opts.excludeBlockIds || []).includes(b.id),
+ );
+ const suffixed = suffixIDs(filtered);
+ return {
+ jsonBlocks: suffixed,
+ };
+}
+
+export async function getDataForPromptWithSelection(
+ editor: BlockNoteEditor,
+ opts: {
+ selectedBlocks: Block[];
+ },
+) {
+ const blockArray = await convertBlocks(
+ flattenBlocks(opts.selectedBlocks),
+ async (block) => {
+ return block;
+ },
+ );
+ const suffixed = suffixIDs(blockArray);
+
+ return {
+ jsonSelectedBlocks: suffixed,
+ jsonDocument: (
+ await convertBlocks(flattenBlocks(editor.document), async (block) => {
+ return {
+ ...block,
+ id: undefined, // don't pass id, because LLM should use `jsonSelectedBlocks` for this
+ children: undefined,
+ };
+ })
+ ).map(({ block }) => ({ block })), // strip ids so LLM can't accidentally issue updates to ids not in selection
+ };
+}
diff --git a/packages/xl-ai/src/api/formats/json/tools/index.ts b/packages/xl-ai/src/api/formats/json/tools/index.ts
new file mode 100644
index 0000000000..820e3e6aa4
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/tools/index.ts
@@ -0,0 +1,62 @@
+import { defaultProps, type PartialBlock } from "@blocknote/core";
+import {
+ getApplySuggestionsTr,
+ rebaseTool,
+} from "../../../../prosemirror/rebaseTool.js";
+import { blockNoteSchemaToJSONSchema } from "../../../schema/schemaToJSONSchema.js";
+import { createAddBlocksTool } from "../../base-tools/createAddBlocksTool.js";
+import { createUpdateBlockTool } from "../../base-tools/createUpdateBlockTool.js";
+import { deleteBlockTool } from "../../base-tools/delete.js";
+import { validateBlockFunction } from "./validate.js";
+
+export const tools = {
+ add: createAddBlocksTool>({
+ description: "Insert new blocks",
+ schema: (editor) => ({
+ block: {
+ $ref: "#/$defs/block",
+ },
+ ...(blockNoteSchemaToJSONSchema(editor.schema) as any),
+ }),
+ validateBlock: validateBlockFunction,
+ rebaseTool: async (_id, editor) =>
+ rebaseTool(editor, getApplySuggestionsTr(editor)),
+ toJSONToolCall: async (_editor, chunk) => {
+ return chunk.operation;
+ },
+ }),
+ update: createUpdateBlockTool>({
+ description:
+ "Update a block, the new block will replace the existing block.",
+ schema: (editor) => ({
+ block: {
+ $ref: "#/$defs/block",
+ },
+ ...(blockNoteSchemaToJSONSchema(editor.schema) as any),
+ }),
+ validateBlock: validateBlockFunction,
+ rebaseTool: async (_id, editor) =>
+ rebaseTool(editor, getApplySuggestionsTr(editor)),
+ toJSONToolCall: async (_editor, chunk) => {
+ const defaultPropsVals = Object.fromEntries(
+ Object.entries(defaultProps).map(([key, val]) => {
+ return [key, val.default];
+ }),
+ );
+
+ return {
+ ...chunk.operation,
+ block: {
+ ...chunk.operation.block,
+ props: {
+ ...defaultPropsVals,
+ ...chunk.operation.block.props,
+ },
+ },
+ };
+ },
+ }),
+ delete: deleteBlockTool,
+};
+
+export type Tools = ReturnType<(typeof tools)[keyof typeof tools]>;
diff --git a/packages/xl-ai/src/api/formats/json/tools/jsontools.test.ts b/packages/xl-ai/src/api/formats/json/tools/jsontools.test.ts
new file mode 100644
index 0000000000..065a09b5ac
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/tools/jsontools.test.ts
@@ -0,0 +1,122 @@
+/* eslint-disable jest/valid-title */
+import { BlockNoteEditor } from "@blocknote/core";
+import { describe, expect, it } from "vitest";
+import { addOperationTestCases } from "../../../../testUtil/cases/addOperationTestCases.js";
+import { combinedOperationsTestCases } from "../../../../testUtil/cases/combinedOperationsTestCases.js";
+import { deleteOperationTestCases } from "../../../../testUtil/cases/deleteOperationTestCases.js";
+import { DocumentOperationTestCase } from "../../../../testUtil/cases/index.js";
+import { updateOperationTestCases } from "../../../../testUtil/cases/updateOperationTestCases.js";
+import { createAsyncIterableStreamFromAsyncIterable } from "../../../../util/stream.js";
+import { LLMResponse } from "../../../LLMResponse.js";
+import { AddBlocksToolCall } from "../../base-tools/createAddBlocksTool.js";
+import { UpdateBlockToolCall } from "../../base-tools/createUpdateBlockTool.js";
+import { DeleteBlockToolCall } from "../../base-tools/delete.js";
+import { tools } from "./index.js";
+
+// Helper function to create a mock stream from operations
+import { getAIExtension } from "../../../../AIExtension.js";
+import { getExpectedEditor } from "../../../../testUtil/cases/index.js";
+import { validateRejectingResultsInOriginalDoc } from "../../../../testUtil/suggestChangesTestUtil.js";
+async function* createMockStream(
+ ...operations: {
+ operation:
+ | AddBlocksToolCall
+ | UpdateBlockToolCall
+ | DeleteBlockToolCall;
+ isUpdateToPreviousOperation?: boolean;
+ isPossiblyPartial?: boolean;
+ }[]
+) {
+ for (const op of operations) {
+ yield {
+ isUpdateToPreviousOperation: false,
+ isPossiblyPartial: false,
+ ...op,
+ };
+ }
+}
+// Helper function to process operations and return results
+async function executeTestCase(
+ editor: BlockNoteEditor,
+ testCase: DocumentOperationTestCase,
+) {
+ const originalDoc = editor.prosemirrorState.doc;
+ const streamTools = [
+ tools.add(editor, { idsSuffixed: true, withDelays: false }),
+ tools.update(editor, {
+ idsSuffixed: true,
+ withDelays: false,
+ updateSelection: testCase.getTestSelection?.(editor),
+ }),
+ tools.delete(editor, { idsSuffixed: true, withDelays: false }),
+ ];
+
+ const stream = createMockStream(
+ ...testCase.baseToolCalls.map((u) => ({ operation: u })),
+ );
+
+ // bit hacky way to instantiate an LLMResponse just so we can call execute
+ const result = new LLMResponse(
+ undefined as any,
+ {
+ operationsSource: createAsyncIterableStreamFromAsyncIterable(stream),
+ streamObjectResult: undefined,
+ generateObjectResult: undefined,
+ getGeneratedOperations: undefined as any,
+ },
+ streamTools,
+ );
+
+ await result.execute();
+
+ validateRejectingResultsInOriginalDoc(editor, originalDoc);
+
+ getAIExtension(editor).acceptChanges();
+ expect(editor.document).toEqual(getExpectedEditor(testCase).document);
+
+ return result;
+}
+
+describe("Add", () => {
+ for (const testCase of addOperationTestCases) {
+ it(testCase.description, async () => {
+ const editor = testCase.editor();
+
+ await executeTestCase(editor, testCase);
+ });
+ }
+});
+
+describe("Update", () => {
+ for (const testCase of updateOperationTestCases) {
+ it(testCase.description, async () => {
+ const editor = testCase.editor();
+
+ await executeTestCase(editor, testCase);
+ });
+ }
+});
+
+describe("Delete", () => {
+ for (const testCase of deleteOperationTestCases) {
+ it(testCase.description, async () => {
+ const editor = testCase.editor();
+ const startDocLength = editor.document.length;
+ await executeTestCase(editor, testCase);
+
+ expect(editor.document.length).toBe(
+ startDocLength - testCase.baseToolCalls.length,
+ );
+ });
+ }
+});
+
+describe("Combined", () => {
+ for (const testCase of combinedOperationsTestCases) {
+ it(testCase.description, async () => {
+ const editor = testCase.editor();
+
+ await executeTestCase(editor, testCase);
+ });
+ }
+});
diff --git a/packages/xl-ai/src/api/formats/json/tools/validate.ts b/packages/xl-ai/src/api/formats/json/tools/validate.ts
new file mode 100644
index 0000000000..10d95d0599
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/json/tools/validate.ts
@@ -0,0 +1,107 @@
+import {
+ BlockNoteEditor,
+ PartialBlock,
+ isLinkInlineContent,
+ isStyledTextInlineContent,
+} from "@blocknote/core";
+import { Result } from "../../../../streamTool/streamTool.js";
+
+function validateInlineContent(content: any, editor: any): boolean {
+ const inlineContentConfig =
+ editor.schema.inlineContentSchema[
+ content.type as keyof typeof editor.schema.inlineContentSchema
+ ];
+
+ if (!inlineContentConfig) {
+ return false;
+ }
+
+ if (isStyledTextInlineContent(content)) {
+ if (!("text" in content)) {
+ return false;
+ }
+ }
+
+ if (isLinkInlineContent(content)) {
+ if (!("content" in content) || !("href" in content)) {
+ return false;
+ }
+
+ return validateInlineContent(content.content, editor);
+ }
+
+ // TODO: custom ic content
+ return true;
+}
+
+export function validateBlockFunction(
+ block: any,
+ editor: BlockNoteEditor,
+ fallbackType?: string,
+): Result> {
+ const type = block.type || fallbackType;
+ const blockConfig =
+ editor.schema.blockSchema[type as keyof typeof editor.schema.blockSchema];
+
+ if (!blockConfig) {
+ return {
+ ok: false,
+ error: "block type not found in editor",
+ };
+ }
+
+ if (block.children) {
+ // LLM tools are not supposed to edit children at this moment
+ // return false; TODO, bringing this back breaks markdown tests
+ }
+
+ if (blockConfig.content === "none") {
+ if (block.content) {
+ // no content expected for this block
+ return {
+ ok: false,
+ error: "block content not expected for this block type",
+ };
+ }
+ } else {
+ if (!block.content) {
+ // return false;
+ return {
+ ok: true,
+ value: block,
+ };
+ }
+
+ if (!Array.isArray(block.content)) {
+ // content expected for this block
+ return {
+ ok: false,
+ error: "block content must be an array",
+ };
+ }
+
+ if (blockConfig.content === "table") {
+ // no validation for table content (TODO)
+ return {
+ ok: true,
+ value: block,
+ };
+ }
+
+ if (
+ !(block.content as []).every((content: any) => {
+ return validateInlineContent(content, editor);
+ })
+ ) {
+ return {
+ ok: false,
+ error: "block content must be an array of inline content",
+ };
+ }
+ }
+ // TODO: validate props
+ return {
+ ok: true,
+ value: block,
+ };
+}
diff --git a/packages/xl-ai/src/api/formats/markdown-blocks/defaultMarkdownPromptBuilder.ts b/packages/xl-ai/src/api/formats/markdown-blocks/defaultMarkdownPromptBuilder.ts
new file mode 100644
index 0000000000..5d76927ec1
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/markdown-blocks/defaultMarkdownPromptBuilder.ts
@@ -0,0 +1,111 @@
+import { CoreMessage } from "ai";
+import { PromptBuilder } from "../PromptBuilder.js";
+import {
+ getDataForPromptNoSelection,
+ getDataForPromptWithSelection,
+} from "./markdownPromptData.js";
+
+function promptManipulateSelectionMarkdownBlocks(opts: {
+ userPrompt: string;
+ markdownSelectedBlocks: {
+ id: string;
+ block: string;
+ }[];
+ markdownDocument: {
+ block: string;
+ }[];
+}): Array {
+ return [
+ {
+ role: "system",
+ content: `You're manipulating a selected part of a text document using markdown blocks.
+ Make sure to follow the json schema provided and always include the trailing $ in ids.
+ This is the selection as an array of markdown blocks:`,
+ },
+ {
+ role: "system",
+ content: JSON.stringify(opts.markdownSelectedBlocks),
+ },
+
+ {
+ role: "system",
+ content:
+ "This is the entire document (INCLUDING the selected text), find the selected text in there to understand the context:",
+ },
+ {
+ role: "system",
+ content: JSON.stringify(opts.markdownDocument),
+ },
+ {
+ role: "system",
+ content: "The user asks you to do the following:",
+ },
+ {
+ role: "user",
+ content: opts.userPrompt,
+ },
+ ];
+}
+
+function promptManipulateDocumentUseMarkdownBlocks(opts: {
+ userPrompt: string;
+ markdownBlocks: Array<
+ | {
+ id: string;
+ block: string;
+ }
+ | {
+ cursor: true;
+ }
+ >;
+}): Array {
+ return [
+ {
+ role: "system",
+ content: `You're manipulating a text document using markdown blocks.
+ Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $).
+ This is the document as an array of markdown blocks (the cursor is BETWEEN two blocks as indicated by cursor: true):`,
+ },
+ {
+ role: "system",
+ content: JSON.stringify(opts.markdownBlocks),
+ },
+ {
+ role: "system",
+ content: "The user asks you to do the following:",
+ },
+ {
+ role: "user",
+ content: opts.userPrompt,
+ },
+ {
+ role: "system",
+ content: `First, determine what part of the document the user is talking about. You SHOULD probably take cursor info into account if needed.
+ EXAMPLE: if user says "below" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor.
+ EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need \`referenceId\` to point to the block before the cursor with position \`after\` (or block below and \`before\`).
+
+ Prefer updating blocks over adding or removing (but this also depends on the user's question).`,
+ },
+ ];
+}
+
+export const defaultMarkdownPromptBuilder: PromptBuilder = async (
+ editor,
+ opts,
+) => {
+ if (opts.selectedBlocks) {
+ const data = await getDataForPromptWithSelection(editor, {
+ selectedBlocks: opts.selectedBlocks,
+ });
+ return promptManipulateSelectionMarkdownBlocks({
+ ...data,
+ userPrompt: opts.userPrompt,
+ });
+ } else {
+ const data = await getDataForPromptNoSelection(editor, opts);
+ return promptManipulateDocumentUseMarkdownBlocks({
+ ...data,
+ userPrompt: opts.userPrompt,
+ });
+ }
+};
diff --git a/packages/xl-ai/src/api/formats/markdown-blocks/markdownBlocks.test.ts b/packages/xl-ai/src/api/formats/markdown-blocks/markdownBlocks.test.ts
new file mode 100644
index 0000000000..4bb89079f6
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/markdown-blocks/markdownBlocks.test.ts
@@ -0,0 +1,138 @@
+import { afterAll, afterEach, beforeAll, describe } from "vitest";
+
+import { getCurrentTest } from "@vitest/runner";
+import { getSortedEntries, snapshot, toHashString } from "msw-snapshot";
+import { setupServer } from "msw/node";
+import path from "path";
+import { testAIModels } from "../../../testUtil/testAIModels.js";
+import { doLLMRequest } from "../../LLMRequest.js";
+import { generateSharedTestCases } from "../tests/sharedTestCases.js";
+import { markdownBlocksLLMFormat } from "./markdownBlocks.js";
+
+const BASE_FILE_PATH = path.resolve(
+ __dirname,
+ "__snapshots__",
+ path.basename(__filename),
+);
+
+const fetchCountMap: Record = {};
+
+async function createRequestHash(req: Request) {
+ const url = new URL(req.url);
+ return [
+ // url.host,
+ // url.pathname,
+ toHashString([
+ req.method,
+ url.origin,
+ url.pathname,
+ getSortedEntries(url.searchParams),
+ getSortedEntries(req.headers),
+ // getSortedEntries(req.cookies),
+ new TextDecoder("utf-8").decode(await req.arrayBuffer()),
+ ]),
+ ].join("/");
+}
+
+// Main test suite with snapshot middleware
+describe("Models", () => {
+ // Define server with snapshot middleware for the main tests
+ const server = setupServer(
+ snapshot({
+ updateSnapshots: "missing",
+ // onSnapshotUpdated: "all",
+ // ignoreSnapshots: true,
+ async createSnapshotPath(info) {
+ // use a unique path for each model
+ const t = getCurrentTest()!;
+ const mswPath = path.join(
+ t.suite!.name, // same directory as the test snapshot
+ "__msw_snapshots__",
+ t.suite!.suite!.name, // model / streaming params
+ t.name,
+ );
+ // in case there are multiple requests in a test, we need to use a separate snapshot for each request
+ fetchCountMap[mswPath] = (fetchCountMap[mswPath] || 0) + 1;
+ const hash = await createRequestHash(info.request);
+ return mswPath + `_${fetchCountMap[mswPath]}_${hash}.json`;
+ },
+ basePath: BASE_FILE_PATH,
+ // onFetchFromSnapshot(info, snapshot) {
+ // console.log("onFetchFromSnapshot", info, snapshot);
+ // },
+ // onFetchFromServer(info, snapshot) {
+ // console.log("onFetchFromServer", info, snapshot);
+ // },
+ }),
+ );
+
+ beforeAll(() => {
+ server.listen();
+ });
+
+ afterAll(() => {
+ server.close();
+ });
+
+ afterEach(() => {
+ delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS;
+ });
+
+ const testMatrix = [
+ {
+ model: testAIModels.openai,
+ stream: true,
+ },
+ {
+ model: testAIModels.openai,
+ stream: false,
+ },
+ {
+ model: testAIModels.groq,
+ stream: true,
+ },
+ {
+ model: testAIModels.groq,
+ stream: false,
+ },
+ {
+ model: testAIModels.albert,
+ stream: true,
+ },
+ {
+ model: testAIModels.albert,
+ stream: false,
+ },
+ ];
+
+ for (const params of testMatrix) {
+ // SKIP: prefer html blocks over markdown blocks for now
+ describe.skip(`${params.model.provider}/${params.model.modelId} (${
+ params.stream ? "streaming" : "non-streaming"
+ })`, () => {
+ generateSharedTestCases(
+ (editor, options) =>
+ doLLMRequest(editor, {
+ ...options,
+ model: params.model,
+ maxRetries: 0,
+ stream: params.stream,
+ withDelays: false,
+ dataFormat: markdownBlocksLLMFormat,
+ // _generateObjectOptions: {
+ // providerOptions: {
+ // "albert-etalab": {
+ // guided_decoding_backend: "outlines",
+ // },
+ // },
+ // },
+ }),
+ // markdownblocks doesn't support these:
+ {
+ mentions: true,
+ textAlignment: true,
+ },
+ );
+ });
+ }
+});
diff --git a/packages/xl-ai/src/api/formats/markdown-blocks/markdownBlocks.ts b/packages/xl-ai/src/api/formats/markdown-blocks/markdownBlocks.ts
new file mode 100644
index 0000000000..3b0af6c164
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/markdown-blocks/markdownBlocks.ts
@@ -0,0 +1,71 @@
+import { BlockNoteEditor } from "@blocknote/core";
+import { StreamTool } from "../../../streamTool/streamTool.js";
+import { defaultMarkdownPromptBuilder } from "./defaultMarkdownPromptBuilder.js";
+import {
+ getDataForPromptNoSelection,
+ getDataForPromptWithSelection,
+} from "./markdownPromptData.js";
+import { tools } from "./tools/index.js";
+
+function getStreamTools(
+ editor: BlockNoteEditor,
+ withDelays: boolean,
+ defaultStreamTools?: {
+ /** Enable the add tool (default: true) */
+ add?: boolean;
+ /** Enable the update tool (default: true) */
+ update?: boolean;
+ /** Enable the delete tool (default: true) */
+ delete?: boolean;
+ },
+ selectionInfo?: {
+ from: number;
+ to: number;
+ },
+) {
+ const mergedStreamTools = {
+ add: true,
+ update: true,
+ delete: true,
+ ...defaultStreamTools,
+ };
+
+ const streamTools: StreamTool[] = [
+ ...(mergedStreamTools.update
+ ? [
+ tools.update(editor, {
+ idsSuffixed: true,
+ withDelays,
+ updateSelection: selectionInfo,
+ }),
+ ]
+ : []),
+ ...(mergedStreamTools.add
+ ? [tools.add(editor, { idsSuffixed: true, withDelays })]
+ : []),
+ ...(mergedStreamTools.delete
+ ? [tools.delete(editor, { idsSuffixed: true, withDelays })]
+ : []),
+ ];
+
+ return streamTools;
+}
+
+export const markdownBlocksLLMFormat = {
+ /**
+ * Function to get the stream tools that can apply BlockNote Markdown block updates to the editor
+ */
+ getStreamTools,
+ /**
+ * The default PromptBuilder that determines how a userPrompt is converted to an array of
+ * LLM Messages (CoreMessage[])
+ */
+ defaultPromptBuilder: defaultMarkdownPromptBuilder,
+ /**
+ * Helper functions which can be used when implementing a custom PromptBuilder
+ */
+ promptHelpers: {
+ getDataForPromptNoSelection,
+ getDataForPromptWithSelection,
+ },
+};
diff --git a/packages/xl-ai/src/api/formats/markdown-blocks/markdownPromptData.ts b/packages/xl-ai/src/api/formats/markdown-blocks/markdownPromptData.ts
new file mode 100644
index 0000000000..5b983dc7c1
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/markdown-blocks/markdownPromptData.ts
@@ -0,0 +1,51 @@
+import { Block, BlockNoteEditor } from "@blocknote/core";
+import { addCursorPosition } from "../../promptHelpers/addCursorPosition.js";
+import { convertBlocks } from "../../promptHelpers/convertBlocks.js";
+import { flattenBlocks } from "../../promptHelpers/flattenBlocks.js";
+import { suffixIDs } from "../../promptHelpers/suffixIds.js";
+import { trimEmptyBlocks } from "../../promptHelpers/trimEmptyBlocks.js";
+
+export async function getDataForPromptNoSelection(
+ editor: BlockNoteEditor,
+ opts: {
+ excludeBlockIds?: string[];
+ },
+) {
+ const input = trimEmptyBlocks(editor.document);
+ const blockArray = await convertBlocks(
+ flattenBlocks(input),
+ async (block) => {
+ return editor.blocksToMarkdownLossy([block]);
+ },
+ );
+ const withCursor = addCursorPosition(editor, blockArray);
+ const filtered = withCursor.filter(
+ (b) => "cursor" in b || !(opts.excludeBlockIds || []).includes(b.id),
+ );
+ const suffixed = suffixIDs(filtered);
+ return {
+ markdownBlocks: suffixed,
+ };
+}
+
+export async function getDataForPromptWithSelection(
+ editor: BlockNoteEditor,
+ opts: { selectedBlocks: Block[] },
+) {
+ const blockArray = await convertBlocks(
+ flattenBlocks(opts.selectedBlocks),
+ async (block) => {
+ return editor.blocksToMarkdownLossy([block]);
+ },
+ );
+ const suffixed = suffixIDs(blockArray);
+
+ return {
+ markdownSelectedBlocks: suffixed,
+ markdownDocument: (
+ await convertBlocks(flattenBlocks(editor.document), async (block) => {
+ return editor.blocksToMarkdownLossy([block]);
+ })
+ ).map(({ block }) => ({ block })), // strip ids so LLM can't accidentally issue updates to ids not in selection
+ };
+}
diff --git a/packages/xl-ai/src/api/formats/markdown-blocks/tools/index.ts b/packages/xl-ai/src/api/formats/markdown-blocks/tools/index.ts
new file mode 100644
index 0000000000..65913fb7d0
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/markdown-blocks/tools/index.ts
@@ -0,0 +1,82 @@
+import { PartialBlock } from "@blocknote/core";
+import {
+ AddBlocksToolCall,
+ createAddBlocksTool,
+} from "../../base-tools/createAddBlocksTool.js";
+import {
+ createUpdateBlockTool,
+ UpdateBlockToolCall,
+} from "../../base-tools/createUpdateBlockTool.js";
+import { deleteBlockTool } from "../../base-tools/delete.js";
+import { createMDRebaseTool } from "./rebaseTool.js";
+import { validateBlockFunction } from "./validate.js";
+
+export const tools = {
+ add: createAddBlocksTool({
+ description: "Insert new blocks",
+ schema: {
+ block: {
+ $ref: "#/$defs/block",
+ },
+ $defs: {
+ block: { type: "string", description: "markdown of block" },
+ },
+ },
+ validateBlock: validateBlockFunction,
+ rebaseTool: createMDRebaseTool,
+ toJSONToolCall: async (editor, chunk) => {
+ const blocks = await Promise.all(
+ chunk.operation.blocks.map(async (md) => {
+ const block = (await editor.tryParseMarkdownToBlocks(md.trim()))[0]; // TODO: trim
+ delete (block as any).id;
+ return block;
+ }),
+ );
+
+ // hacky
+ if ((window as any).__TEST_OPTIONS) {
+ (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS.mockID =
+ undefined;
+ }
+
+ return {
+ ...chunk.operation,
+ blocks,
+ } satisfies AddBlocksToolCall>;
+ },
+ }),
+ update: createUpdateBlockTool({
+ description:
+ "Update a block, the new block will replace the existing block.",
+ schema: {
+ block: {
+ $ref: "#/$defs/block",
+ },
+ $defs: {
+ block: { type: "string", description: "markdown of block" },
+ },
+ },
+ validateBlock: validateBlockFunction,
+ rebaseTool: createMDRebaseTool,
+ toJSONToolCall: async (editor, chunk) => {
+ const block = (
+ await editor.tryParseMarkdownToBlocks(chunk.operation.block.trim())
+ )[0];
+
+ delete (block as any).id;
+ // console.log("update", operation.block);
+ // console.log("md", block);
+ // hacky
+ if ((window as any).__TEST_OPTIONS) {
+ (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS.mockID =
+ undefined;
+ }
+
+ return {
+ ...chunk.operation,
+ block,
+ } satisfies UpdateBlockToolCall>;
+ },
+ }),
+ delete: deleteBlockTool,
+};
diff --git a/packages/xl-ai/src/api/formats/markdown-blocks/tools/rebaseTool.ts b/packages/xl-ai/src/api/formats/markdown-blocks/tools/rebaseTool.ts
new file mode 100644
index 0000000000..49be094011
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/markdown-blocks/tools/rebaseTool.ts
@@ -0,0 +1,35 @@
+import { BlockNoteEditor, getBlock } from "@blocknote/core";
+import { Mapping } from "prosemirror-transform";
+import { updateToReplaceSteps } from "../../../../prosemirror/changeset.js";
+import {
+ getApplySuggestionsTr,
+ rebaseTool,
+} from "../../../../prosemirror/rebaseTool.js";
+
+export async function createMDRebaseTool(
+ id: string,
+ editor: BlockNoteEditor,
+) {
+ const tr = getApplySuggestionsTr(editor);
+ const md = await editor.blocksToMarkdownLossy([getBlock(tr.doc, id)!]);
+ const blocks = await editor.tryParseMarkdownToBlocks(md);
+
+ const steps = updateToReplaceSteps(
+ {
+ id,
+ block: blocks[0],
+ },
+ tr.doc,
+ );
+
+ const stepMapping = new Mapping();
+ for (const step of steps) {
+ const mapped = step.map(stepMapping);
+ if (!mapped) {
+ throw new Error("Failed to map step");
+ }
+ tr.step(mapped);
+ stepMapping.appendMap(mapped.getMap());
+ }
+ return rebaseTool(editor, tr);
+}
diff --git a/packages/xl-ai/src/api/formats/markdown-blocks/tools/validate.ts b/packages/xl-ai/src/api/formats/markdown-blocks/tools/validate.ts
new file mode 100644
index 0000000000..3468cdd80f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/markdown-blocks/tools/validate.ts
@@ -0,0 +1,15 @@
+import { Result } from "../../../../streamTool/streamTool.js";
+
+export function validateBlockFunction(block: any): Result {
+ if (typeof block !== "string") {
+ return {
+ ok: false,
+ error: "block must be a string",
+ };
+ }
+
+ return {
+ ok: true,
+ value: block,
+ };
+}
diff --git a/packages/xl-ai/src/api/formats/tests/sharedTestCases.ts b/packages/xl-ai/src/api/formats/tests/sharedTestCases.ts
new file mode 100644
index 0000000000..a2026ff442
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tests/sharedTestCases.ts
@@ -0,0 +1,151 @@
+import { BlockNoteEditor } from "@blocknote/core";
+import { getCurrentTest, TaskContext } from "@vitest/runner";
+import path from "path";
+import { TextSelection } from "prosemirror-state";
+import { describe, expect, it } from "vitest";
+import { getAIExtension } from "../../../AIExtension.js";
+import { addOperationTestCases } from "../../../testUtil/cases/addOperationTestCases.js";
+import { combinedOperationsTestCases } from "../../../testUtil/cases/combinedOperationsTestCases.js";
+import { deleteOperationTestCases } from "../../../testUtil/cases/deleteOperationTestCases.js";
+import {
+ DocumentOperationTestCase,
+ getExpectedEditor,
+} from "../../../testUtil/cases/index.js";
+import { updateOperationTestCases } from "../../../testUtil/cases/updateOperationTestCases.js";
+import { validateRejectingResultsInOriginalDoc } from "../../../testUtil/suggestChangesTestUtil.js";
+import { LLMResponse } from "../../LLMResponse.js";
+
+const BASE_FILE_PATH = path.resolve(__dirname, "__snapshots__");
+
+// @ts-ignore
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+async function matchFileSnapshot(data: any, postFix = "") {
+ const t = getCurrentTest()!;
+ // this uses the same snapshot path, regardless of the model / streaming params
+ await expect(data).toMatchFileSnapshot(
+ path.resolve(
+ BASE_FILE_PATH,
+ t.suite!.name,
+ t.name + (postFix ? `_${postFix}` : "") + ".json",
+ ),
+ );
+}
+
+export function generateSharedTestCases(
+ callLLM: (
+ editor: BlockNoteEditor,
+ params: { userPrompt: string; useSelection?: boolean },
+ ) => Promise,
+ skipTestsRequiringCapabilities?: {
+ mentions?: boolean;
+ textAlignment?: boolean;
+ blockColor?: boolean;
+ },
+) {
+ function skipIfUnsupported(
+ test: DocumentOperationTestCase,
+ context: TaskContext,
+ ) {
+ if (
+ skipTestsRequiringCapabilities &&
+ Object.keys(test.requiredCapabilities || {}).some(
+ (c) =>
+ skipTestsRequiringCapabilities[
+ c as keyof typeof skipTestsRequiringCapabilities
+ ] === true,
+ )
+ ) {
+ context.skip();
+ }
+ }
+
+ async function executeTestCase(
+ editor: BlockNoteEditor,
+ test: DocumentOperationTestCase,
+ ) {
+ const selection = test.getTestSelection?.(editor);
+
+ if (selection) {
+ editor.transact((tr) => {
+ tr.setSelection(
+ TextSelection.create(tr.doc, selection.from, selection.to),
+ );
+ });
+ }
+
+ const originalDoc = editor.prosemirrorState.doc;
+
+ const result = await callLLM(editor, {
+ userPrompt: test.userPrompt,
+ useSelection: selection !== undefined,
+ });
+
+ // await result._logToolCalls();
+ await result.execute();
+
+ // the prosemirrorState has all details with suggested changes
+ // This can be used for snapshots, but currently we've disabled this as there can
+ // be small differences between for example streaming and non-streaming results in the
+ // granularity of the suggested changes. Can be enabled for debugging:
+
+ // await matchFileSnapshot(editor.prosemirrorState.doc.toJSON());
+
+ validateRejectingResultsInOriginalDoc(editor, originalDoc);
+
+ // we first need to accept changes to get the correct result
+ getAIExtension(editor).acceptChanges();
+ expect(editor.document).toEqual(
+ getExpectedEditor(test, {
+ deleteEmptyCursorBlock: true,
+ }).document,
+ );
+ }
+
+ describe("Add", () => {
+ for (const test of addOperationTestCases) {
+ it(test.description, async (c) => {
+ skipIfUnsupported(test, c);
+
+ const editor = test.editor();
+
+ await executeTestCase(editor, test);
+ });
+ }
+ });
+
+ describe("Update", () => {
+ for (const test of updateOperationTestCases) {
+ it(test.description, async (c) => {
+ skipIfUnsupported(test, c);
+
+ const editor = test.editor();
+
+ await executeTestCase(editor, test);
+ });
+ }
+ });
+
+ describe("Delete", () => {
+ for (const test of deleteOperationTestCases) {
+ it(test.description, async (c) => {
+ skipIfUnsupported(test, c);
+
+ const editor = test.editor();
+
+ await executeTestCase(editor, test);
+ });
+ }
+ });
+
+ describe("Combined", () => {
+ for (const test of combinedOperationsTestCases) {
+ it(test.description, async (c) => {
+ skipIfUnsupported(test, c);
+
+ const editor = test.editor();
+
+ await executeTestCase(editor, test);
+ });
+ }
+ });
+}
diff --git a/packages/xl-ai/src/api/formats/tests/validateTestEnvironment.test.ts b/packages/xl-ai/src/api/formats/tests/validateTestEnvironment.test.ts
new file mode 100644
index 0000000000..79960f3342
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tests/validateTestEnvironment.test.ts
@@ -0,0 +1,81 @@
+import * as glob from "glob";
+import path from "path";
+import { describe, expect, it } from "vitest";
+
+/**
+ * We should only have one snapshot file per test, this test ensures that
+ *
+ * If this test fails, you probably changed something in the request to an LLM.
+ * This causes MSW to generate a new snapshot (with a different hash).
+ * If that's intended, make sure to delete the old snapshot files.
+ */
+describe("MSW Snapshots", () => {
+ it("should only have one snapshot file per test", async () => {
+ const snapshotFiles = glob.sync(
+ path.join(__dirname, "../**/__msw_snapshots__/**/*.json"),
+ );
+
+ // Group files by test name (excluding the sequence number and hash)
+ const testGroups: Record = {};
+
+ for (const file of snapshotFiles) {
+ // Extract the base name (removing the _1_, _2_ etc. and hash)
+ const match = file.match(/(.*)_\d+_[a-f0-9]+\.json$/);
+ if (match) {
+ const baseName = match[1];
+ if (!testGroups[baseName]) {
+ testGroups[baseName] = [];
+ }
+ testGroups[baseName].push(file);
+ } else {
+ throw new Error(`Invalid snapshot file: ${file}`);
+ }
+ }
+
+ // Filter and get tests with multiple snapshot files
+ const duplicates = Object.entries(testGroups)
+ .filter(([_, files]) => files.length > 1)
+ .map(([testName, files]) => ({
+ testName: path.basename(testName),
+ count: files.length,
+ files: files.map((file) => path.basename(file)),
+ }));
+
+ // Create error message if duplicates are found
+ const errorMessage =
+ duplicates.length > 0
+ ? [
+ `Found duplicate MSW snapshot files for the following (${duplicates.length}) tests:`,
+ ...duplicates.map(
+ ({ testName, count, files }) =>
+ ` - ${testName}: ${count} files\n ${files.join("\n ")}`,
+ ),
+ "",
+ "Each test should have only one snapshot file.",
+ "Please clean up the duplicate snapshots by keeping only the most relevant one for each test.",
+ ].join("\n")
+ : "";
+
+ // Throw an error with the message if duplicates found
+ if (duplicates.length > 0) {
+ throw new Error(errorMessage);
+ }
+ });
+});
+
+describe("Test environment", () => {
+ it("should have certs installed to connect to localhost", () => {
+ expect(process.env.NODE_EXTRA_CA_CERTS).toBeDefined();
+
+ /* if this test fails, maybe you're running tests via vscode extension?
+
+ You'll need:
+
+ "vitest.nodeEnv": {
+ "NODE_EXTRA_CA_CERTS": "/Users/USERNAME/Library/Application Support/mkcert/rootCA.pem"
+ }
+
+ in your vscode settings (or other path to mkcert rootCA.pem)
+ */
+ });
+});
diff --git a/packages/xl-ai/src/api/index.ts b/packages/xl-ai/src/api/index.ts
new file mode 100644
index 0000000000..1f25d707bf
--- /dev/null
+++ b/packages/xl-ai/src/api/index.ts
@@ -0,0 +1,40 @@
+import { BlockNoteEditor } from "@blocknote/core";
+import { StreamTool } from "../streamTool/streamTool.js";
+import { htmlBlockLLMFormat } from "./formats/html-blocks/htmlBlocks.js";
+import { jsonLLMFormat } from "./formats/json/json.js";
+import { markdownBlocksLLMFormat } from "./formats/markdown-blocks/markdownBlocks.js";
+import { PromptBuilder } from "./formats/PromptBuilder.js";
+
+export type LLMFormat = {
+ /**
+ * Function to get the stream tools that can apply HTML block updates to the editor
+ */
+ getStreamTools: (
+ editor: BlockNoteEditor,
+ withDelays: boolean,
+ defaultStreamTools?: {
+ add?: boolean;
+ update?: boolean;
+ delete?: boolean;
+ },
+ selectionInfo?: {
+ from: number;
+ to: number;
+ },
+ onBlockUpdate?: (blockId: string) => void,
+ ) => StreamTool[];
+ /**
+ * The default PromptBuilder that determines how a userPrompt is converted to an array of
+ * LLM Messages (CoreMessage[])
+ */
+ defaultPromptBuilder: PromptBuilder;
+};
+
+export const llmFormats = {
+ _experimental_json: jsonLLMFormat,
+ _experimental_markdown: markdownBlocksLLMFormat,
+ html: htmlBlockLLMFormat,
+};
+
+export { doLLMRequest as callLLM } from "./LLMRequest.js";
+export { promptHelpers } from "./promptHelpers/index.js";
diff --git a/packages/xl-ai/src/api/promptHelpers/addCursorPosition.ts b/packages/xl-ai/src/api/promptHelpers/addCursorPosition.ts
new file mode 100644
index 0000000000..8d357dd620
--- /dev/null
+++ b/packages/xl-ai/src/api/promptHelpers/addCursorPosition.ts
@@ -0,0 +1,34 @@
+import { BlockNoteEditor } from "@blocknote/core";
+
+type BlocksWithCursor = {
+ id: string;
+ block: T;
+} | {
+ cursor: true;
+}
+
+export function addCursorPosition(editor: BlockNoteEditor, source: Array<{
+ id: string;
+ block: T;
+}>): Array>
+{
+ const cursorPosition = editor.getTextCursorPosition();
+ const ret: Array> = [];
+
+ for (const block of source) {
+ const isBlockWithCursor = block.id === cursorPosition.block.id;
+
+ ret.push({
+ id: block.id,
+ block: block.block,
+ });
+
+ if (isBlockWithCursor) {
+ ret.push({
+ cursor: true,
+ });
+ }
+ }
+
+ return ret;
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/promptHelpers/convertBlocks.ts b/packages/xl-ai/src/api/promptHelpers/convertBlocks.ts
new file mode 100644
index 0000000000..a8ff6953fb
--- /dev/null
+++ b/packages/xl-ai/src/api/promptHelpers/convertBlocks.ts
@@ -0,0 +1,13 @@
+import { Block } from "@blocknote/core";
+
+export async function convertBlocks(source: Block[], mapFn: (block: Block) => Promise): Promise> {
+ return await Promise.all(source.map(async (block) => {
+ return {
+ id: block.id,
+ block: await mapFn(block),
+ };
+ }));
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/promptHelpers/flattenBlocks.ts b/packages/xl-ai/src/api/promptHelpers/flattenBlocks.ts
new file mode 100644
index 0000000000..fda10be133
--- /dev/null
+++ b/packages/xl-ai/src/api/promptHelpers/flattenBlocks.ts
@@ -0,0 +1,13 @@
+import { Block } from "@blocknote/core";
+
+export function flattenBlocks(
+ source: Block[],
+): Array> {
+ return source.flatMap((block) => [
+ {
+ ...block,
+ children: [],
+ },
+ ...flattenBlocks(block.children),
+ ]);
+}
diff --git a/packages/xl-ai/src/api/promptHelpers/index.ts b/packages/xl-ai/src/api/promptHelpers/index.ts
new file mode 100644
index 0000000000..d02ad75dfd
--- /dev/null
+++ b/packages/xl-ai/src/api/promptHelpers/index.ts
@@ -0,0 +1,13 @@
+import { addCursorPosition } from "./addCursorPosition.js";
+import { convertBlocks } from "./convertBlocks.js";
+import { flattenBlocks } from "./flattenBlocks.js";
+import { suffixIDs } from "./suffixIds.js";
+import { trimEmptyBlocks } from "./trimEmptyBlocks.js";
+
+export const promptHelpers = {
+ addCursorPosition,
+ flattenBlocks,
+ suffixIDs,
+ trimEmptyBlocks,
+ convertBlocks,
+};
diff --git a/packages/xl-ai/src/api/promptHelpers/suffixIds.ts b/packages/xl-ai/src/api/promptHelpers/suffixIds.ts
new file mode 100644
index 0000000000..632c1ffb62
--- /dev/null
+++ b/packages/xl-ai/src/api/promptHelpers/suffixIds.ts
@@ -0,0 +1,11 @@
+export function suffixIDs(source: Array): Array {
+ return source.map((el) => {
+ if (typeof el === "object" && el && "id" in el) {
+ return {
+ ...el,
+ id: `${el.id}$`,
+ };
+ }
+ return el;
+ });
+}
diff --git a/packages/xl-ai/src/api/promptHelpers/trimEmptyBlocks.ts b/packages/xl-ai/src/api/promptHelpers/trimEmptyBlocks.ts
new file mode 100644
index 0000000000..b992912baa
--- /dev/null
+++ b/packages/xl-ai/src/api/promptHelpers/trimEmptyBlocks.ts
@@ -0,0 +1,25 @@
+import { Block } from "@blocknote/core";
+import { isEmptyParagraph } from "../../util/emptyBlock.js";
+import { trimArray } from "../../util/trimArray.js";
+
+export function trimEmptyBlocks(
+ source: Block[],
+ opts?: {
+ trimStart?: boolean;
+ trimEnd?: boolean;
+ },
+) {
+ // trim empty trailing blocks that don't have the cursor
+ // if we don't do this, commands like "add some paragraphs"
+ // would add paragraphs after the trailing blocks
+ const trimmedSource = trimArray(
+ source,
+ (block) => {
+ return isEmptyParagraph(block);
+ },
+ opts?.trimStart ?? false,
+ opts?.trimEnd ?? true,
+ );
+
+ return trimmedSource;
+}
diff --git a/packages/xl-ai/src/api/schema/JSONSchema.ts b/packages/xl-ai/src/api/schema/JSONSchema.ts
new file mode 100644
index 0000000000..f0061aedca
--- /dev/null
+++ b/packages/xl-ai/src/api/schema/JSONSchema.ts
@@ -0,0 +1,8 @@
+export type SimpleJSONObjectSchema = {
+ type: "object";
+ properties: {
+ [key: string]: any;
+ };
+ required?: string[];
+ additionalProperties?: boolean;
+};
diff --git a/packages/xl-ai/src/api/schema/__snapshots__/schemaToJSONSchema.test.ts.snap b/packages/xl-ai/src/api/schema/__snapshots__/schemaToJSONSchema.test.ts.snap
new file mode 100644
index 0000000000..818662b135
--- /dev/null
+++ b/packages/xl-ai/src/api/schema/__snapshots__/schemaToJSONSchema.test.ts.snap
@@ -0,0 +1,235 @@
+// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
+
+exports[`creates json schema 1`] = `
+{
+ "$defs": {
+ "block": {
+ "anyOf": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "content": {
+ "$ref": "#/$defs/inlinecontent",
+ },
+ "props": {
+ "additionalProperties": false,
+ "properties": {},
+ "type": "object",
+ },
+ "type": {
+ "enum": [
+ "paragraph",
+ "quote",
+ "bulletListItem",
+ "numberedListItem",
+ ],
+ "type": "string",
+ },
+ },
+ "required": [
+ "type",
+ ],
+ "type": "object",
+ },
+ {
+ "additionalProperties": false,
+ "properties": {
+ "content": {
+ "$ref": "#/$defs/inlinecontent",
+ },
+ "props": {
+ "additionalProperties": false,
+ "properties": {
+ "level": {
+ "enum": [
+ 1,
+ 2,
+ 3,
+ ],
+ "type": "number",
+ },
+ },
+ "type": "object",
+ },
+ "type": {
+ "enum": [
+ "heading",
+ ],
+ "type": "string",
+ },
+ },
+ "required": [
+ "type",
+ ],
+ "type": "object",
+ },
+ {
+ "additionalProperties": false,
+ "properties": {
+ "content": {
+ "$ref": "#/$defs/inlinecontent",
+ },
+ "props": {
+ "additionalProperties": false,
+ "properties": {
+ "language": {
+ "enum": undefined,
+ "type": "string",
+ },
+ },
+ "type": "object",
+ },
+ "type": {
+ "enum": [
+ "codeBlock",
+ ],
+ "type": "string",
+ },
+ },
+ "required": [
+ "type",
+ ],
+ "type": "object",
+ },
+ {
+ "additionalProperties": false,
+ "properties": {
+ "content": {
+ "$ref": "#/$defs/inlinecontent",
+ },
+ "props": {
+ "additionalProperties": false,
+ "properties": {
+ "checked": {
+ "enum": undefined,
+ "type": "boolean",
+ },
+ },
+ "type": "object",
+ },
+ "type": {
+ "enum": [
+ "checkListItem",
+ ],
+ "type": "string",
+ },
+ },
+ "required": [
+ "type",
+ ],
+ "type": "object",
+ },
+ {
+ "additionalProperties": false,
+ "properties": {
+ "content": {
+ "properties": {},
+ "type": "object",
+ },
+ "props": {
+ "additionalProperties": false,
+ "properties": {},
+ "type": "object",
+ },
+ "type": {
+ "enum": [
+ "table",
+ ],
+ "type": "string",
+ },
+ },
+ "required": [
+ "type",
+ ],
+ "type": "object",
+ },
+ ],
+ },
+ "inlinecontent": {
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/styledtext",
+ },
+ {
+ "additionalProperties": false,
+ "properties": {
+ "content": {
+ "items": {
+ "$ref": "#/$defs/styledtext",
+ },
+ "type": "array",
+ },
+ "href": {
+ "type": "string",
+ },
+ "type": {
+ "enum": [
+ "link",
+ ],
+ "type": "string",
+ },
+ },
+ "required": [
+ "type",
+ "href",
+ "content",
+ ],
+ "type": "object",
+ },
+ ],
+ },
+ "type": "array",
+ },
+ "styledtext": {
+ "additionalProperties": false,
+ "properties": {
+ "styles": {
+ "$ref": "#/$defs/styles",
+ },
+ "text": {
+ "type": "string",
+ },
+ "type": {
+ "enum": [
+ "text",
+ ],
+ "type": "string",
+ },
+ },
+ "required": [
+ "type",
+ "text",
+ ],
+ "type": "object",
+ },
+ "styles": {
+ "additionalProperties": false,
+ "properties": {
+ "backgroundColor": {
+ "type": "string",
+ },
+ "bold": {
+ "type": "boolean",
+ },
+ "code": {
+ "type": "boolean",
+ },
+ "italic": {
+ "type": "boolean",
+ },
+ "strike": {
+ "type": "boolean",
+ },
+ "textColor": {
+ "type": "string",
+ },
+ "underline": {
+ "type": "boolean",
+ },
+ },
+ "type": "object",
+ },
+ },
+}
+`;
diff --git a/packages/xl-ai/src/api/schema/mergeSchema.ts b/packages/xl-ai/src/api/schema/mergeSchema.ts
new file mode 100644
index 0000000000..d402eefcd2
--- /dev/null
+++ b/packages/xl-ai/src/api/schema/mergeSchema.ts
@@ -0,0 +1,121 @@
+import type { SimpleJSONObjectSchema } from "./JSONSchema.js";
+
+/**
+ * Merges schemas that only differ by the "type" field.
+ * @param schemas The array of schema objects to be processed.
+ * @returns A new array with merged schema objects where applicable.
+ */
+export function mergeSchemas(
+ schemas: SimpleJSONObjectSchema[],
+): SimpleJSONObjectSchema[] {
+ const groupedSchemas: { [signature: string]: string[] } = {};
+ const signatureToSchema: { [signature: string]: SimpleJSONObjectSchema } = {};
+
+ schemas.forEach((schemaObj) => {
+ // Extract the schema properties except for the "type" field
+ const { type, ...rest } = schemaObj.properties;
+ const schemaSignature = JSON.stringify(rest); // Generate a signature for comparison
+
+ // If the signature already exists, add the "type" to the enum
+ if (groupedSchemas[schemaSignature]) {
+ groupedSchemas[schemaSignature].push(type.enum[0]);
+ } else {
+ // Create a new group if it doesn't exist
+ groupedSchemas[schemaSignature] = [type.enum[0]];
+ signatureToSchema[schemaSignature] = schemaObj;
+ }
+ });
+
+ // Create the new merged schema array
+ const mergedSchemas: SimpleJSONObjectSchema[] = Object.keys(
+ groupedSchemas,
+ ).map((signature) => {
+ const baseSchema = signatureToSchema[signature];
+ return {
+ ...baseSchema,
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: "string",
+ enum: groupedSchemas[signature],
+ },
+ },
+ };
+ });
+
+ return mergedSchemas;
+}
+
+// // Example usage:
+// const exampleSchemas: Schema[] = [
+// {
+// type: "object",
+// properties: {
+// type: { type: "string", enum: ["paragraph"] },
+// content: { $ref: "#/$defs/inlinecontent" },
+// props: {
+// type: "object",
+// properties: {
+// backgroundColor: { type: "string" },
+// textColor: { type: "string" },
+// textAlignment: {
+// type: "string",
+// enum: ["left", "center", "right", "justify"],
+// },
+// },
+// additionalProperties: false,
+// },
+// },
+// additionalProperties: false,
+// required: ["type"],
+// },
+// {
+// type: "object",
+// properties: {
+// type: { type: "string", enum: ["bulletListItem"] },
+// content: { $ref: "#/$defs/inlinecontent" },
+// props: {
+// type: "object",
+// properties: {
+// backgroundColor: { type: "string" },
+// textColor: { type: "string" },
+// textAlignment: {
+// type: "string",
+// enum: ["left", "center", "right", "justify"],
+// },
+// },
+// additionalProperties: false,
+// },
+// },
+// additionalProperties: false,
+// required: ["type"],
+// },
+// {
+// type: "object",
+// properties: {
+// type: { type: "string", enum: ["heading"] },
+// content: { $ref: "#/$defs/inlinecontent" },
+// props: {
+// type: "object",
+// properties: {
+// backgroundColor: { type: "string" },
+// textColor: { type: "string" },
+// textAlignment: {
+// type: "string",
+// enum: ["left", "center", "right", "justify"],
+// },
+// level: {
+// type: "number",
+// enum: [1, 2, 3],
+// },
+// },
+// additionalProperties: false,
+// },
+// },
+// additionalProperties: false,
+// required: ["type"],
+// },
+// ];
+
+// const mergedSchemas = mergeSchemas(exampleSchemas);
+// console.log(JSON.stringify(mergedSchemas, null, 2));
diff --git a/packages/xl-ai/src/api/schema/schemaToJSONSchema.test.ts b/packages/xl-ai/src/api/schema/schemaToJSONSchema.test.ts
new file mode 100644
index 0000000000..f66c1090d4
--- /dev/null
+++ b/packages/xl-ai/src/api/schema/schemaToJSONSchema.test.ts
@@ -0,0 +1,12 @@
+import { BlockNoteEditor } from "@blocknote/core";
+import { expect, it } from "vitest";
+import { blockNoteSchemaToJSONSchema } from "./schemaToJSONSchema.js";
+
+it("creates json schema", async () => {
+ // eslint-disable-next-line no-console
+ const editor = BlockNoteEditor.create();
+
+ const jsonSchema = blockNoteSchemaToJSONSchema(editor.schema);
+ await expect(jsonSchema).toMatchSnapshot();
+ // console.log(JSON.stringify(blockNoteSchemaToJSONSchema(editor.schema), undefined, 2));
+});
diff --git a/packages/xl-ai/src/api/schema/schemaToJSONSchema.ts b/packages/xl-ai/src/api/schema/schemaToJSONSchema.ts
new file mode 100644
index 0000000000..615a71268c
--- /dev/null
+++ b/packages/xl-ai/src/api/schema/schemaToJSONSchema.ts
@@ -0,0 +1,306 @@
+import {
+ BlockNoteSchema,
+ BlockSchema,
+ InlineContentSchema,
+ PropSchema,
+ StyleSchema,
+ defaultProps,
+} from "@blocknote/core";
+import { SimpleJSONObjectSchema } from "./JSONSchema.js";
+import { mergeSchemas } from "./mergeSchema.js";
+/*
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "format": "uuid"
+ },
+ "type": {
+ "type": "string",
+ "enum": ["paragraph", "heading"]
+ },
+ "props": {
+ "type": "object",
+ "properties": {
+ "textColor": {
+ "type": "string",
+ "enum": ["default"]
+ },
+ "backgroundColor": {
+ "type": "string",
+ "enum": ["default"]
+ },
+ "textAlignment": {
+ "type": "string",
+ "enum": ["left"]
+ },
+ "level": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 6
+ }
+ },
+ "required": ["textColor", "backgroundColor", "textAlignment"],
+ "additionalProperties": false
+ },
+ "content": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": ["text"]
+ },
+ "text": {
+ "type": "string"
+ },
+ "styles": {
+ "type": "object",
+ "properties": {
+ "bold": {
+ "type": "boolean"
+ },
+ "italic": {
+ "type": "boolean"
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "required": ["type", "text"],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": ["id", "type", "props", "content"],
+ "additionalProperties": false
+ }
+ }*/
+
+function styleSchemaToJSONSchema(schema: StyleSchema): SimpleJSONObjectSchema {
+ return {
+ type: "object",
+ properties: Object.fromEntries(
+ Object.entries(schema).map(([key, val]) => {
+ return [
+ key,
+ {
+ type: val.propSchema,
+ },
+ ];
+ }),
+ ),
+ additionalProperties: false,
+ };
+}
+
+function styledTextToJSONSchema() {
+ return {
+ type: "object",
+ properties: {
+ type: {
+ type: "string",
+ enum: ["text"],
+ },
+ text: {
+ type: "string",
+ },
+ styles: {
+ $ref: "#/$defs/styles",
+ },
+ },
+ additionalProperties: false,
+ required: ["type", "text"],
+ };
+}
+
+export function propSchemaToJSONSchema(
+ propSchema: PropSchema,
+): SimpleJSONObjectSchema {
+ return {
+ type: "object",
+ properties: Object.fromEntries(
+ Object.entries(propSchema)
+ .filter(([_key, val]) => {
+ // for now skip optional props
+ return val.default !== undefined;
+ //&& key !== "language";
+ })
+ .map(([key, val]) => {
+ return [
+ key,
+ {
+ type: typeof val.default,
+ enum: val.values,
+ },
+ ];
+ }),
+ ),
+ additionalProperties: false,
+ };
+}
+
+function inlineContentSchemaToJSONSchema(schema: InlineContentSchema) {
+ return {
+ type: "array",
+ items: {
+ anyOf: Object.entries(schema).map(([_key, val]) => {
+ if (val === "text") {
+ return {
+ $ref: "#/$defs/styledtext",
+ };
+ }
+ if (val === "link") {
+ return {
+ type: "object",
+ properties: {
+ type: {
+ type: "string",
+ enum: ["link"],
+ },
+ content: {
+ type: "array",
+ items: {
+ $ref: "#/$defs/styledtext",
+ },
+ },
+ href: {
+ type: "string",
+ },
+ },
+ additionalProperties: false,
+ required: ["type", "href", "content"],
+ };
+ }
+ return {
+ type: "object",
+ properties: {
+ type: {
+ type: "string",
+ enum: [val.type],
+ },
+ content:
+ val.content === "styled"
+ ? {
+ type: "array",
+ items: {
+ $ref: "#/$defs/styledtext",
+ },
+ }
+ : undefined,
+ props: propSchemaToJSONSchema(val.propSchema),
+ },
+ additionalProperties: false,
+ required: ["type", ...(val.content === "styled" ? ["content"] : [])],
+ };
+ }),
+ },
+ };
+}
+
+function blockSchemaToJSONSchema(schema: BlockSchema) {
+ return {
+ anyOf: mergeSchemas(
+ Object.entries(schema).map(([_key, val]) => {
+ return {
+ type: "object",
+ properties: {
+ type: {
+ type: "string",
+ enum: [val.type],
+ },
+ content:
+ val.content === "inline"
+ ? { $ref: "#/$defs/inlinecontent" }
+ : val.content === "table"
+ ? { type: "object", properties: {} } // TODO
+ : undefined,
+ // filter out default props (TODO: make option)
+ props: propSchemaToJSONSchema(val.propSchema),
+ // Object.fromEntries(
+ // Object.entries(val.propSchema).filter(
+ // (key) => typeof (defaultProps as any)[key[0]] === "undefined"
+ // )
+ // )
+ // ),
+ },
+ additionalProperties: false,
+ required: ["type"], //, ...(val.content === "inline" ? ["content"] : [])],
+ };
+ }),
+ ),
+ };
+}
+
+type Writeable = { -readonly [P in keyof T]: T[P] };
+
+function schemaOps(
+ schema: Pick<
+ BlockNoteSchema,
+ "blockSchema" | "inlineContentSchema" | "styleSchema"
+ >,
+) {
+ const clone: Writeable = JSON.parse(
+ JSON.stringify({
+ blockSchema: schema.blockSchema,
+ inlineContentSchema: schema.inlineContentSchema,
+ styleSchema: schema.styleSchema,
+ }),
+ );
+ return {
+ removeFileBlocks() {
+ clone.blockSchema = Object.fromEntries(
+ Object.entries(clone.blockSchema).filter(
+ ([_key, val]) => !val.isFileBlock,
+ ),
+ );
+ return this;
+ },
+ removeDefaultProps() {
+ clone.blockSchema = Object.fromEntries(
+ Object.entries(clone.blockSchema).map(([key, val]) => {
+ return [
+ key,
+ {
+ ...val,
+ propSchema: Object.fromEntries(
+ Object.entries(val.propSchema).filter(
+ (key) => typeof (defaultProps as any)[key[0]] === "undefined",
+ ),
+ ) as any,
+ },
+ ];
+ }),
+ );
+ return this;
+ },
+
+ get() {
+ return clone;
+ },
+ };
+}
+
+export function blockNoteSchemaToJSONSchema(
+ schema: Pick<
+ BlockNoteSchema,
+ "blockSchema" | "inlineContentSchema" | "styleSchema"
+ >,
+) {
+ schema = schemaOps(schema).removeFileBlocks().removeDefaultProps().get();
+ return {
+ $defs: {
+ styles: styleSchemaToJSONSchema(schema.styleSchema),
+ styledtext: styledTextToJSONSchema(),
+ inlinecontent: inlineContentSchemaToJSONSchema(
+ schema.inlineContentSchema,
+ ),
+ block: blockSchemaToJSONSchema(schema.blockSchema),
+ },
+ };
+}
diff --git a/packages/xl-ai/src/blocknoteAIClient/client.ts b/packages/xl-ai/src/blocknoteAIClient/client.ts
new file mode 100644
index 0000000000..c64137972e
--- /dev/null
+++ b/packages/xl-ai/src/blocknoteAIClient/client.ts
@@ -0,0 +1,75 @@
+/**
+ * Fetch function to proxy requests to the @blocknote/xl-ai-server AI server.
+ */
+const fetchViaBlockNoteAIServer =
+ (baseURL: string, provider: string) =>
+ async (input: string | URL | Request, init?: RequestInit) => {
+ const request = new Request(input, init);
+
+ // console.log("fetchViaBlockNoteAIServer", baseURL, provider, request);
+ const newRequest = new Request(
+ `${baseURL}?provider=${encodeURIComponent(
+ provider,
+ )}&url=${encodeURIComponent(request.url)}`,
+ {
+ headers: request.headers,
+ // if we just pass request.body, it's a readablestream which is not visible in chrome inspector,
+ // so use init?.body instead if it's available to make debugging easier
+ body: init?.body || request.body,
+ method: request.method,
+ duplex: "half",
+ } as any,
+ );
+ try {
+ const resp = await fetch(newRequest);
+ return resp;
+ } catch (e) {
+ // Temp fix for https://github.com/vercel/ai/issues/6370
+ throw new TypeError("fetch failed", {
+ cause: e,
+ });
+ }
+ };
+
+/**
+ * Create a client to connect to the @blocknote/xl-ai-server AI server.
+ * The BlockNote AI server is a proxy for AI model providers. It allows you to connect to
+ * AI SDKs without exposing your model provider's API keys on the client.
+ *
+ * @param config - settings to connect to the @blocknote/xl-ai-server AI server
+ * @returns a client to connect to the @blocknote/xl-ai-server AI server.
+ * Use the `getProviderSettings` method to get the provider settings for the AI SDKs,
+ * this will configure the AI SDK model to connect via the @blocknote/xl-ai-server AI server.
+ */
+export function createBlockNoteAIClient(config: {
+ /**
+ * baseURL of the @blocknote/xl-ai-server AI server
+ */
+ baseURL: string;
+ /**
+ * API key for the @blocknote/xl-ai-server AI server
+ */
+ apiKey: string;
+}) {
+ return {
+ /**
+ * Get settings for AI SDK providers. Pass the returned objects when creating the AI SDK provider, e.g.:
+ *
+ * createOpenAI({
+ * ...client.getProviderSettings("openai"),
+ * })("gpt-4o-2024-08-06", {});
+ *
+ * Explanation: we override the `fetch` and `apiKey` parameters of the AI SDK provider to instead
+ * use the BlockNote AI server to proxy requests to the provider.
+ *
+ * Note: the `apiKey` is the API key for the @blocknote/xl-ai-server AI server, not the model provider.
+ * The correct API key for the model provider will be added by the BlockNote AI server.
+ */
+ getProviderSettings: (provider: "openai" | "groq" | string) => {
+ return {
+ apiKey: config.apiKey,
+ fetch: fetchViaBlockNoteAIServer(config.baseURL, provider),
+ };
+ },
+ };
+}
diff --git a/packages/xl-ai/src/components/AIMenu/AIMenu.tsx b/packages/xl-ai/src/components/AIMenu/AIMenu.tsx
new file mode 100644
index 0000000000..d092852273
--- /dev/null
+++ b/packages/xl-ai/src/components/AIMenu/AIMenu.tsx
@@ -0,0 +1,142 @@
+import { BlockNoteEditor } from "@blocknote/core";
+import { useBlockNoteEditor, useComponentsContext } from "@blocknote/react";
+import { useCallback, useEffect, useMemo, useState } from "react";
+import { RiSparkling2Fill } from "react-icons/ri";
+import { useStore } from "zustand";
+
+import { getAIExtension } from "../../AIExtension.js";
+import { useAIDictionary } from "../../i18n/useAIDictionary.js";
+import { PromptSuggestionMenu } from "./PromptSuggestionMenu.js";
+import {
+ AIMenuSuggestionItem,
+ getDefaultAIMenuItems,
+} from "./getDefaultAIMenuItems.js";
+
+export type AIMenuProps = {
+ items?: (
+ editor: BlockNoteEditor,
+ aiResponseStatus:
+ | "user-input"
+ | "thinking"
+ | "ai-writing"
+ | "error"
+ | "user-reviewing"
+ | "closed",
+ ) => AIMenuSuggestionItem[];
+ onManualPromptSubmit?: (userPrompt: string) => void;
+};
+
+export const AIMenu = (props: AIMenuProps) => {
+ const editor = useBlockNoteEditor();
+ const [prompt, setPrompt] = useState("");
+ const dict = useAIDictionary();
+
+ const Components = useComponentsContext()!;
+
+ const ai = getAIExtension(editor);
+
+ const aiResponseStatus = useStore(ai.store, (state) =>
+ state.aiMenuState !== "closed" ? state.aiMenuState.status : "closed",
+ );
+
+ const { items: externalItems } = props;
+ // note, technically there might be a bug with this useMemo when quickly changing the selection and opening the menu
+ // would not call getDefaultAIMenuItems with the correct selection, because the component is reused and the memo not retriggered
+ // practically this should not happen (you can test it by using a high transition duration in useUIElementPositioning)
+ const items = useMemo(() => {
+ let items: AIMenuSuggestionItem[] = [];
+ if (externalItems) {
+ items = externalItems(editor, aiResponseStatus);
+ } else {
+ items = getDefaultAIMenuItems(editor, aiResponseStatus);
+ }
+
+ // map from AI items to React Items required by PromptSuggestionMenu
+ return items.map((item) => {
+ return {
+ ...item,
+ onItemClick: () => {
+ item.onItemClick(setPrompt);
+ },
+ };
+ });
+ }, [externalItems, aiResponseStatus, editor]);
+
+ const onManualPromptSubmitDefault = useCallback(
+ async (userPrompt: string) => {
+ await ai.callLLM({
+ userPrompt,
+ useSelection: editor.getSelection() !== undefined,
+ });
+ },
+ [ai, editor],
+ );
+
+ useEffect(() => {
+ // TODO: this is a bit hacky to run a useeffect to reset the prompt when the AI response is done
+ if (aiResponseStatus === "user-reviewing" || aiResponseStatus === "error") {
+ setPrompt("");
+ }
+ }, [aiResponseStatus]);
+
+ const placeholder = useMemo(() => {
+ if (aiResponseStatus === "thinking") {
+ return dict.ai_menu.status.thinking;
+ } else if (aiResponseStatus === "ai-writing") {
+ return dict.ai_menu.status.editing;
+ } else if (aiResponseStatus === "error") {
+ return dict.ai_menu.status.error;
+ }
+
+ return dict.ai_menu.input_placeholder;
+ }, [aiResponseStatus, dict]);
+
+ const rightSection = useMemo(() => {
+ if (aiResponseStatus === "thinking" || aiResponseStatus === "ai-writing") {
+ return (
+
+ );
+ } else if (aiResponseStatus === "error") {
+ return (
+
+ {/* Taken from Google Material Icons */}
+ {/* https://fonts.google.com/icons?selected=Material+Symbols+Rounded:error:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=error&icon.size=24&icon.color=%23e8eaed&icon.set=Material+Symbols&icon.style=Rounded&icon.platform=web */}
+
+