ch15_stream_tools

show:
mock turns=2 · messages=2
live turns=2 · messages=2
scenario judged_on_every_chunk
scenario judged_on_every_chunk · 4.2ms · 1 model · ended: judged 5 times, 3 of them early, dispatched nothing
model mock · 4.1ms · asked for: price_of
context sent — 2 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanHow much is milk?
tools declared to the mock model {"names": ["price_of"], "consulted": false}
stream 3.9ms
chunk {"raw_arguments": "{\"ite", "parsed_as": [{}], "arguments_complete": false}
judged {"on": [{}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{\"item\": \"", "parsed_as": [{"item": ""}], "arguments_complete": false}
judged {"on": [{"item": ""}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{\"item\": \"milk\"", "parsed_as": [{"item": "milk"}], "arguments_complete": false}
judged {"on": [{"item": "milk"}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{\"item\": \"milk\"}", "parsed_as": [{"item": "milk"}], "arguments_complete": true}
judged {"on": [{"item": "milk"}], "knew_it_was_a_fragment": true}
chunk {"raw_arguments": "{\"item\": \"milk\"}", "parsed_as": [{"item": "milk"}], "arguments_complete": true}
judged {"on": [{"item": "milk"}], "knew_it_was_a_fragment": true}
context ignored by the mock model {"messages": 2, "roles": ["system", "human"]}
reply
rolecontent
[0]ai
price_of({"item": "milk"})
ended {"reason": "judged 5 times, 3 of them early, dispatched nothing"}
scenario judged_on_every_chunk · 1222.5ms · 1 model · ended: judged 13 times, 10 of them early, dispatched nothing
model live · 1222.3ms (model provider 352.6 · library 869.7) · asked for: price_of
context sent — 2 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanHow much is milk?
stream 1053.1ms
chunk {"raw_arguments": "", "parsed_as": [], "arguments_complete": false}
chunk {"raw_arguments": "", "parsed_as": [{}], "arguments_complete": false}
judged {"on": [{}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{", "parsed_as": [{}], "arguments_complete": false}
judged {"on": [{}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{\"", "parsed_as": [{}], "arguments_complete": false}
judged {"on": [{}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{\"item", "parsed_as": [{}], "arguments_complete": false}
judged {"on": [{}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{\"item\"", "parsed_as": [{}], "arguments_complete": false}
judged {"on": [{}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{\"item\": ", "parsed_as": [{}], "arguments_complete": false}
judged {"on": [{}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{\"item\": \"", "parsed_as": [{"item": ""}], "arguments_complete": false}
judged {"on": [{"item": ""}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{\"item\": \"m", "parsed_as": [{"item": "m"}], "arguments_complete": false}
judged {"on": [{"item": "m"}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{\"item\": \"milk", "parsed_as": [{"item": "milk"}], "arguments_complete": false}
judged {"on": [{"item": "milk"}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{\"item\": \"milk\"", "parsed_as": [{"item": "milk"}], "arguments_complete": false}
judged {"on": [{"item": "milk"}], "knew_it_was_a_fragment": false}
chunk {"raw_arguments": "{\"item\": \"milk\"}", "parsed_as": [{"item": "milk"}], "arguments_complete": true}
judged {"on": [{"item": "milk"}], "knew_it_was_a_fragment": true}
chunk {"raw_arguments": "{\"item\": \"milk\"}", "parsed_as": [{"item": "milk"}], "arguments_complete": true}
judged {"on": [{"item": "milk"}], "knew_it_was_a_fragment": true}
chunk {"raw_arguments": "{\"item\": \"milk\"}", "parsed_as": [{"item": "milk"}], "arguments_complete": true}
judged {"on": [{"item": "milk"}], "knew_it_was_a_fragment": true}
wire request
attempt
1
method
POST
url
https://api.deepseek.com/v1/chat/completions
defaulted (6)
temperature, max_tokens, top_p, stop, seed, tool_choice
headers (17)
show
acceptapplication/json
accept-encodinggzip, deflate, zstd
authorizationnot recorded
connectionkeep-alive
content-length446
content-typeapplication/json
hostapi.deepseek.com
user-agentOpenAI/Python 3.6.0
x-stainless-archarm64
x-stainless-asyncfalse
x-stainless-langpython
x-stainless-osMacOS
x-stainless-package-version3.6.0
x-stainless-read-timeout60.0
x-stainless-retry-count0
x-stainless-runtimeCPython
x-stainless-runtime-version3.14.7
{
  "messages": [
    {
      "content": "You answer briefly and plainly. Use the tools you are given.",
      "role": "system"
    },
    {
      "content": "How much is milk?",
      "role": "user"
    }
  ],
  "model": "deepseek-flash",
  "stream": true,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "price_of",
        "description": "The current shelf price of an item, in pounds.",
        "parameters": {
          "properties": {
            "item": {
              "enum": [
                "bread",
                "butter",
                "chips",
                "milk"
              ],
              "type": "string"
            }
          },
          "required": [
            "item"
          ],
          "type": "object"
        }
      }
    }
  ]
}
wire response
status
200
headers (15)
show
access-control-allow-credentialstrue
cache-controlno-cache
connectionkeep-alive
content-typetext/event-stream; charset=utf-8
dateSun, 13 Sep 2026 21:52:47 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 8df77e01b229d5d8502d6471c086aeb2.cloudfront.net (CloudFront)
x-amz-cf-idx_mK4-BRhDabUB9Mvsx2HOhfuyLUFOtAlf9yK_fNHccwUZRiYX8CSA==
x-amz-cf-popDEN53-P4
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-id61a06ee33f53c15160a515fca44cb732
"(streamed -- see this span's `wire frame` notes for the raw bytes)"
wire frame (7 frames)
show
data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"role":"assistant","content":null,"reasoning_content":""},"logprobs":null,"finish_reason":null}]}

data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_00_ET_6Xi3fMVhFeoMgRMfgxA52865","type":"function","function":{"name":"price_of","arguments":""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"item"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":": "}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"m"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ilk"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"2fd879cf-bb14-47a4-a00b-53d5f28eb8d3","object":"chat.completion.chunk","created":1789336367,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"content":"","reasoning_content":null},"logprobs":null,"finish_reason":"tool_calls"}],"usage":{"prompt_tokens":328,"completion_tokens":39,"total_tokens":367,"prompt_tokens_details":{"cached_tokens":128},"completion_tokens_details":{"reasoning_tokens":0},"prompt_cache_hit_tokens":128,"prompt_cache_miss_tokens":200}}

data: [DONE]

reply
rolecontent
[0]ai
price_of({"item": "milk"})
ended {"reason": "judged 13 times, 10 of them early, dispatched nothing"}
scenario judged_when_complete
scenario judged_when_complete · 0.7ms · 2 models · ended: dispatched once: 1.20 for milk
model mock · 0.5ms · asked for: price_of
context sent — 2 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanHow much is milk?
tools declared to the mock model {"names": ["price_of"], "consulted": false}
stream 0.4ms
chunk {"raw_arguments": "{\"ite", "parsed_as": [{}], "arguments_complete": false}
chunk {"raw_arguments": "{\"item\": \"", "parsed_as": [{"item": ""}], "arguments_complete": false}
chunk {"raw_arguments": "{\"item\": \"milk\"", "parsed_as": [{"item": "milk"}], "arguments_complete": false}
chunk {"raw_arguments": "{\"item\": \"milk\"}", "parsed_as": [{"item": "milk"}], "arguments_complete": true}
chunk {"raw_arguments": "{\"item\": \"milk\"}", "parsed_as": [{"item": "milk"}], "arguments_complete": true}
context ignored by the mock model {"messages": 2, "roles": ["system", "human"]}
reply
rolecontent
[0]ai
price_of({"item": "milk"})
tool price_of · 0.2ms · given: item=milk · returned: 1.20 for milk
args {"item": "milk"}
result {"value": "1.20 for milk"}
ended {"reason": "dispatched once: 1.20 for milk"}
scenario judged_when_complete · 1123.2ms · 2 models · ended: dispatched once: 1.20 for milk
model live · 1122.3ms (model provider 345.8 · library 776.5) · asked for: price_of
context sent — 2 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanHow much is milk?
stream 1114.6ms
chunk {"raw_arguments": "", "parsed_as": [], "arguments_complete": false}
chunk {"raw_arguments": "", "parsed_as": [{}], "arguments_complete": false}
chunk {"raw_arguments": "{", "parsed_as": [{}], "arguments_complete": false}
chunk {"raw_arguments": "{\"", "parsed_as": [{}], "arguments_complete": false}
chunk {"raw_arguments": "{\"item", "parsed_as": [{}], "arguments_complete": false}
chunk {"raw_arguments": "{\"item\"", "parsed_as": [{}], "arguments_complete": false}
chunk {"raw_arguments": "{\"item\": ", "parsed_as": [{}], "arguments_complete": false}
chunk {"raw_arguments": "{\"item\": \"", "parsed_as": [{"item": ""}], "arguments_complete": false}
chunk {"raw_arguments": "{\"item\": \"m", "parsed_as": [{"item": "m"}], "arguments_complete": false}
chunk {"raw_arguments": "{\"item\": \"milk", "parsed_as": [{"item": "milk"}], "arguments_complete": false}
chunk {"raw_arguments": "{\"item\": \"milk\"", "parsed_as": [{"item": "milk"}], "arguments_complete": false}
chunk {"raw_arguments": "{\"item\": \"milk\"}", "parsed_as": [{"item": "milk"}], "arguments_complete": true}
chunk {"raw_arguments": "{\"item\": \"milk\"}", "parsed_as": [{"item": "milk"}], "arguments_complete": true}
chunk {"raw_arguments": "{\"item\": \"milk\"}", "parsed_as": [{"item": "milk"}], "arguments_complete": true}
wire request
attempt
1
method
POST
url
https://api.deepseek.com/v1/chat/completions
defaulted (6)
temperature, max_tokens, top_p, stop, seed, tool_choice
headers (17)
show
acceptapplication/json
accept-encodinggzip, deflate, zstd
authorizationnot recorded
connectionkeep-alive
content-length446
content-typeapplication/json
hostapi.deepseek.com
user-agentOpenAI/Python 3.6.0
x-stainless-archarm64
x-stainless-asyncfalse
x-stainless-langpython
x-stainless-osMacOS
x-stainless-package-version3.6.0
x-stainless-read-timeout60.0
x-stainless-retry-count0
x-stainless-runtimeCPython
x-stainless-runtime-version3.14.7
{
  "messages": [
    {
      "content": "You answer briefly and plainly. Use the tools you are given.",
      "role": "system"
    },
    {
      "content": "How much is milk?",
      "role": "user"
    }
  ],
  "model": "deepseek-flash",
  "stream": true,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "price_of",
        "description": "The current shelf price of an item, in pounds.",
        "parameters": {
          "properties": {
            "item": {
              "enum": [
                "bread",
                "butter",
                "chips",
                "milk"
              ],
              "type": "string"
            }
          },
          "required": [
            "item"
          ],
          "type": "object"
        }
      }
    }
  ]
}
wire response
status
200
headers (15)
show
access-control-allow-credentialstrue
cache-controlno-cache
connectionkeep-alive
content-typetext/event-stream; charset=utf-8
dateSun, 13 Sep 2026 21:52:48 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 be626befb5228a851019aa4b9b0a73fe.cloudfront.net (CloudFront)
x-amz-cf-idAs9nRNUuPlE2rdLpw1jetMEZVhblCWa3NW5RLedZQDNEmc-0T7IlLQ==
x-amz-cf-popDEN53-P6
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-id71642ce7509dbbd32be3b4736f270826
"(streamed -- see this span's `wire frame` notes for the raw bytes)"
wire frame (7 frames)
show
data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"role":"assistant","content":null,"reasoning_content":""},"logprobs":null,"finish_reason":null}]}

data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_00_ET_ckAn9eUGtJA1juyzhixV0117","type":"function","function":{"name":"price_of","arguments":""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"item"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":": "}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"m"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ilk"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"c896b68a-32e0-497c-abf7-8d26607caacd","object":"chat.completion.chunk","created":1789336368,"model":"deepseek-flash","system_fingerprint":"aeb56401ca74e127821c4f9126dcb669","choices":[{"index":0,"delta":{"content":"","reasoning_content":null},"logprobs":null,"finish_reason":"tool_calls"}],"usage":{"prompt_tokens":328,"completion_tokens":39,"total_tokens":367,"prompt_tokens_details":{"cached_tokens":128},"completion_tokens_details":{"reasoning_tokens":0},"prompt_cache_hit_tokens":128,"prompt_cache_miss_tokens":200}}

data: [DONE]

reply
rolecontent
[0]ai
price_of({"item": "milk"})
tool price_of · 0.9ms · given: item=milk · returned: 1.20 for milk
args {"item": "milk"}
result {"value": "1.20 for milk"}
ended {"reason": "dispatched once: 1.20 for milk"}