Skip to content

Instantly share code, notes, and snippets.

@mattpocock
Created January 8, 2025 11:44
Show Gist options
  • Save mattpocock/0095de3f5ff1ceed130db9e950ca35cd to your computer and use it in GitHub Desktop.
Save mattpocock/0095de3f5ff1ceed130db9e950ca35cd to your computer and use it in GitHub Desktop.
const log = [
{
stepType: 'initial',
text: "I'll help you check the current weather in London right away.",
toolCalls: [
{
type: 'tool-call',
toolCallId: 'toolu_016Db1kHqNMhunx27Y6UZLn6',
toolName: 'getWeather',
args: { city: 'London' }
}
],
toolResults: [
{
type: 'tool-result',
toolCallId: 'toolu_016Db1kHqNMhunx27Y6UZLn6',
toolName: 'getWeather',
args: { city: 'London' },
result: 'The weather in London is 25°C and sunny.'
}
],
finishReason: 'tool-calls',
usage: { promptTokens: 373, completionTokens: 67, totalTokens: 440 },
warnings: [],
logprobs: undefined,
request: {
body: `{"model":"claude-3-5-haiku-latest","max_tokens":4096,"temperature":0,"messages":[{"role":"user","content":[{"type":"text","text":"What's the weather in London?"}]}],"tools":[{"name":"getWeather","description":"Get the current weather in the specified city","input_schema":{"type":"object","properties":{"city":{"type":"string","description":"The city to get the weather for"}},"required":["city"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}],"tool_choice":{"type":"auto"},"stream":true}`
},
response: {
id: 'msg_019zdxSycLQBuxCtX5YoChrx',
timestamp: 2025-01-08T11:43:47.666Z,
modelId: 'claude-3-5-haiku-20241022',
headers: {
'anthropic-ratelimit-input-tokens-limit': '50000',
'anthropic-ratelimit-input-tokens-remaining': '50000',
'anthropic-ratelimit-input-tokens-reset': '2025-01-08T11:43:47Z',
'anthropic-ratelimit-output-tokens-limit': '10000',
'anthropic-ratelimit-output-tokens-remaining': '6000',
'anthropic-ratelimit-output-tokens-reset': '2025-01-08T11:44:11Z',
'anthropic-ratelimit-requests-limit': '50',
'anthropic-ratelimit-requests-remaining': '49',
'anthropic-ratelimit-requests-reset': '2025-01-08T11:43:48Z',
'anthropic-ratelimit-tokens-limit': '60000',
'anthropic-ratelimit-tokens-remaining': '56000',
'anthropic-ratelimit-tokens-reset': '2025-01-08T11:43:47Z',
'cache-control': 'no-cache',
'cf-cache-status': 'DYNAMIC',
'cf-ray': '8febee8e5f4860e7-LHR',
connection: 'keep-alive',
'content-type': 'text/event-stream; charset=utf-8',
date: 'Wed, 08 Jan 2025 11:43:47 GMT',
'request-id': 'req_014ixQ8qm4owywthT3fHGgTS',
server: 'cloudflare',
'transfer-encoding': 'chunked',
via: '1.1 google',
'x-robots-tag': 'none'
},
messages: [
{
role: 'assistant',
content: [
{
type: 'text',
text: "I'll help you check the current weather in London right away."
},
{
type: 'tool-call',
toolCallId: 'toolu_016Db1kHqNMhunx27Y6UZLn6',
toolName: 'getWeather',
args: { city: 'London' }
}
]
},
{
role: 'tool',
content: [
{
type: 'tool-result',
toolCallId: 'toolu_016Db1kHqNMhunx27Y6UZLn6',
toolName: 'getWeather',
result: 'The weather in London is 25°C and sunny.'
}
]
}
]
},
experimental_providerMetadata: undefined,
isContinued: false
},
{
stepType: 'tool-result',
text: '\n' +
'\n' +
'It looks like London is experiencing a pleasant day with sunny conditions and a temperature of 25°C (which is about 77°F). It sounds like a great day to be outside and enjoy the nice weather!',
toolCalls: [],
toolResults: [],
finishReason: 'stop',
usage: { promptTokens: 463, completionTokens: 48, totalTokens: 511 },
warnings: [],
logprobs: undefined,
request: {
body: `{"model":"claude-3-5-haiku-latest","max_tokens":4096,"temperature":0,"messages":[{"role":"user","content":[{"type":"text","text":"What's the weather in London?"}]},{"role":"assistant","content":[{"type":"text","text":"I'll help you check the current weather in London right away."},{"type":"tool_use","id":"toolu_016Db1kHqNMhunx27Y6UZLn6","name":"getWeather","input":{"city":"London"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_016Db1kHqNMhunx27Y6UZLn6","content":"\\"The weather in London is 25°C and sunny.\\""}]}],"tools":[{"name":"getWeather","description":"Get the current weather in the specified city","input_schema":{"type":"object","properties":{"city":{"type":"string","description":"The city to get the weather for"}},"required":["city"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}],"tool_choice":{"type":"auto"},"stream":true}`
},
response: {
id: 'msg_01C7wLRBFkQA1R9N6MhQJQHP',
timestamp: 2025-01-08T11:43:49.180Z,
modelId: 'claude-3-5-haiku-20241022',
headers: {
'anthropic-ratelimit-input-tokens-limit': '50000',
'anthropic-ratelimit-input-tokens-remaining': '50000',
'anthropic-ratelimit-input-tokens-reset': '2025-01-08T11:43:49Z',
'anthropic-ratelimit-output-tokens-limit': '10000',
'anthropic-ratelimit-output-tokens-remaining': '6000',
'anthropic-ratelimit-output-tokens-reset': '2025-01-08T11:44:13Z',
'anthropic-ratelimit-requests-limit': '50',
'anthropic-ratelimit-requests-remaining': '49',
'anthropic-ratelimit-requests-reset': '2025-01-08T11:43:49Z',
'anthropic-ratelimit-tokens-limit': '60000',
'anthropic-ratelimit-tokens-remaining': '56000',
'anthropic-ratelimit-tokens-reset': '2025-01-08T11:43:49Z',
'cache-control': 'no-cache',
'cf-cache-status': 'DYNAMIC',
'cf-ray': '8febee98594260e7-LHR',
connection: 'keep-alive',
'content-type': 'text/event-stream; charset=utf-8',
date: 'Wed, 08 Jan 2025 11:43:49 GMT',
'request-id': 'req_01BRmq7hsAZWC3CSxt8zqvtL',
server: 'cloudflare',
'transfer-encoding': 'chunked',
via: '1.1 google',
'x-robots-tag': 'none'
},
messages: [
{
role: 'assistant',
content: [
{
type: 'text',
text: "I'll help you check the current weather in London right away."
},
{
type: 'tool-call',
toolCallId: 'toolu_016Db1kHqNMhunx27Y6UZLn6',
toolName: 'getWeather',
args: { city: 'London' }
}
]
},
{
role: 'tool',
content: [
{
type: 'tool-result',
toolCallId: 'toolu_016Db1kHqNMhunx27Y6UZLn6',
toolName: 'getWeather',
result: 'The weather in London is 25°C and sunny.'
}
]
},
{
role: 'assistant',
content: [
{
type: 'text',
text: '\n' +
'\n' +
'It looks like London is experiencing a pleasant day with sunny conditions and a temperature of 25°C (which is about 77°F). It sounds like a great day to be outside and enjoy the nice weather!'
}
]
}
]
},
experimental_providerMetadata: undefined,
isContinued: false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment