tardie 0.47.2 → 0.47.3-rc.498

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tardie",
3
- "version": "0.47.2",
3
+ "version": "0.47.3-rc.498",
4
4
  "license": "MIT",
5
5
  "author": "Clavia, Inc.",
6
6
  "description": "Actor, agent, client, and host APIs for Tardigrade.",
@@ -16,7 +16,7 @@
16
16
  "access": "public"
17
17
  },
18
18
  "tardigrade": {
19
- "sourceTree": "464249e5baa63a2b89b31edfb59bf6917bd82fc7"
19
+ "sourceTree": "ce93b9c2c7353969f1b099e640bfb250e17167e6"
20
20
  },
21
21
  "files": [
22
22
  "src",
@@ -50,11 +50,17 @@ export const observeResponse = (identity: InferenceIdentity, model: ModelRef, ke
50
50
  const physicalAttempt = yield* IdGenerator.defaultIdGenerator.generateId()
51
51
  let sequence = 0
52
52
  let blockIndex = -1
53
+ let openBlock: string | undefined
53
54
  return {
54
55
  onPart: (part: Response.AnyPart) => {
55
- if (part.type === "text-start" || part.type === "reasoning-start") blockIndex += 1
56
56
  if (part.type !== "text-delta" && part.type !== "reasoning-delta") return Effect.void
57
- const delta: InferDelta = { ...identity, logicalAttempt: key ?? identity.turn, physicalAttempt, model, blockIndex: Math.max(0, blockIndex), sequence: sequence++, text: part.delta, ...(part.type === "reasoning-delta" ? { kind: "reasoning" as const } : {}) }
57
+ if (part.delta === "") return Effect.void
58
+ const block = `${part.type}:${part.id}`
59
+ if (block !== openBlock) {
60
+ blockIndex += 1
61
+ openBlock = block
62
+ }
63
+ const delta: InferDelta = { ...identity, logicalAttempt: key ?? identity.turn, physicalAttempt, model, blockIndex, sequence: sequence++, text: part.delta, ...(part.type === "reasoning-delta" ? { kind: "reasoning" as const } : {}) }
58
64
  onDelta?.(delta)
59
65
  return delivery?.offer(delta).pipe(Effect.asVoid) ?? Effect.void
60
66
  },