From e7f7a0f45ba6efcdaddd0777a06d1b8d5c6551b4 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Tue, 1 Apr 2025 22:54:14 +1000 Subject: [PATCH 01/26] feat: add limit to tools calls --- docs/guides/tools.md | 32 ++ lib/ruby_llm.rb | 4 +- lib/ruby_llm/chat.rb | 16 +- lib/ruby_llm/configuration.rb | 4 +- lib/ruby_llm/error.rb | 1 + ..._can_use_tools_with_a_tool_calls_limit.yml | 485 ++++++++++++++++++ spec/ruby_llm/chat_tools_spec.rb | 17 + 7 files changed, 554 insertions(+), 5 deletions(-) create mode 100644 spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_calls_limit.yml diff --git a/docs/guides/tools.md b/docs/guides/tools.md index 7573d7e9..df32e91d 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -243,6 +243,38 @@ class DataAnalysis < RubyLLM::Tool end ``` +## Maximum Tools Call Limiting + +When calling tools it is important to consider if you're response could trigger a loop. RubyLLM provides built-in protection against infinite tool call loops: + +```ruby +# Set a maximum number of tool calls per conversation +chat = RubyLLM.chat(max_tool_calls: 5) + +# The chat will stop after 5 tool calls and return an error +response = chat.ask "What's the weather in every major city?" +# => "I apologize, but I've reached the maximum number of tool calls (5) for this conversation. +# Please try breaking down your request into smaller, more focused questions." +``` + +### Global Configuration + +You can set a default maximum tool calls limit for all chats through the global configuration: + +```ruby +RubyLLM.configure do |config| + # Default is 25 calls per conversation + config.max_tool_calls = 10 # Set a more conservative limit +end +``` + +This setting can still be overridden per-chat when needed: + +```ruby +# Override the global setting for this specific chat +chat = RubyLLM.chat(max_tool_calls: 15) +``` + ## Security Considerations When implementing tools that process user input (via the AI): diff --git a/lib/ruby_llm.rb b/lib/ruby_llm.rb index a58fddce..6bb196e0 100644 --- a/lib/ruby_llm.rb +++ b/lib/ruby_llm.rb @@ -29,8 +29,8 @@ module RubyLLM class Error < StandardError; end class << self - def chat(model: nil, provider: nil) - Chat.new(model: model, provider: provider) + def chat(model: nil, provider: nil, max_tool_calls: config.max_tool_calls) + Chat.new(model: model, provider: provider, max_tool_calls: max_tool_calls) end def embed(...) diff --git a/lib/ruby_llm/chat.rb b/lib/ruby_llm/chat.rb index 9c6d2941..15d392c8 100644 --- a/lib/ruby_llm/chat.rb +++ b/lib/ruby_llm/chat.rb @@ -11,9 +11,9 @@ module RubyLLM class Chat include Enumerable - attr_reader :model, :messages, :tools + attr_reader :model, :messages, :tools, :number_of_tool_calls - def initialize(model: nil, provider: nil) + def initialize(model: nil, provider: nil, max_tool_calls: nil) # rubocop:disable Metrics/MethodLength model_id = model || RubyLLM.config.default_model with_model(model_id, provider: provider) @temperature = 0.7 @@ -23,6 +23,8 @@ def initialize(model: nil, provider: nil) new_message: nil, end_message: nil } + @max_tool_calls = max_tool_calls + @number_of_tool_calls = 0 end def ask(message = nil, with: {}, &block) @@ -105,6 +107,10 @@ def handle_tool_calls(response, &) end def execute_tool(tool_call) + raise ToolCallsLimitReachedError, "Tool calls limit reached: #{@max_tool_calls}" if max_tool_calls_reached? + + @number_of_tool_calls += 1 + tool = tools[tool_call.name.to_sym] args = tool_call.arguments tool.call(args) @@ -117,5 +123,11 @@ def add_tool_result(tool_use_id, result) tool_call_id: tool_use_id ) end + + def max_tool_calls_reached? + return false unless @max_tool_calls + + @number_of_tool_calls >= @max_tool_calls + end end end diff --git a/lib/ruby_llm/configuration.rb b/lib/ruby_llm/configuration.rb index 72a878aa..e060fa1f 100644 --- a/lib/ruby_llm/configuration.rb +++ b/lib/ruby_llm/configuration.rb @@ -18,7 +18,8 @@ class Configuration :default_embedding_model, :default_image_model, :request_timeout, - :max_retries + :max_retries, + :max_tool_calls def initialize @request_timeout = 120 @@ -26,6 +27,7 @@ def initialize @default_model = 'gpt-4o-mini' @default_embedding_model = 'text-embedding-3-small' @default_image_model = 'dall-e-3' + @max_tool_calls = 25 end end end diff --git a/lib/ruby_llm/error.rb b/lib/ruby_llm/error.rb index a0c752bf..5e1748ed 100644 --- a/lib/ruby_llm/error.rb +++ b/lib/ruby_llm/error.rb @@ -24,6 +24,7 @@ class ConfigurationError < StandardError; end class InvalidRoleError < StandardError; end class ModelNotFoundError < StandardError; end class UnsupportedFunctionsError < StandardError; end + class ToolCallsLimitReachedError < StandardError; end # Error classes for different HTTP status codes class BadRequestError < Error; end diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_calls_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_calls_limit.yml new file mode 100644 index 00000000..22344068 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_calls_limit.yml @@ -0,0 +1,485 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s + the best language to learn?"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets + the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Apr 2025 12:32:58 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '475' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '10000' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '9999' + X-Ratelimit-Remaining-Tokens: + - '199988' + X-Ratelimit-Reset-Requests: + - 8.64s + X-Ratelimit-Reset-Tokens: + - 3ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BHV5WbU9AwRXCrmIaHDkKcUdE80DJ", + "object": "chat.completion", + "created": 1743510778, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_KLpxrrQICryUX3F8DnQdtv9s", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 45, + "completion_tokens": 12, + "total_tokens": 57, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_b376dfbbd5" + } + recorded_at: Tue, 01 Apr 2025 12:32:58 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s + the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_KLpxrrQICryUX3F8DnQdtv9s","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must ask call the tool again and I will give you the answer.","tool_call_id":"call_KLpxrrQICryUX3F8DnQdtv9s"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets + the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Apr 2025 12:32:59 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '609' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '10000' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '9998' + X-Ratelimit-Remaining-Tokens: + - '199971' + X-Ratelimit-Reset-Requests: + - 16.101s + X-Ratelimit-Reset-Tokens: + - 8ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BHV5XcYQtUurPb4VY616FxupNmvdq", + "object": "chat.completion", + "created": 1743510779, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_143eIARSXoOlnFvZ4OWsVs0R", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 80, + "completion_tokens": 12, + "total_tokens": 92, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_b376dfbbd5" + } + recorded_at: Tue, 01 Apr 2025 12:32:59 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s + the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_KLpxrrQICryUX3F8DnQdtv9s","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must ask call the tool again and I will give you the answer.","tool_call_id":"call_KLpxrrQICryUX3F8DnQdtv9s"},{"role":"assistant","tool_calls":[{"id":"call_143eIARSXoOlnFvZ4OWsVs0R","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must ask call the tool again and I will give you the answer.","tool_call_id":"call_143eIARSXoOlnFvZ4OWsVs0R"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets + the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Apr 2025 12:33:00 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '410' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '10000' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '9997' + X-Ratelimit-Remaining-Tokens: + - '199952' + X-Ratelimit-Reset-Requests: + - 23.849s + X-Ratelimit-Reset-Tokens: + - 14ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BHV5YnMl8DGiVUU9jDSkjzUfYvV4e", + "object": "chat.completion", + "created": 1743510780, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_B3GVDgNpWeHI2IVHSiLCJZhc", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 115, + "completion_tokens": 12, + "total_tokens": 127, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_b376dfbbd5" + } + recorded_at: Tue, 01 Apr 2025 12:33:00 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s + the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_KLpxrrQICryUX3F8DnQdtv9s","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must ask call the tool again and I will give you the answer.","tool_call_id":"call_KLpxrrQICryUX3F8DnQdtv9s"},{"role":"assistant","tool_calls":[{"id":"call_143eIARSXoOlnFvZ4OWsVs0R","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must ask call the tool again and I will give you the answer.","tool_call_id":"call_143eIARSXoOlnFvZ4OWsVs0R"},{"role":"assistant","tool_calls":[{"id":"call_B3GVDgNpWeHI2IVHSiLCJZhc","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must ask call the tool again and I will give you the answer.","tool_call_id":"call_B3GVDgNpWeHI2IVHSiLCJZhc"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets + the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Apr 2025 12:33:01 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '401' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '10000' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '9996' + X-Ratelimit-Remaining-Tokens: + - '199935' + X-Ratelimit-Reset-Requests: + - 31.811s + X-Ratelimit-Reset-Tokens: + - 19ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BHV5YdONCev7O3yWoRebUvzW5eWLL", + "object": "chat.completion", + "created": 1743510780, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_ZWjGRUjpzyLHqfPs5iUWpgQp", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 150, + "completion_tokens": 12, + "total_tokens": 162, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_b376dfbbd5" + } + recorded_at: Tue, 01 Apr 2025 12:33:01 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index daa0821a..ac9ef1cc 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -24,6 +24,14 @@ def execute end end + class LoopingAnswer < RubyLLM::Tool # rubocop:disable Lint/ConstantDefinitionInBlock,RSpec/LeakyConstantDeclaration + description 'Gets the best language to learn' + + def execute + 'You must ask call the tool again and I will give you the answer.' + end + end + describe 'function calling' do [ 'claude-3-5-haiku-20241022', @@ -81,6 +89,15 @@ def execute expect(response.content).to include('15') expect(response.content).to include('10') end + + it "#{model} can use tools with a tool calls limit" do + chat = RubyLLM.chat(model: model, max_tool_calls: 3) + .with_tool(LoopingAnswer) + + expect do + chat.ask("What's the best language to learn?") + end.to raise_error(RubyLLM::ToolCallsLimitReachedError) + end end end end From 47c874242d716ab45a337dad77a9dad162f2e843 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Tue, 1 Apr 2025 23:18:49 +1000 Subject: [PATCH 02/26] docs: add docs for removing limit --- docs/guides/tools.md | 8 ++++++++ ...4o-mini_can_use_tools_with_a_tool_calls_limit.yml | 12 ++++++------ spec/ruby_llm/chat_tools_spec.rb | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/guides/tools.md b/docs/guides/tools.md index df32e91d..63854e7f 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -268,6 +268,14 @@ RubyLLM.configure do |config| end ``` +If you wish to remove this safe-guard you can set the max_tool_calls to `nil`. +```ruby +RubyLLM.configure do |config| + # Unlimited tools calls allowed + config.max_tool_calls = nil +end +``` + This setting can still be overridden per-chat when needed: ```ruby diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_calls_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_calls_limit.yml index 22344068..ab342166 100644 --- a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_calls_limit.yml +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_calls_limit.yml @@ -126,7 +126,7 @@ http_interactions: encoding: UTF-8 string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_KLpxrrQICryUX3F8DnQdtv9s","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must ask call the tool again and I will give you the answer.","tool_call_id":"call_KLpxrrQICryUX3F8DnQdtv9s"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets + must call the tool again and I will give you the answer.","tool_call_id":"call_KLpxrrQICryUX3F8DnQdtv9s"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}}],"tool_choice":"auto"}' headers: User-Agent: @@ -246,8 +246,8 @@ http_interactions: encoding: UTF-8 string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_KLpxrrQICryUX3F8DnQdtv9s","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must ask call the tool again and I will give you the answer.","tool_call_id":"call_KLpxrrQICryUX3F8DnQdtv9s"},{"role":"assistant","tool_calls":[{"id":"call_143eIARSXoOlnFvZ4OWsVs0R","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must ask call the tool again and I will give you the answer.","tool_call_id":"call_143eIARSXoOlnFvZ4OWsVs0R"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets + must call the tool again and I will give you the answer.","tool_call_id":"call_KLpxrrQICryUX3F8DnQdtv9s"},{"role":"assistant","tool_calls":[{"id":"call_143eIARSXoOlnFvZ4OWsVs0R","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must call the tool again and I will give you the answer.","tool_call_id":"call_143eIARSXoOlnFvZ4OWsVs0R"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}}],"tool_choice":"auto"}' headers: User-Agent: @@ -367,9 +367,9 @@ http_interactions: encoding: UTF-8 string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_KLpxrrQICryUX3F8DnQdtv9s","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must ask call the tool again and I will give you the answer.","tool_call_id":"call_KLpxrrQICryUX3F8DnQdtv9s"},{"role":"assistant","tool_calls":[{"id":"call_143eIARSXoOlnFvZ4OWsVs0R","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must ask call the tool again and I will give you the answer.","tool_call_id":"call_143eIARSXoOlnFvZ4OWsVs0R"},{"role":"assistant","tool_calls":[{"id":"call_B3GVDgNpWeHI2IVHSiLCJZhc","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must ask call the tool again and I will give you the answer.","tool_call_id":"call_B3GVDgNpWeHI2IVHSiLCJZhc"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets + must call the tool again and I will give you the answer.","tool_call_id":"call_KLpxrrQICryUX3F8DnQdtv9s"},{"role":"assistant","tool_calls":[{"id":"call_143eIARSXoOlnFvZ4OWsVs0R","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must call the tool again and I will give you the answer.","tool_call_id":"call_143eIARSXoOlnFvZ4OWsVs0R"},{"role":"assistant","tool_calls":[{"id":"call_B3GVDgNpWeHI2IVHSiLCJZhc","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must call the tool again and I will give you the answer.","tool_call_id":"call_B3GVDgNpWeHI2IVHSiLCJZhc"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}}],"tool_choice":"auto"}' headers: User-Agent: diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index ac9ef1cc..64a38947 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -28,7 +28,7 @@ class LoopingAnswer < RubyLLM::Tool # rubocop:disable Lint/ConstantDefinitionInB description 'Gets the best language to learn' def execute - 'You must ask call the tool again and I will give you the answer.' + 'You must call the tool again and I will give you the answer.' end end From 190e9de60428c979c21b828475b7fa9be85a81ae Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Tue, 1 Apr 2025 23:21:56 +1000 Subject: [PATCH 03/26] docs: Fix docs --- docs/guides/tools.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/guides/tools.md b/docs/guides/tools.md index 63854e7f..e56002f2 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -250,11 +250,6 @@ When calling tools it is important to consider if you're response could trigger ```ruby # Set a maximum number of tool calls per conversation chat = RubyLLM.chat(max_tool_calls: 5) - -# The chat will stop after 5 tool calls and return an error -response = chat.ask "What's the weather in every major city?" -# => "I apologize, but I've reached the maximum number of tool calls (5) for this conversation. -# Please try breaking down your request into smaller, more focused questions." ``` ### Global Configuration From fe837de2228e62f49a9c1980401aa2788608edbd Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Tue, 1 Apr 2025 23:30:13 +1000 Subject: [PATCH 04/26] docs: improve doc - more accurate & organisation --- docs/guides/tools.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/guides/tools.md b/docs/guides/tools.md index e56002f2..fbaa777b 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -250,6 +250,15 @@ When calling tools it is important to consider if you're response could trigger ```ruby # Set a maximum number of tool calls per conversation chat = RubyLLM.chat(max_tool_calls: 5) +chat.ask "Question that triggers tools loop" +# => `execute_tool': Tool calls limit reached: 5 (RubyLLM::ToolCallsLimitReachedError) +``` + +If you wish to remove this safe-guard you can set the max_tool_calls to `nil`. +```ruby +chat = RubyLLM.chat(max_tool_calls: nil) +chat.ask "Question that triggers tools loop" +# Loops until you've used all your credit... ``` ### Global Configuration @@ -263,14 +272,6 @@ RubyLLM.configure do |config| end ``` -If you wish to remove this safe-guard you can set the max_tool_calls to `nil`. -```ruby -RubyLLM.configure do |config| - # Unlimited tools calls allowed - config.max_tool_calls = nil -end -``` - This setting can still be overridden per-chat when needed: ```ruby From 0f7ce26d4fa0aa6d302b6508b5b874deffdc2ee0 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Tue, 1 Apr 2025 23:49:21 +1000 Subject: [PATCH 05/26] bug: reset tools calls for each new 'ask' call --- lib/ruby_llm/chat.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ruby_llm/chat.rb b/lib/ruby_llm/chat.rb index 15d392c8..9335ffb8 100644 --- a/lib/ruby_llm/chat.rb +++ b/lib/ruby_llm/chat.rb @@ -13,7 +13,7 @@ class Chat attr_reader :model, :messages, :tools, :number_of_tool_calls - def initialize(model: nil, provider: nil, max_tool_calls: nil) # rubocop:disable Metrics/MethodLength + def initialize(model: nil, provider: nil, max_tool_calls: nil) model_id = model || RubyLLM.config.default_model with_model(model_id, provider: provider) @temperature = 0.7 @@ -28,6 +28,8 @@ def initialize(model: nil, provider: nil, max_tool_calls: nil) # rubocop:disable end def ask(message = nil, with: {}, &block) + @number_of_tool_calls = 0 + add_message role: :user, content: Content.new(message, with) complete(&block) end From 6b807cf199f3e731fc2b49f92cc2f061d6929b25 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Wed, 2 Apr 2025 20:14:21 +1000 Subject: [PATCH 06/26] bug: move error so tool result is still added - Otherwise the chat object could not have 'ask' executed on again due to malformed messages --- lib/ruby_llm/chat.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ruby_llm/chat.rb b/lib/ruby_llm/chat.rb index 9335ffb8..ac28c2d8 100644 --- a/lib/ruby_llm/chat.rb +++ b/lib/ruby_llm/chat.rb @@ -99,6 +99,8 @@ def add_message(message_or_attributes) def handle_tool_calls(response, &) response.tool_calls.each_value do |tool_call| + raise ToolCallsLimitReachedError, "Tool calls limit reached: #{@max_tool_calls}" if max_tool_calls_reached? + @on[:new_message]&.call result = execute_tool tool_call message = add_tool_result tool_call.id, result @@ -109,8 +111,6 @@ def handle_tool_calls(response, &) end def execute_tool(tool_call) - raise ToolCallsLimitReachedError, "Tool calls limit reached: #{@max_tool_calls}" if max_tool_calls_reached? - @number_of_tool_calls += 1 tool = tools[tool_call.name.to_sym] From 3af500d0bf4385b27ab5f20784c1ff895c615c62 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Fri, 4 Apr 2025 22:59:02 +1000 Subject: [PATCH 07/26] chore: rework approach to rely on completions instead of tool calls --- docs/guides/tools.md | 16 +- lib/ruby_llm.rb | 4 +- lib/ruby_llm/chat.rb | 23 +- lib/ruby_llm/configuration.rb | 4 +- ...se_tools_with_a_tool_completions_limit.yml | 339 ++++++++++++++++++ ...e_tools_with_a_tool_completions_limit.yml} | 173 ++++----- spec/ruby_llm/chat_tools_spec.rb | 11 +- 7 files changed, 443 insertions(+), 127 deletions(-) create mode 100644 spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit.yml rename spec/fixtures/vcr_cassettes/{chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_calls_limit.yml => chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_completions_limit.yml} (66%) diff --git a/docs/guides/tools.md b/docs/guides/tools.md index 3f105b9b..5c4de1b1 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -236,20 +236,22 @@ end > Note: For parameters with limited valid values, clearly specify them in the description. -## Maximum Tools Call Limiting +## Maximum Tool Completion Limiting -When calling tools it is important to consider if you're response could trigger a loop. RubyLLM provides built-in protection against infinite tool call loops: +When including tools it is important to consider if the response could trigger unintended recursive calls to the provider. RubyLLM provides built-in protection by providing a default limit, which can be overridden or turned off entirely. + +This can be performed on a per chat basis or provided in the global configuration. ```ruby # Set a maximum number of tool calls per conversation -chat = RubyLLM.chat(max_tool_calls: 5) +chat = RubyLLM.chat(max_tool_completions: 5) chat.ask "Question that triggers tools loop" # => `execute_tool': Tool calls limit reached: 5 (RubyLLM::ToolCallsLimitReachedError) ``` -If you wish to remove this safe-guard you can set the max_tool_calls to `nil`. +If you wish to remove this safe-guard you can set the max_tool_completions to `nil`. ```ruby -chat = RubyLLM.chat(max_tool_calls: nil) +chat = RubyLLM.chat(max_tool_completions: nil) chat.ask "Question that triggers tools loop" # Loops until you've used all your credit... ``` @@ -261,7 +263,7 @@ You can set a default maximum tool calls limit for all chats through the global ```ruby RubyLLM.configure do |config| # Default is 25 calls per conversation - config.max_tool_calls = 10 # Set a more conservative limit + config.max_tool_completions = 10 # Set a more conservative limit end ``` @@ -269,7 +271,7 @@ This setting can still be overridden per-chat when needed: ```ruby # Override the global setting for this specific chat -chat = RubyLLM.chat(max_tool_calls: 15) +chat = RubyLLM.chat(max_tool_completions: 15) ``` ## Security Considerations diff --git a/lib/ruby_llm.rb b/lib/ruby_llm.rb index f0917b78..06f41a85 100644 --- a/lib/ruby_llm.rb +++ b/lib/ruby_llm.rb @@ -30,8 +30,8 @@ module RubyLLM class Error < StandardError; end class << self - def chat(model: nil, provider: nil, max_tool_calls: config.max_tool_calls) - Chat.new(model: model, provider: provider, max_tool_calls: max_tool_calls) + def chat(model: nil, provider: nil, max_tool_completions: config.max_tool_completions) + Chat.new(model: model, provider: provider, max_tool_completions: max_tool_completions) end def embed(...) diff --git a/lib/ruby_llm/chat.rb b/lib/ruby_llm/chat.rb index b5d515ec..00ae6b6f 100644 --- a/lib/ruby_llm/chat.rb +++ b/lib/ruby_llm/chat.rb @@ -13,7 +13,7 @@ class Chat attr_reader :model, :messages, :tools, :number_of_tool_calls - def initialize(model: nil, provider: nil, max_tool_calls: nil) + def initialize(model: nil, provider: nil, max_tool_completions: nil) model_id = model || RubyLLM.config.default_model with_model(model_id, provider: provider) @temperature = 0.7 @@ -23,12 +23,12 @@ def initialize(model: nil, provider: nil, max_tool_calls: nil) new_message: nil, end_message: nil } - @max_tool_calls = max_tool_calls - @number_of_tool_calls = 0 + @max_tool_completions = max_tool_completions + @number_of_tool_completions = 0 end def ask(message = nil, with: {}, &block) - @number_of_tool_calls = 0 + @number_of_tool_completions = 0 add_message role: :user, content: Content.new(message, with) complete(&block) @@ -106,20 +106,21 @@ def add_message(message_or_attributes) def handle_tool_calls(response, &) response.tool_calls.each_value do |tool_call| - raise ToolCallsLimitReachedError, "Tool calls limit reached: #{@max_tool_calls}" if max_tool_calls_reached? - @on[:new_message]&.call result = execute_tool tool_call message = add_tool_result tool_call.id, result @on[:end_message]&.call(message) end + if max_tool_completions_reached? + raise ToolCallsLimitReachedError, "Tool completions limit reached: #{@max_tool_completions}" + end + + @number_of_tool_completions += 1 complete(&) end def execute_tool(tool_call) - @number_of_tool_calls += 1 - tool = tools[tool_call.name.to_sym] args = tool_call.arguments tool.call(args) @@ -133,10 +134,10 @@ def add_tool_result(tool_use_id, result) ) end - def max_tool_calls_reached? - return false unless @max_tool_calls + def max_tool_completions_reached? + return false unless @max_tool_completions - @number_of_tool_calls >= @max_tool_calls + @number_of_tool_completions >= @max_tool_completions end end end diff --git a/lib/ruby_llm/configuration.rb b/lib/ruby_llm/configuration.rb index 3d5f86d1..59d492b8 100644 --- a/lib/ruby_llm/configuration.rb +++ b/lib/ruby_llm/configuration.rb @@ -23,7 +23,7 @@ class Configuration :default_image_model, :request_timeout, :max_retries, - :max_tool_calls + :max_tool_completions def initialize @request_timeout = 120 @@ -31,7 +31,7 @@ def initialize @default_model = 'gpt-4o-mini' @default_embedding_model = 'text-embedding-3-small' @default_image_model = 'dall-e-3' - @max_tool_calls = 25 + @max_tool_completions = 25 end end end diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit.yml new file mode 100644 index 00000000..5dfec747 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit.yml @@ -0,0 +1,339 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"What''s + the best language to learn?"}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Gets + the best language to learn","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 04 Apr 2025 12:55:17 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-04T12:55:17Z' + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-04T12:55:16Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-04T12:55:17Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-04T12:55:16Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01CcQ5D7iVuSKLa91VpSVqxo","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + help you find out the best language to learn by using the looping_answer tool."},{"type":"tool_use","id":"toolu_014hK3zRV2eyBLgeDh2e3rps","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":423,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":58}}' + recorded_at: Fri, 04 Apr 2025 12:55:17 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"What''s + the best language to learn?"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you find out the best language to learn by using the looping_answer tool."},{"type":"tool_use","id":"toolu_014hK3zRV2eyBLgeDh2e3rps","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_014hK3zRV2eyBLgeDh2e3rps","content":"You + must call the tool again and I will give you the answer."}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Gets + the best language to learn","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 04 Apr 2025 12:55:19 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-04T12:55:18Z' + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-04T12:55:18Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-04T12:55:19Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-04T12:55:18Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01SEYxJTbjWbLrb4UgY4z9mT","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + try the tool again to get the answer for you."},{"type":"tool_use","id":"toolu_014b3YsG3EWayFGUF7A5HSaP","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":505,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":52}}' + recorded_at: Fri, 04 Apr 2025 12:55:19 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"What''s + the best language to learn?"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you find out the best language to learn by using the looping_answer tool."},{"type":"tool_use","id":"toolu_014hK3zRV2eyBLgeDh2e3rps","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_014hK3zRV2eyBLgeDh2e3rps","content":"You + must call the tool again and I will give you the answer."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + try the tool again to get the answer for you."},{"type":"tool_use","id":"toolu_014b3YsG3EWayFGUF7A5HSaP","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_014b3YsG3EWayFGUF7A5HSaP","content":"You + must call the tool again and I will give you the answer."}]},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Gets + the best language to learn","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 04 Apr 2025 12:55:22 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-04T12:55:21Z' + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-04T12:55:21Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-04T12:55:22Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-04T12:55:21Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_015Ri7qF2WWsvc7yxKw9XDz8","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + help you check the weather in Berlin by using the weather tool with the coordinates + you provided."},{"type":"tool_use","id":"toolu_011wbUFiE4cdifCzjZc7Sn4M","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":606,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":95}}' + recorded_at: Fri, 04 Apr 2025 12:55:22 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"What''s + the best language to learn?"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you find out the best language to learn by using the looping_answer tool."},{"type":"tool_use","id":"toolu_014hK3zRV2eyBLgeDh2e3rps","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_014hK3zRV2eyBLgeDh2e3rps","content":"You + must call the tool again and I will give you the answer."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + try the tool again to get the answer for you."},{"type":"tool_use","id":"toolu_014b3YsG3EWayFGUF7A5HSaP","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_014b3YsG3EWayFGUF7A5HSaP","content":"You + must call the tool again and I will give you the answer."}]},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you check the weather in Berlin by using the weather tool with the coordinates + you provided."},{"type":"tool_use","id":"toolu_011wbUFiE4cdifCzjZc7Sn4M","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_011wbUFiE4cdifCzjZc7Sn4M","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Gets + the best language to learn","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 04 Apr 2025 12:55:24 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-04T12:55:23Z' + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-04T12:55:23Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-04T12:55:24Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-04T12:55:23Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: !binary |- + eyJpZCI6Im1zZ18wMUZwS1VnWlRUQnlzRWNvc1RyY2pySkEiLCJ0eXBlIjoibWVzc2FnZSIsInJvbGUiOiJhc3Npc3RhbnQiLCJtb2RlbCI6ImNsYXVkZS0zLTUtaGFpa3UtMjAyNDEwMjIiLCJjb250ZW50IjpbeyJ0eXBlIjoidGV4dCIsInRleHQiOiJUaGUgY3VycmVudCB3ZWF0aGVyIGluIEJlcmxpbiBpcyAxNcKwQyB3aXRoIGEgd2luZCBzcGVlZCBvZiAxMCBrbS9oLiBJdCBzZWVtcyBsaWtlIGEgbWlsZCBkYXkgaW4gdGhlIEdlcm1hbiBjYXBpdGFsLiBXb3VsZCB5b3UgbGlrZSB0byBrbm93IGFueXRoaW5nIGVsc2UgYWJvdXQgdGhlIHdlYXRoZXIgb3IgQmVybGluPyJ9XSwic3RvcF9yZWFzb24iOiJlbmRfdHVybiIsInN0b3Bfc2VxdWVuY2UiOm51bGwsInVzYWdlIjp7ImlucHV0X3Rva2VucyI6NzQwLCJjYWNoZV9jcmVhdGlvbl9pbnB1dF90b2tlbnMiOjAsImNhY2hlX3JlYWRfaW5wdXRfdG9rZW5zIjowLCJvdXRwdXRfdG9rZW5zIjo1MH19 + recorded_at: Fri, 04 Apr 2025 12:55:24 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_calls_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_completions_limit.yml similarity index 66% rename from spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_calls_limit.yml rename to spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_completions_limit.yml index ab342166..fa93e611 100644 --- a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_calls_limit.yml +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_completions_limit.yml @@ -7,7 +7,10 @@ http_interactions: encoding: UTF-8 string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s the best language to learn?"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets - the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}}],"tool_choice":"auto"}' + the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' headers: User-Agent: - Faraday v2.12.2 @@ -25,7 +28,7 @@ http_interactions: message: OK headers: Date: - - Tue, 01 Apr 2025 12:32:58 GMT + - Fri, 04 Apr 2025 12:55:25 GMT Content-Type: - application/json Transfer-Encoding: @@ -37,7 +40,7 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '475' + - '464' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: @@ -45,11 +48,11 @@ http_interactions: X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9999' + - '9997' X-Ratelimit-Remaining-Tokens: - '199988' X-Ratelimit-Reset-Requests: - - 8.64s + - 19.203s X-Ratelimit-Reset-Tokens: - 3ms X-Request-Id: @@ -73,9 +76,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BHV5WbU9AwRXCrmIaHDkKcUdE80DJ", + "id": "chatcmpl-BIarsud77rRcy9D5p9gU4YPGm95Ys", "object": "chat.completion", - "created": 1743510778, + "created": 1743771324, "model": "gpt-4o-mini-2024-07-18", "choices": [ { @@ -85,7 +88,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_KLpxrrQICryUX3F8DnQdtv9s", + "id": "call_XwxqrCSfdyIkv4CL1xiQTutZ", "type": "function", "function": { "name": "looping_answer", @@ -101,9 +104,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 45, + "prompt_tokens": 92, "completion_tokens": 12, - "total_tokens": 57, + "total_tokens": 104, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -118,16 +121,19 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_b376dfbbd5" } - recorded_at: Tue, 01 Apr 2025 12:32:58 GMT + recorded_at: Fri, 04 Apr 2025 12:55:25 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s - the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_KLpxrrQICryUX3F8DnQdtv9s","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must call the tool again and I will give you the answer.","tool_call_id":"call_KLpxrrQICryUX3F8DnQdtv9s"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets - the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}}],"tool_choice":"auto"}' + the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_XwxqrCSfdyIkv4CL1xiQTutZ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must call the tool again and I will give you the answer.","tool_call_id":"call_XwxqrCSfdyIkv4CL1xiQTutZ"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets + the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' headers: User-Agent: - Faraday v2.12.2 @@ -145,7 +151,7 @@ http_interactions: message: OK headers: Date: - - Tue, 01 Apr 2025 12:32:59 GMT + - Fri, 04 Apr 2025 12:55:25 GMT Content-Type: - application/json Transfer-Encoding: @@ -157,7 +163,7 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '609' + - '351' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: @@ -165,11 +171,11 @@ http_interactions: X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9998' + - '9996' X-Ratelimit-Remaining-Tokens: - '199971' X-Ratelimit-Reset-Requests: - - 16.101s + - 27.072s X-Ratelimit-Reset-Tokens: - 8ms X-Request-Id: @@ -193,9 +199,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BHV5XcYQtUurPb4VY616FxupNmvdq", + "id": "chatcmpl-BIartUkedEYt2F8DpAFBYrjEPbVZe", "object": "chat.completion", - "created": 1743510779, + "created": 1743771325, "model": "gpt-4o-mini-2024-07-18", "choices": [ { @@ -205,7 +211,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_143eIARSXoOlnFvZ4OWsVs0R", + "id": "call_AWFco3BPGzSBKcrDSFtp2vMl", "type": "function", "function": { "name": "looping_answer", @@ -221,9 +227,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 80, + "prompt_tokens": 126, "completion_tokens": 12, - "total_tokens": 92, + "total_tokens": 138, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -238,17 +244,21 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_b376dfbbd5" } - recorded_at: Tue, 01 Apr 2025 12:32:59 GMT + recorded_at: Fri, 04 Apr 2025 12:55:25 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s - the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_KLpxrrQICryUX3F8DnQdtv9s","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must call the tool again and I will give you the answer.","tool_call_id":"call_KLpxrrQICryUX3F8DnQdtv9s"},{"role":"assistant","tool_calls":[{"id":"call_143eIARSXoOlnFvZ4OWsVs0R","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must call the tool again and I will give you the answer.","tool_call_id":"call_143eIARSXoOlnFvZ4OWsVs0R"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets - the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}}],"tool_choice":"auto"}' + the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_XwxqrCSfdyIkv4CL1xiQTutZ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must call the tool again and I will give you the answer.","tool_call_id":"call_XwxqrCSfdyIkv4CL1xiQTutZ"},{"role":"assistant","tool_calls":[{"id":"call_AWFco3BPGzSBKcrDSFtp2vMl","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must call the tool again and I will give you the answer.","tool_call_id":"call_AWFco3BPGzSBKcrDSFtp2vMl"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets + the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' headers: User-Agent: - Faraday v2.12.2 @@ -266,7 +276,7 @@ http_interactions: message: OK headers: Date: - - Tue, 01 Apr 2025 12:33:00 GMT + - Fri, 04 Apr 2025 12:55:27 GMT Content-Type: - application/json Transfer-Encoding: @@ -278,7 +288,7 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '410' + - '889' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: @@ -286,13 +296,13 @@ http_interactions: X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9997' + - '9995' X-Ratelimit-Remaining-Tokens: - - '199952' + - '199942' X-Ratelimit-Reset-Requests: - - 23.849s + - 35.05s X-Ratelimit-Reset-Tokens: - - 14ms + - 17ms X-Request-Id: - "" Strict-Transport-Security: @@ -314,9 +324,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BHV5YnMl8DGiVUU9jDSkjzUfYvV4e", + "id": "chatcmpl-BIaruHnGqHLxosvsOplFGgqVgQvup", "object": "chat.completion", - "created": 1743510780, + "created": 1743771326, "model": "gpt-4o-mini-2024-07-18", "choices": [ { @@ -326,11 +336,11 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_B3GVDgNpWeHI2IVHSiLCJZhc", + "id": "call_fOhMhp0EbssTNwwOMGSrGnPh", "type": "function", "function": { - "name": "looping_answer", - "arguments": "{}" + "name": "weather", + "arguments": "{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}" } } ], @@ -342,9 +352,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 115, - "completion_tokens": 12, - "total_tokens": 127, + "prompt_tokens": 182, + "completion_tokens": 24, + "total_tokens": 206, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -359,18 +369,22 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_b376dfbbd5" } - recorded_at: Tue, 01 Apr 2025 12:33:00 GMT + recorded_at: Fri, 04 Apr 2025 12:55:27 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s - the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_KLpxrrQICryUX3F8DnQdtv9s","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must call the tool again and I will give you the answer.","tool_call_id":"call_KLpxrrQICryUX3F8DnQdtv9s"},{"role":"assistant","tool_calls":[{"id":"call_143eIARSXoOlnFvZ4OWsVs0R","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must call the tool again and I will give you the answer.","tool_call_id":"call_143eIARSXoOlnFvZ4OWsVs0R"},{"role":"assistant","tool_calls":[{"id":"call_B3GVDgNpWeHI2IVHSiLCJZhc","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must call the tool again and I will give you the answer.","tool_call_id":"call_B3GVDgNpWeHI2IVHSiLCJZhc"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets - the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}}],"tool_choice":"auto"}' + the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_XwxqrCSfdyIkv4CL1xiQTutZ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must call the tool again and I will give you the answer.","tool_call_id":"call_XwxqrCSfdyIkv4CL1xiQTutZ"},{"role":"assistant","tool_calls":[{"id":"call_AWFco3BPGzSBKcrDSFtp2vMl","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You + must call the tool again and I will give you the answer.","tool_call_id":"call_AWFco3BPGzSBKcrDSFtp2vMl"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","tool_calls":[{"id":"call_fOhMhp0EbssTNwwOMGSrGnPh","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"call_fOhMhp0EbssTNwwOMGSrGnPh"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets + the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' headers: User-Agent: - Faraday v2.12.2 @@ -388,7 +402,7 @@ http_interactions: message: OK headers: Date: - - Tue, 01 Apr 2025 12:33:01 GMT + - Fri, 04 Apr 2025 12:55:28 GMT Content-Type: - application/json Transfer-Encoding: @@ -400,7 +414,7 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '401' + - '823' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: @@ -408,13 +422,13 @@ http_interactions: X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9996' + - '9995' X-Ratelimit-Remaining-Tokens: - - '199935' + - '199926' X-Ratelimit-Reset-Requests: - - 31.811s + - 42.494s X-Ratelimit-Reset-Tokens: - - 19ms + - 22ms X-Request-Id: - "" Strict-Transport-Security: @@ -434,52 +448,7 @@ http_interactions: - h3=":443"; ma=86400 body: encoding: ASCII-8BIT - string: | - { - "id": "chatcmpl-BHV5YdONCev7O3yWoRebUvzW5eWLL", - "object": "chat.completion", - "created": 1743510780, - "model": "gpt-4o-mini-2024-07-18", - "choices": [ - { - "index": 0, - "message": { - "role": "assistant", - "content": null, - "tool_calls": [ - { - "id": "call_ZWjGRUjpzyLHqfPs5iUWpgQp", - "type": "function", - "function": { - "name": "looping_answer", - "arguments": "{}" - } - } - ], - "refusal": null, - "annotations": [] - }, - "logprobs": null, - "finish_reason": "tool_calls" - } - ], - "usage": { - "prompt_tokens": 150, - "completion_tokens": 12, - "total_tokens": 162, - "prompt_tokens_details": { - "cached_tokens": 0, - "audio_tokens": 0 - }, - "completion_tokens_details": { - "reasoning_tokens": 0, - "audio_tokens": 0, - "accepted_prediction_tokens": 0, - "rejected_prediction_tokens": 0 - } - }, - "service_tier": "default", - "system_fingerprint": "fp_b376dfbbd5" - } - recorded_at: Tue, 01 Apr 2025 12:33:01 GMT + string: !binary |- + ewogICJpZCI6ICJjaGF0Y21wbC1CSWFydk9sTGRzUlNhR29yQUhZZnp1dUEybkxpZCIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0Mzc3MTMyNywKICAibW9kZWwiOiAiZ3B0LTRvLW1pbmktMjAyNC0wNy0xOCIsCiAgImNob2ljZXMiOiBbCiAgICB7CiAgICAgICJpbmRleCI6IDAsCiAgICAgICJtZXNzYWdlIjogewogICAgICAgICJyb2xlIjogImFzc2lzdGFudCIsCiAgICAgICAgImNvbnRlbnQiOiAiVGhlIGN1cnJlbnQgd2VhdGhlciBpbiBCZXJsaW4gaXMgMTXCsEMgd2l0aCBhIHdpbmQgc3BlZWQgb2YgMTAga20vaC4iLAogICAgICAgICJyZWZ1c2FsIjogbnVsbCwKICAgICAgICAiYW5ub3RhdGlvbnMiOiBbXQogICAgICB9LAogICAgICAibG9ncHJvYnMiOiBudWxsLAogICAgICAiZmluaXNoX3JlYXNvbiI6ICJzdG9wIgogICAgfQogIF0sCiAgInVzYWdlIjogewogICAgInByb21wdF90b2tlbnMiOiAyMzcsCiAgICAiY29tcGxldGlvbl90b2tlbnMiOiAyMSwKICAgICJ0b3RhbF90b2tlbnMiOiAyNTgsCiAgICAicHJvbXB0X3Rva2Vuc19kZXRhaWxzIjogewogICAgICAiY2FjaGVkX3Rva2VucyI6IDAsCiAgICAgICJhdWRpb190b2tlbnMiOiAwCiAgICB9LAogICAgImNvbXBsZXRpb25fdG9rZW5zX2RldGFpbHMiOiB7CiAgICAgICJyZWFzb25pbmdfdG9rZW5zIjogMCwKICAgICAgImF1ZGlvX3Rva2VucyI6IDAsCiAgICAgICJhY2NlcHRlZF9wcmVkaWN0aW9uX3Rva2VucyI6IDAsCiAgICAgICJyZWplY3RlZF9wcmVkaWN0aW9uX3Rva2VucyI6IDAKICAgIH0KICB9LAogICJzZXJ2aWNlX3RpZXIiOiAiZGVmYXVsdCIsCiAgInN5c3RlbV9maW5nZXJwcmludCI6ICJmcF9iMzc2ZGZiYmQ1Igp9Cg== + recorded_at: Fri, 04 Apr 2025 12:55:28 GMT recorded_with: VCR 6.3.1 diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index e6f11740..0afee7c0 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -92,13 +92,18 @@ def execute expect(response.content).to include('10') end - it "#{model} can use tools with a tool calls limit" do - chat = RubyLLM.chat(model: model, max_tool_calls: 3) - .with_tool(LoopingAnswer) + it "#{model} can use tools with a tool completions limit" do + chat = RubyLLM.chat(model: model, max_tool_completions: 1) + .with_tools(LoopingAnswer, Weather) expect do chat.ask("What's the best language to learn?") end.to raise_error(RubyLLM::ToolCallsLimitReachedError) + + # Ensure it does not break the next ask. + next_response = chat.ask("What's the weather in Berlin? (52.5200, 13.4050)") + expect(next_response.content).to include('15') + expect(next_response.content).to include('10') end end end From 39894a87f6855b47d8c7d8e6d681ca42e0a2f8bc Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Fri, 4 Apr 2025 23:05:44 +1000 Subject: [PATCH 08/26] bug: fix attr_reader declaration to match number_of_tool_completions --- lib/ruby_llm/chat.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ruby_llm/chat.rb b/lib/ruby_llm/chat.rb index 00ae6b6f..eddd8cd2 100644 --- a/lib/ruby_llm/chat.rb +++ b/lib/ruby_llm/chat.rb @@ -11,7 +11,7 @@ module RubyLLM class Chat include Enumerable - attr_reader :model, :messages, :tools, :number_of_tool_calls + attr_reader :model, :messages, :tools, :number_of_tool_completions def initialize(model: nil, provider: nil, max_tool_completions: nil) model_id = model || RubyLLM.config.default_model From 4718e2dd3176e354cd32404ba2d83269983880ed Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Mon, 7 Apr 2025 22:01:27 +1000 Subject: [PATCH 09/26] test: add better example --- Gemfile | 3 +- ...se_tools_with_a_tool_completions_limit.yml | 565 +++++++++++-- ...se_tools_with_a_tool_completions_limit.yml | 796 ++++++++++++++++-- spec/ruby_llm/chat_tools_spec.rb | 11 +- spec/spec_helper.rb | 1 + 5 files changed, 1253 insertions(+), 123 deletions(-) diff --git a/Gemfile b/Gemfile index 95d97963..ba7450e4 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,7 @@ group :development do gem 'bundler', '>= 2.0' gem 'codecov' gem 'dotenv' + gem 'faker' gem 'ferrum' gem 'irb' gem 'nokogiri' @@ -31,4 +32,4 @@ group :development do gem 'vcr' gem 'webmock', '~> 3.18' gem 'yard', '>= 0.9' -end +end \ No newline at end of file diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit.yml index 5dfec747..ece0c6df 100644 --- a/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit.yml +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit.yml @@ -5,9 +5,10 @@ http_interactions: uri: https://api.anthropic.com/v1/messages body: encoding: UTF-8 - string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"What''s - the best language to learn?"}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Gets - the best language to learn","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., 13.4050)"}},"required":["latitude","longitude"]}}]}' @@ -30,7 +31,7 @@ http_interactions: message: OK headers: Date: - - Fri, 04 Apr 2025 12:55:17 GMT + - Mon, 07 Apr 2025 11:50:04 GMT Content-Type: - application/json Transfer-Encoding: @@ -42,25 +43,25 @@ http_interactions: Anthropic-Ratelimit-Requests-Remaining: - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-04-04T12:55:17Z' + - '2025-04-07T11:50:03Z' Anthropic-Ratelimit-Input-Tokens-Limit: - '50000' Anthropic-Ratelimit-Input-Tokens-Remaining: - '50000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-04-04T12:55:16Z' + - '2025-04-07T11:50:03Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-04-04T12:55:17Z' + - '2025-04-07T11:50:04Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - '60000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-04-04T12:55:16Z' + - '2025-04-07T11:50:03Z' Request-Id: - "" Anthropic-Organization-Id: @@ -77,19 +78,26 @@ http_interactions: - "" body: encoding: ASCII-8BIT - string: '{"id":"msg_01CcQ5D7iVuSKLa91VpSVqxo","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll - help you find out the best language to learn by using the looping_answer tool."},{"type":"tool_use","id":"toolu_014hK3zRV2eyBLgeDh2e3rps","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":423,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":58}}' - recorded_at: Fri, 04 Apr 2025 12:55:17 GMT + string: '{"id":"msg_013qT6UG2wHUTPT4HCpXg5Pt","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + help you fetch all posts from r/RandomNames by repeatedly calling the `looping_answer` + function until no more posts are available. I''ll track the process step by + step."},{"type":"tool_use","id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":450,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":77}}' + recorded_at: Mon, 07 Apr 2025 11:50:04 GMT - request: method: post uri: https://api.anthropic.com/v1/messages body: encoding: UTF-8 - string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"What''s - the best language to learn?"},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you find out the best language to learn by using the looping_answer tool."},{"type":"tool_use","id":"toolu_014hK3zRV2eyBLgeDh2e3rps","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_014hK3zRV2eyBLgeDh2e3rps","content":"You - must call the tool again and I will give you the answer."}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Gets - the best language to learn","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all posts from r/RandomNames by repeatedly calling the `looping_answer` + function until no more posts are available. I''ll track the process step by + step."},{"type":"tool_use","id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","content":"{:posts=>[{:title=>\"Jennifer + Schinner\", :score=>812}, {:title=>\"Luciano Connelly\", :score=>832}, {:title=>\"Jorge + Strosin\", :score=>6}], :next_page=>\"t3_abc123_141\", :message=>\"More posts + are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., 13.4050)"}},"required":["latitude","longitude"]}}]}' @@ -112,7 +120,7 @@ http_interactions: message: OK headers: Date: - - Fri, 04 Apr 2025 12:55:19 GMT + - Mon, 07 Apr 2025 11:50:07 GMT Content-Type: - application/json Transfer-Encoding: @@ -124,25 +132,25 @@ http_interactions: Anthropic-Ratelimit-Requests-Remaining: - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-04-04T12:55:18Z' + - '2025-04-07T11:50:06Z' Anthropic-Ratelimit-Input-Tokens-Limit: - '50000' Anthropic-Ratelimit-Input-Tokens-Remaining: - '50000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-04-04T12:55:18Z' + - '2025-04-07T11:50:06Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-04-04T12:55:19Z' + - '2025-04-07T11:50:07Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - '60000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-04-04T12:55:18Z' + - '2025-04-07T11:50:06Z' Request-Id: - "" Anthropic-Organization-Id: @@ -159,22 +167,30 @@ http_interactions: - "" body: encoding: ASCII-8BIT - string: '{"id":"msg_01SEYxJTbjWbLrb4UgY4z9mT","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll - try the tool again to get the answer for you."},{"type":"tool_use","id":"toolu_014b3YsG3EWayFGUF7A5HSaP","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":505,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":52}}' - recorded_at: Fri, 04 Apr 2025 12:55:19 GMT + string: '{"id":"msg_015zDjER8674ZTy7JVNtDJEw","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I + see the first batch of posts has been retrieved, and there''s a next_page + token. I''ll continue fetching with that token:"},{"type":"tool_use","id":"toolu_012TfebeNYFeAq5YL5bNDUxw","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":617,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":68}}' + recorded_at: Mon, 07 Apr 2025 11:50:07 GMT - request: method: post uri: https://api.anthropic.com/v1/messages body: encoding: UTF-8 - string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"What''s - the best language to learn?"},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you find out the best language to learn by using the looping_answer tool."},{"type":"tool_use","id":"toolu_014hK3zRV2eyBLgeDh2e3rps","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_014hK3zRV2eyBLgeDh2e3rps","content":"You - must call the tool again and I will give you the answer."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - try the tool again to get the answer for you."},{"type":"tool_use","id":"toolu_014b3YsG3EWayFGUF7A5HSaP","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_014b3YsG3EWayFGUF7A5HSaP","content":"You - must call the tool again and I will give you the answer."}]},{"role":"user","content":"What''s - the weather in Berlin? (52.5200, 13.4050)"}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Gets - the best language to learn","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all posts from r/RandomNames by repeatedly calling the `looping_answer` + function until no more posts are available. I''ll track the process step by + step."},{"type":"tool_use","id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","content":"{:posts=>[{:title=>\"Jennifer + Schinner\", :score=>812}, {:title=>\"Luciano Connelly\", :score=>832}, {:title=>\"Jorge + Strosin\", :score=>6}], :next_page=>\"t3_abc123_141\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see the first batch of posts has been retrieved, and there''s a next_page + token. I''ll continue fetching with that token:"},{"type":"tool_use","id":"toolu_012TfebeNYFeAq5YL5bNDUxw","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_012TfebeNYFeAq5YL5bNDUxw","content":"{:posts=>[{:title=>\"Sen. + Rosendo Cartwright\", :score=>304}, {:title=>\"Allyson Russel\", :score=>186}, + {:title=>\"Veronika Rowe\", :score=>500}], :next_page=>\"t3_abc123_303\", + :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., 13.4050)"}},"required":["latitude","longitude"]}}]}' @@ -197,7 +213,7 @@ http_interactions: message: OK headers: Date: - - Fri, 04 Apr 2025 12:55:22 GMT + - Mon, 07 Apr 2025 11:50:08 GMT Content-Type: - application/json Transfer-Encoding: @@ -209,25 +225,25 @@ http_interactions: Anthropic-Ratelimit-Requests-Remaining: - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-04-04T12:55:21Z' + - '2025-04-07T11:50:08Z' Anthropic-Ratelimit-Input-Tokens-Limit: - '50000' Anthropic-Ratelimit-Input-Tokens-Remaining: - '50000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-04-04T12:55:21Z' + - '2025-04-07T11:50:08Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-04-04T12:55:22Z' + - '2025-04-07T11:50:08Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - '60000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-04-04T12:55:21Z' + - '2025-04-07T11:50:08Z' Request-Id: - "" Anthropic-Organization-Id: @@ -244,26 +260,33 @@ http_interactions: - "" body: encoding: ASCII-8BIT - string: '{"id":"msg_015Ri7qF2WWsvc7yxKw9XDz8","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll - help you check the weather in Berlin by using the weather tool with the coordinates - you provided."},{"type":"tool_use","id":"toolu_011wbUFiE4cdifCzjZc7Sn4M","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":606,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":95}}' - recorded_at: Fri, 04 Apr 2025 12:55:22 GMT + string: '{"id":"msg_01PaDVw9mfFxLhubbTV9nsxr","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01GtWe5ccjcbe42QHpNgnmHA","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":783,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":45}}' + recorded_at: Mon, 07 Apr 2025 11:50:08 GMT - request: method: post uri: https://api.anthropic.com/v1/messages body: encoding: UTF-8 - string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"What''s - the best language to learn?"},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you find out the best language to learn by using the looping_answer tool."},{"type":"tool_use","id":"toolu_014hK3zRV2eyBLgeDh2e3rps","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_014hK3zRV2eyBLgeDh2e3rps","content":"You - must call the tool again and I will give you the answer."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - try the tool again to get the answer for you."},{"type":"tool_use","id":"toolu_014b3YsG3EWayFGUF7A5HSaP","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_014b3YsG3EWayFGUF7A5HSaP","content":"You - must call the tool again and I will give you the answer."}]},{"role":"user","content":"What''s - the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you check the weather in Berlin by using the weather tool with the coordinates - you provided."},{"type":"tool_use","id":"toolu_011wbUFiE4cdifCzjZc7Sn4M","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_011wbUFiE4cdifCzjZc7Sn4M","content":"Current - weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Gets - the best language to learn","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all posts from r/RandomNames by repeatedly calling the `looping_answer` + function until no more posts are available. I''ll track the process step by + step."},{"type":"tool_use","id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","content":"{:posts=>[{:title=>\"Jennifer + Schinner\", :score=>812}, {:title=>\"Luciano Connelly\", :score=>832}, {:title=>\"Jorge + Strosin\", :score=>6}], :next_page=>\"t3_abc123_141\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see the first batch of posts has been retrieved, and there''s a next_page + token. I''ll continue fetching with that token:"},{"type":"tool_use","id":"toolu_012TfebeNYFeAq5YL5bNDUxw","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_012TfebeNYFeAq5YL5bNDUxw","content":"{:posts=>[{:title=>\"Sen. + Rosendo Cartwright\", :score=>304}, {:title=>\"Allyson Russel\", :score=>186}, + {:title=>\"Veronika Rowe\", :score=>500}], :next_page=>\"t3_abc123_303\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01GtWe5ccjcbe42QHpNgnmHA","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01GtWe5ccjcbe42QHpNgnmHA","content":"{:posts=>[{:title=>\"Rep. + Desire Swaniawski\", :score=>517}, {:title=>\"Rep. Riley VonRueden\", :score=>954}, + {:title=>\"Clemmie Baumbach\", :score=>730}], :next_page=>\"t3_abc123_920\", + :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., 13.4050)"}},"required":["latitude","longitude"]}}]}' @@ -286,7 +309,7 @@ http_interactions: message: OK headers: Date: - - Fri, 04 Apr 2025 12:55:24 GMT + - Mon, 07 Apr 2025 11:50:09 GMT Content-Type: - application/json Transfer-Encoding: @@ -298,25 +321,449 @@ http_interactions: Anthropic-Ratelimit-Requests-Remaining: - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-04-04T12:55:23Z' + - '2025-04-07T11:50:09Z' Anthropic-Ratelimit-Input-Tokens-Limit: - '50000' Anthropic-Ratelimit-Input-Tokens-Remaining: + - '49000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-07T11:50:09Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-07T11:50:09Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '59000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-07T11:50:09Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01J7JHiBra4MGSEZmTfuMQtu","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_019wmHTkfXoQ1ZiAPJkFdhSq","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":929,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":45}}' + recorded_at: Mon, 07 Apr 2025 11:50:09 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all posts from r/RandomNames by repeatedly calling the `looping_answer` + function until no more posts are available. I''ll track the process step by + step."},{"type":"tool_use","id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","content":"{:posts=>[{:title=>\"Jennifer + Schinner\", :score=>812}, {:title=>\"Luciano Connelly\", :score=>832}, {:title=>\"Jorge + Strosin\", :score=>6}], :next_page=>\"t3_abc123_141\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see the first batch of posts has been retrieved, and there''s a next_page + token. I''ll continue fetching with that token:"},{"type":"tool_use","id":"toolu_012TfebeNYFeAq5YL5bNDUxw","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_012TfebeNYFeAq5YL5bNDUxw","content":"{:posts=>[{:title=>\"Sen. + Rosendo Cartwright\", :score=>304}, {:title=>\"Allyson Russel\", :score=>186}, + {:title=>\"Veronika Rowe\", :score=>500}], :next_page=>\"t3_abc123_303\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01GtWe5ccjcbe42QHpNgnmHA","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01GtWe5ccjcbe42QHpNgnmHA","content":"{:posts=>[{:title=>\"Rep. + Desire Swaniawski\", :score=>517}, {:title=>\"Rep. Riley VonRueden\", :score=>954}, + {:title=>\"Clemmie Baumbach\", :score=>730}], :next_page=>\"t3_abc123_920\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_019wmHTkfXoQ1ZiAPJkFdhSq","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019wmHTkfXoQ1ZiAPJkFdhSq","content":"{:posts=>[{:title=>\"Lakesha + Witting\", :score=>548}, {:title=>\"Erwin Upton JD\", :score=>876}, {:title=>\"Lorna + Schoen\", :score=>841}], :next_page=>\"t3_abc123_575\", :message=>\"More posts + are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Apr 2025 11:50:10 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '48' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-07T11:50:11Z' + Anthropic-Ratelimit-Input-Tokens-Limit: - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '49000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-04-04T12:55:23Z' + - '2025-04-07T11:50:11Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-04-04T12:55:24Z' + - '2025-04-07T11:50:10Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: + - '59000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-07T11:50:10Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01T3dNRr9gFZe7fBN2XZ36sd","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01YHD44HkUXcs6JvuYLyTZFC","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1071,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":45}}' + recorded_at: Mon, 07 Apr 2025 11:50:10 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all posts from r/RandomNames by repeatedly calling the `looping_answer` + function until no more posts are available. I''ll track the process step by + step."},{"type":"tool_use","id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","content":"{:posts=>[{:title=>\"Jennifer + Schinner\", :score=>812}, {:title=>\"Luciano Connelly\", :score=>832}, {:title=>\"Jorge + Strosin\", :score=>6}], :next_page=>\"t3_abc123_141\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see the first batch of posts has been retrieved, and there''s a next_page + token. I''ll continue fetching with that token:"},{"type":"tool_use","id":"toolu_012TfebeNYFeAq5YL5bNDUxw","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_012TfebeNYFeAq5YL5bNDUxw","content":"{:posts=>[{:title=>\"Sen. + Rosendo Cartwright\", :score=>304}, {:title=>\"Allyson Russel\", :score=>186}, + {:title=>\"Veronika Rowe\", :score=>500}], :next_page=>\"t3_abc123_303\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01GtWe5ccjcbe42QHpNgnmHA","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01GtWe5ccjcbe42QHpNgnmHA","content":"{:posts=>[{:title=>\"Rep. + Desire Swaniawski\", :score=>517}, {:title=>\"Rep. Riley VonRueden\", :score=>954}, + {:title=>\"Clemmie Baumbach\", :score=>730}], :next_page=>\"t3_abc123_920\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_019wmHTkfXoQ1ZiAPJkFdhSq","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019wmHTkfXoQ1ZiAPJkFdhSq","content":"{:posts=>[{:title=>\"Lakesha + Witting\", :score=>548}, {:title=>\"Erwin Upton JD\", :score=>876}, {:title=>\"Lorna + Schoen\", :score=>841}], :next_page=>\"t3_abc123_575\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01YHD44HkUXcs6JvuYLyTZFC","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01YHD44HkUXcs6JvuYLyTZFC","content":"{:posts=>[{:title=>\"Frances + Botsford DC\", :score=>666}, {:title=>\"Darren Gusikowski\", :score=>156}, + {:title=>\"Billie Frami\", :score=>690}], :next_page=>\"t3_abc123_588\", :message=>\"More + posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Apr 2025 11:50:12 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-07T11:50:12Z' + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '49000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-07T11:50:13Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-07T11:50:12Z' + Anthropic-Ratelimit-Tokens-Limit: - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '59000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-07T11:50:12Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01PhCTyyUscDQkuDnnRjC9Vh","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_0177UkLfLnnmAsVEEVd1g24C","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1211,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":45}}' + recorded_at: Mon, 07 Apr 2025 11:50:12 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all posts from r/RandomNames by repeatedly calling the `looping_answer` + function until no more posts are available. I''ll track the process step by + step."},{"type":"tool_use","id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","content":"{:posts=>[{:title=>\"Jennifer + Schinner\", :score=>812}, {:title=>\"Luciano Connelly\", :score=>832}, {:title=>\"Jorge + Strosin\", :score=>6}], :next_page=>\"t3_abc123_141\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see the first batch of posts has been retrieved, and there''s a next_page + token. I''ll continue fetching with that token:"},{"type":"tool_use","id":"toolu_012TfebeNYFeAq5YL5bNDUxw","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_012TfebeNYFeAq5YL5bNDUxw","content":"{:posts=>[{:title=>\"Sen. + Rosendo Cartwright\", :score=>304}, {:title=>\"Allyson Russel\", :score=>186}, + {:title=>\"Veronika Rowe\", :score=>500}], :next_page=>\"t3_abc123_303\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01GtWe5ccjcbe42QHpNgnmHA","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01GtWe5ccjcbe42QHpNgnmHA","content":"{:posts=>[{:title=>\"Rep. + Desire Swaniawski\", :score=>517}, {:title=>\"Rep. Riley VonRueden\", :score=>954}, + {:title=>\"Clemmie Baumbach\", :score=>730}], :next_page=>\"t3_abc123_920\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_019wmHTkfXoQ1ZiAPJkFdhSq","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019wmHTkfXoQ1ZiAPJkFdhSq","content":"{:posts=>[{:title=>\"Lakesha + Witting\", :score=>548}, {:title=>\"Erwin Upton JD\", :score=>876}, {:title=>\"Lorna + Schoen\", :score=>841}], :next_page=>\"t3_abc123_575\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01YHD44HkUXcs6JvuYLyTZFC","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01YHD44HkUXcs6JvuYLyTZFC","content":"{:posts=>[{:title=>\"Frances + Botsford DC\", :score=>666}, {:title=>\"Darren Gusikowski\", :score=>156}, + {:title=>\"Billie Frami\", :score=>690}], :next_page=>\"t3_abc123_588\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_0177UkLfLnnmAsVEEVd1g24C","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_0177UkLfLnnmAsVEEVd1g24C","content":"{:posts=>[{:title=>\"Miss + Denice Abshire\", :score=>25}, {:title=>\"Evelia Kassulke\", :score=>352}, + {:title=>\"Edgar Paucek\", :score=>971}], :next_page=>\"t3_abc123_827\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Apr 2025 11:50:14 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-07T11:50:14Z' + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '49000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-07T11:50:14Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-07T11:50:14Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '59000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-07T11:50:14Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01JL73C3Q1Pa8cB7dpFRXsCR","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + fetch the current weather for Berlin using its coordinates."},{"type":"tool_use","id":"toolu_012jVTZ6ikJN1mND1M7gyceX","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1376,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":87}}' + recorded_at: Mon, 07 Apr 2025 11:50:14 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all posts from r/RandomNames by repeatedly calling the `looping_answer` + function until no more posts are available. I''ll track the process step by + step."},{"type":"tool_use","id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01GFHmQ6SNzJ62wcPBa6MGxQ","content":"{:posts=>[{:title=>\"Jennifer + Schinner\", :score=>812}, {:title=>\"Luciano Connelly\", :score=>832}, {:title=>\"Jorge + Strosin\", :score=>6}], :next_page=>\"t3_abc123_141\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see the first batch of posts has been retrieved, and there''s a next_page + token. I''ll continue fetching with that token:"},{"type":"tool_use","id":"toolu_012TfebeNYFeAq5YL5bNDUxw","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_012TfebeNYFeAq5YL5bNDUxw","content":"{:posts=>[{:title=>\"Sen. + Rosendo Cartwright\", :score=>304}, {:title=>\"Allyson Russel\", :score=>186}, + {:title=>\"Veronika Rowe\", :score=>500}], :next_page=>\"t3_abc123_303\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01GtWe5ccjcbe42QHpNgnmHA","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01GtWe5ccjcbe42QHpNgnmHA","content":"{:posts=>[{:title=>\"Rep. + Desire Swaniawski\", :score=>517}, {:title=>\"Rep. Riley VonRueden\", :score=>954}, + {:title=>\"Clemmie Baumbach\", :score=>730}], :next_page=>\"t3_abc123_920\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_019wmHTkfXoQ1ZiAPJkFdhSq","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019wmHTkfXoQ1ZiAPJkFdhSq","content":"{:posts=>[{:title=>\"Lakesha + Witting\", :score=>548}, {:title=>\"Erwin Upton JD\", :score=>876}, {:title=>\"Lorna + Schoen\", :score=>841}], :next_page=>\"t3_abc123_575\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01YHD44HkUXcs6JvuYLyTZFC","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01YHD44HkUXcs6JvuYLyTZFC","content":"{:posts=>[{:title=>\"Frances + Botsford DC\", :score=>666}, {:title=>\"Darren Gusikowski\", :score=>156}, + {:title=>\"Billie Frami\", :score=>690}], :next_page=>\"t3_abc123_588\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_0177UkLfLnnmAsVEEVd1g24C","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_0177UkLfLnnmAsVEEVd1g24C","content":"{:posts=>[{:title=>\"Miss + Denice Abshire\", :score=>25}, {:title=>\"Evelia Kassulke\", :score=>352}, + {:title=>\"Edgar Paucek\", :score=>971}], :next_page=>\"t3_abc123_827\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch the current weather for Berlin using its coordinates."},{"type":"tool_use","id":"toolu_012jVTZ6ikJN1mND1M7gyceX","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_012jVTZ6ikJN1mND1M7gyceX","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Apr 2025 11:50:16 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-07T11:50:16Z' + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '49000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-07T11:50:16Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-07T11:50:16Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '59000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-04-04T12:55:23Z' + - '2025-04-07T11:50:16Z' Request-Id: - "" Anthropic-Organization-Id: @@ -334,6 +781,6 @@ http_interactions: body: encoding: ASCII-8BIT string: !binary |- - eyJpZCI6Im1zZ18wMUZwS1VnWlRUQnlzRWNvc1RyY2pySkEiLCJ0eXBlIjoibWVzc2FnZSIsInJvbGUiOiJhc3Npc3RhbnQiLCJtb2RlbCI6ImNsYXVkZS0zLTUtaGFpa3UtMjAyNDEwMjIiLCJjb250ZW50IjpbeyJ0eXBlIjoidGV4dCIsInRleHQiOiJUaGUgY3VycmVudCB3ZWF0aGVyIGluIEJlcmxpbiBpcyAxNcKwQyB3aXRoIGEgd2luZCBzcGVlZCBvZiAxMCBrbS9oLiBJdCBzZWVtcyBsaWtlIGEgbWlsZCBkYXkgaW4gdGhlIEdlcm1hbiBjYXBpdGFsLiBXb3VsZCB5b3UgbGlrZSB0byBrbm93IGFueXRoaW5nIGVsc2UgYWJvdXQgdGhlIHdlYXRoZXIgb3IgQmVybGluPyJ9XSwic3RvcF9yZWFzb24iOiJlbmRfdHVybiIsInN0b3Bfc2VxdWVuY2UiOm51bGwsInVzYWdlIjp7ImlucHV0X3Rva2VucyI6NzQwLCJjYWNoZV9jcmVhdGlvbl9pbnB1dF90b2tlbnMiOjAsImNhY2hlX3JlYWRfaW5wdXRfdG9rZW5zIjowLCJvdXRwdXRfdG9rZW5zIjo1MH19 - recorded_at: Fri, 04 Apr 2025 12:55:24 GMT + eyJpZCI6Im1zZ18wMVBKc2FmdHdMNTRwV1FEWmh2bWZ2RXUiLCJ0eXBlIjoibWVzc2FnZSIsInJvbGUiOiJhc3Npc3RhbnQiLCJtb2RlbCI6ImNsYXVkZS0zLTUtaGFpa3UtMjAyNDEwMjIiLCJjb250ZW50IjpbeyJ0eXBlIjoidGV4dCIsInRleHQiOiJUaGUgY3VycmVudCB3ZWF0aGVyIGluIEJlcmxpbiBpcyAxNcKwQyB3aXRoIGEgd2luZCBzcGVlZCBvZiAxMCBrbS9oLiJ9XSwic3RvcF9yZWFzb24iOiJlbmRfdHVybiIsInN0b3Bfc2VxdWVuY2UiOm51bGwsInVzYWdlIjp7ImlucHV0X3Rva2VucyI6MTUwMiwiY2FjaGVfY3JlYXRpb25faW5wdXRfdG9rZW5zIjowLCJjYWNoZV9yZWFkX2lucHV0X3Rva2VucyI6MCwib3V0cHV0X3Rva2VucyI6MjZ9fQ== + recorded_at: Mon, 07 Apr 2025 11:50:16 GMT recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_completions_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_completions_limit.yml index fa93e611..c1c440ff 100644 --- a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_completions_limit.yml +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_completions_limit.yml @@ -5,9 +5,10 @@ http_interactions: uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 - string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s - the best language to learn?"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets - the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' @@ -28,7 +29,7 @@ http_interactions: message: OK headers: Date: - - Fri, 04 Apr 2025 12:55:25 GMT + - Mon, 07 Apr 2025 11:50:17 GMT Content-Type: - application/json Transfer-Encoding: @@ -40,7 +41,7 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '464' + - '503' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: @@ -50,11 +51,11 @@ http_interactions: X-Ratelimit-Remaining-Requests: - '9997' X-Ratelimit-Remaining-Tokens: - - '199988' + - '199967' X-Ratelimit-Reset-Requests: - - 19.203s + - 24.916s X-Ratelimit-Reset-Tokens: - - 3ms + - 9ms X-Request-Id: - "" Strict-Transport-Security: @@ -76,9 +77,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BIarsud77rRcy9D5p9gU4YPGm95Ys", + "id": "chatcmpl-BJfHUUhAE9awrhlyoz9Qm3B6IoG36", "object": "chat.completion", - "created": 1743771324, + "created": 1744026616, "model": "gpt-4o-mini-2024-07-18", "choices": [ { @@ -88,7 +89,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_XwxqrCSfdyIkv4CL1xiQTutZ", + "id": "call_o9cJPU9ujtsE3jUnrNfMjtHi", "type": "function", "function": { "name": "looping_answer", @@ -104,9 +105,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 92, + "prompt_tokens": 116, "completion_tokens": 12, - "total_tokens": 104, + "total_tokens": 128, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -121,16 +122,19 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_b376dfbbd5" } - recorded_at: Fri, 04 Apr 2025 12:55:25 GMT + recorded_at: Mon, 07 Apr 2025 11:50:17 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 - string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s - the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_XwxqrCSfdyIkv4CL1xiQTutZ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must call the tool again and I will give you the answer.","tool_call_id":"call_XwxqrCSfdyIkv4CL1xiQTutZ"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets - the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia + Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. + Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' @@ -151,7 +155,7 @@ http_interactions: message: OK headers: Date: - - Fri, 04 Apr 2025 12:55:25 GMT + - Mon, 07 Apr 2025 11:50:18 GMT Content-Type: - application/json Transfer-Encoding: @@ -163,7 +167,7 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '351' + - '978' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: @@ -173,11 +177,11 @@ http_interactions: X-Ratelimit-Remaining-Requests: - '9996' X-Ratelimit-Remaining-Tokens: - - '199971' + - '199908' X-Ratelimit-Reset-Requests: - - 27.072s + - 32.678s X-Ratelimit-Reset-Tokens: - - 8ms + - 27ms X-Request-Id: - "" Strict-Transport-Security: @@ -199,9 +203,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BIartUkedEYt2F8DpAFBYrjEPbVZe", + "id": "chatcmpl-BJfHVRYO1N7EATyFtz1eaE0mPbTgg", "object": "chat.completion", - "created": 1743771325, + "created": 1744026617, "model": "gpt-4o-mini-2024-07-18", "choices": [ { @@ -211,7 +215,15 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_AWFco3BPGzSBKcrDSFtp2vMl", + "id": "call_5ffJQo7EzvQ3aLIbp0dgBNcs", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_F0gbDJjAyfgsyVxKYR9k9JPY", "type": "function", "function": { "name": "looping_answer", @@ -227,9 +239,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 126, - "completion_tokens": 12, - "total_tokens": 138, + "prompt_tokens": 206, + "completion_tokens": 42, + "total_tokens": 248, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -244,18 +256,25 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_b376dfbbd5" } - recorded_at: Fri, 04 Apr 2025 12:55:25 GMT + recorded_at: Mon, 07 Apr 2025 11:50:18 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 - string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s - the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_XwxqrCSfdyIkv4CL1xiQTutZ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must call the tool again and I will give you the answer.","tool_call_id":"call_XwxqrCSfdyIkv4CL1xiQTutZ"},{"role":"assistant","tool_calls":[{"id":"call_AWFco3BPGzSBKcrDSFtp2vMl","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must call the tool again and I will give you the answer.","tool_call_id":"call_AWFco3BPGzSBKcrDSFtp2vMl"},{"role":"user","content":"What''s - the weather in Berlin? (52.5200, 13.4050)"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets - the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia + Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. + Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"},{"role":"assistant","tool_calls":[{"id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_F0gbDJjAyfgsyVxKYR9k9JPY","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lashawn + Gerlach\", :score=>769}, {:title=>\"Sen. Carter Cummerata\", :score=>487}, + {:title=>\"Herman Brown\", :score=>766}], :next_page=>\"t3_abc123_198\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs"},{"role":"tool","content":"{:posts=>[{:title=>\"Pres. + Daron Wuckert\", :score=>727}, {:title=>\"Randy Hickle\", :score=>620}, {:title=>\"Elwood + Becker\", :score=>820}], :next_page=>\"t3_abc123_582\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_F0gbDJjAyfgsyVxKYR9k9JPY"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' @@ -276,7 +295,7 @@ http_interactions: message: OK headers: Date: - - Fri, 04 Apr 2025 12:55:27 GMT + - Mon, 07 Apr 2025 11:50:19 GMT Content-Type: - application/json Transfer-Encoding: @@ -288,7 +307,7 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '889' + - '964' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: @@ -298,11 +317,632 @@ http_interactions: X-Ratelimit-Remaining-Requests: - '9995' X-Ratelimit-Remaining-Tokens: - - '199942' + - '199790' + X-Ratelimit-Reset-Requests: + - 39.967s + X-Ratelimit-Reset-Tokens: + - 63ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BJfHWI3FCT7in1WfLTbxesV7VPwOw", + "object": "chat.completion", + "created": 1744026618, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_6z4JobRNAObALL5j7KfjZ0xo", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_mYxGVOPT78IZh99B0JpNscpr", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 412, + "completion_tokens": 42, + "total_tokens": 454, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_b376dfbbd5" + } + recorded_at: Mon, 07 Apr 2025 11:50:19 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia + Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. + Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"},{"role":"assistant","tool_calls":[{"id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_F0gbDJjAyfgsyVxKYR9k9JPY","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lashawn + Gerlach\", :score=>769}, {:title=>\"Sen. Carter Cummerata\", :score=>487}, + {:title=>\"Herman Brown\", :score=>766}], :next_page=>\"t3_abc123_198\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs"},{"role":"tool","content":"{:posts=>[{:title=>\"Pres. + Daron Wuckert\", :score=>727}, {:title=>\"Randy Hickle\", :score=>620}, {:title=>\"Elwood + Becker\", :score=>820}], :next_page=>\"t3_abc123_582\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_F0gbDJjAyfgsyVxKYR9k9JPY"},{"role":"assistant","tool_calls":[{"id":"call_6z4JobRNAObALL5j7KfjZ0xo","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mYxGVOPT78IZh99B0JpNscpr","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Julian + Stark IV\", :score=>923}, {:title=>\"Thaddeus Auer\", :score=>148}, {:title=>\"Yong + Lehner DO\", :score=>622}], :next_page=>\"t3_abc123_321\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_6z4JobRNAObALL5j7KfjZ0xo"},{"role":"tool","content":"{:posts=>[{:title=>\"Orville + Paucek\", :score=>640}, {:title=>\"Terrence Zieme\", :score=>425}, {:title=>\"Beulah + Casper\", :score=>476}], :next_page=>\"t3_abc123_613\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_mYxGVOPT78IZh99B0JpNscpr"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Apr 2025 11:50:21 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '1060' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '10000' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '9994' + X-Ratelimit-Remaining-Tokens: + - '199673' + X-Ratelimit-Reset-Requests: + - 47.338s + X-Ratelimit-Reset-Tokens: + - 97ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BJfHYu6WdLO5IVcQUXNJkaojVmELC", + "object": "chat.completion", + "created": 1744026620, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_qzjtQirXooD8SiLNGecmHxoa", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_OcXngJ6QDYjr6H7lOuQtILcC", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 615, + "completion_tokens": 42, + "total_tokens": 657, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_b376dfbbd5" + } + recorded_at: Mon, 07 Apr 2025 11:50:21 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia + Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. + Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"},{"role":"assistant","tool_calls":[{"id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_F0gbDJjAyfgsyVxKYR9k9JPY","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lashawn + Gerlach\", :score=>769}, {:title=>\"Sen. Carter Cummerata\", :score=>487}, + {:title=>\"Herman Brown\", :score=>766}], :next_page=>\"t3_abc123_198\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs"},{"role":"tool","content":"{:posts=>[{:title=>\"Pres. + Daron Wuckert\", :score=>727}, {:title=>\"Randy Hickle\", :score=>620}, {:title=>\"Elwood + Becker\", :score=>820}], :next_page=>\"t3_abc123_582\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_F0gbDJjAyfgsyVxKYR9k9JPY"},{"role":"assistant","tool_calls":[{"id":"call_6z4JobRNAObALL5j7KfjZ0xo","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mYxGVOPT78IZh99B0JpNscpr","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Julian + Stark IV\", :score=>923}, {:title=>\"Thaddeus Auer\", :score=>148}, {:title=>\"Yong + Lehner DO\", :score=>622}], :next_page=>\"t3_abc123_321\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_6z4JobRNAObALL5j7KfjZ0xo"},{"role":"tool","content":"{:posts=>[{:title=>\"Orville + Paucek\", :score=>640}, {:title=>\"Terrence Zieme\", :score=>425}, {:title=>\"Beulah + Casper\", :score=>476}], :next_page=>\"t3_abc123_613\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_mYxGVOPT78IZh99B0JpNscpr"},{"role":"assistant","tool_calls":[{"id":"call_qzjtQirXooD8SiLNGecmHxoa","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_OcXngJ6QDYjr6H7lOuQtILcC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Sharice + Satterfield\", :score=>613}, {:title=>\"Julietta Greenfelder\", :score=>388}, + {:title=>\"Addie Little\", :score=>16}], :next_page=>\"t3_abc123_500\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_qzjtQirXooD8SiLNGecmHxoa"},{"role":"tool","content":"{:posts=>[{:title=>\"Cesar + Rau\", :score=>942}, {:title=>\"May Schuster\", :score=>207}, {:title=>\"Miranda + O''Conner\", :score=>409}], :next_page=>\"t3_abc123_815\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_OcXngJ6QDYjr6H7lOuQtILcC"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Apr 2025 11:50:22 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '1108' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '10000' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '9993' + X-Ratelimit-Remaining-Tokens: + - '199557' + X-Ratelimit-Reset-Requests: + - 54.618s + X-Ratelimit-Reset-Tokens: + - 132ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BJfHZMvWvzhRpz2Y5HpT8U60CR8Mb", + "object": "chat.completion", + "created": 1744026621, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_vUBH7tVPWqSP1PKTR2uHFxD7", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_xenaDJKczSffSzomAtU5VB9P", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 817, + "completion_tokens": 42, + "total_tokens": 859, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_b376dfbbd5" + } + recorded_at: Mon, 07 Apr 2025 11:50:22 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia + Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. + Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"},{"role":"assistant","tool_calls":[{"id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_F0gbDJjAyfgsyVxKYR9k9JPY","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lashawn + Gerlach\", :score=>769}, {:title=>\"Sen. Carter Cummerata\", :score=>487}, + {:title=>\"Herman Brown\", :score=>766}], :next_page=>\"t3_abc123_198\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs"},{"role":"tool","content":"{:posts=>[{:title=>\"Pres. + Daron Wuckert\", :score=>727}, {:title=>\"Randy Hickle\", :score=>620}, {:title=>\"Elwood + Becker\", :score=>820}], :next_page=>\"t3_abc123_582\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_F0gbDJjAyfgsyVxKYR9k9JPY"},{"role":"assistant","tool_calls":[{"id":"call_6z4JobRNAObALL5j7KfjZ0xo","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mYxGVOPT78IZh99B0JpNscpr","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Julian + Stark IV\", :score=>923}, {:title=>\"Thaddeus Auer\", :score=>148}, {:title=>\"Yong + Lehner DO\", :score=>622}], :next_page=>\"t3_abc123_321\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_6z4JobRNAObALL5j7KfjZ0xo"},{"role":"tool","content":"{:posts=>[{:title=>\"Orville + Paucek\", :score=>640}, {:title=>\"Terrence Zieme\", :score=>425}, {:title=>\"Beulah + Casper\", :score=>476}], :next_page=>\"t3_abc123_613\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_mYxGVOPT78IZh99B0JpNscpr"},{"role":"assistant","tool_calls":[{"id":"call_qzjtQirXooD8SiLNGecmHxoa","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_OcXngJ6QDYjr6H7lOuQtILcC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Sharice + Satterfield\", :score=>613}, {:title=>\"Julietta Greenfelder\", :score=>388}, + {:title=>\"Addie Little\", :score=>16}], :next_page=>\"t3_abc123_500\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_qzjtQirXooD8SiLNGecmHxoa"},{"role":"tool","content":"{:posts=>[{:title=>\"Cesar + Rau\", :score=>942}, {:title=>\"May Schuster\", :score=>207}, {:title=>\"Miranda + O''Conner\", :score=>409}], :next_page=>\"t3_abc123_815\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_OcXngJ6QDYjr6H7lOuQtILcC"},{"role":"assistant","tool_calls":[{"id":"call_vUBH7tVPWqSP1PKTR2uHFxD7","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_xenaDJKczSffSzomAtU5VB9P","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Leslie + Zulauf\", :score=>600}, {:title=>\"Andrew Lind\", :score=>421}, {:title=>\"Fernande + Kub\", :score=>715}], :next_page=>\"t3_abc123_634\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_vUBH7tVPWqSP1PKTR2uHFxD7"},{"role":"tool","content":"{:posts=>[{:title=>\"Ms. + Dewayne Stiedemann\", :score=>130}, {:title=>\"Hung Donnelly Sr.\", :score=>7}, + {:title=>\"Imogene Keeling\", :score=>425}], :next_page=>\"t3_abc123_896\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_xenaDJKczSffSzomAtU5VB9P"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Apr 2025 11:50:24 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '1141' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '10000' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '9992' + X-Ratelimit-Remaining-Tokens: + - '199438' + X-Ratelimit-Reset-Requests: + - 1m1.833s + X-Ratelimit-Reset-Tokens: + - 168ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BJfHal5hqHoOExtmnzdhwi3nDEWwq", + "object": "chat.completion", + "created": 1744026622, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_tACrL1BU8hquSfphg34WPuCw", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_oNI0QAIyqOeAOdRd2XYkqkIM", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 1020, + "completion_tokens": 42, + "total_tokens": 1062, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_b376dfbbd5" + } + recorded_at: Mon, 07 Apr 2025 11:50:24 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia + Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. + Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"},{"role":"assistant","tool_calls":[{"id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_F0gbDJjAyfgsyVxKYR9k9JPY","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lashawn + Gerlach\", :score=>769}, {:title=>\"Sen. Carter Cummerata\", :score=>487}, + {:title=>\"Herman Brown\", :score=>766}], :next_page=>\"t3_abc123_198\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs"},{"role":"tool","content":"{:posts=>[{:title=>\"Pres. + Daron Wuckert\", :score=>727}, {:title=>\"Randy Hickle\", :score=>620}, {:title=>\"Elwood + Becker\", :score=>820}], :next_page=>\"t3_abc123_582\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_F0gbDJjAyfgsyVxKYR9k9JPY"},{"role":"assistant","tool_calls":[{"id":"call_6z4JobRNAObALL5j7KfjZ0xo","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mYxGVOPT78IZh99B0JpNscpr","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Julian + Stark IV\", :score=>923}, {:title=>\"Thaddeus Auer\", :score=>148}, {:title=>\"Yong + Lehner DO\", :score=>622}], :next_page=>\"t3_abc123_321\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_6z4JobRNAObALL5j7KfjZ0xo"},{"role":"tool","content":"{:posts=>[{:title=>\"Orville + Paucek\", :score=>640}, {:title=>\"Terrence Zieme\", :score=>425}, {:title=>\"Beulah + Casper\", :score=>476}], :next_page=>\"t3_abc123_613\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_mYxGVOPT78IZh99B0JpNscpr"},{"role":"assistant","tool_calls":[{"id":"call_qzjtQirXooD8SiLNGecmHxoa","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_OcXngJ6QDYjr6H7lOuQtILcC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Sharice + Satterfield\", :score=>613}, {:title=>\"Julietta Greenfelder\", :score=>388}, + {:title=>\"Addie Little\", :score=>16}], :next_page=>\"t3_abc123_500\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_qzjtQirXooD8SiLNGecmHxoa"},{"role":"tool","content":"{:posts=>[{:title=>\"Cesar + Rau\", :score=>942}, {:title=>\"May Schuster\", :score=>207}, {:title=>\"Miranda + O''Conner\", :score=>409}], :next_page=>\"t3_abc123_815\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_OcXngJ6QDYjr6H7lOuQtILcC"},{"role":"assistant","tool_calls":[{"id":"call_vUBH7tVPWqSP1PKTR2uHFxD7","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_xenaDJKczSffSzomAtU5VB9P","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Leslie + Zulauf\", :score=>600}, {:title=>\"Andrew Lind\", :score=>421}, {:title=>\"Fernande + Kub\", :score=>715}], :next_page=>\"t3_abc123_634\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_vUBH7tVPWqSP1PKTR2uHFxD7"},{"role":"tool","content":"{:posts=>[{:title=>\"Ms. + Dewayne Stiedemann\", :score=>130}, {:title=>\"Hung Donnelly Sr.\", :score=>7}, + {:title=>\"Imogene Keeling\", :score=>425}], :next_page=>\"t3_abc123_896\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_xenaDJKczSffSzomAtU5VB9P"},{"role":"assistant","tool_calls":[{"id":"call_tACrL1BU8hquSfphg34WPuCw","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_oNI0QAIyqOeAOdRd2XYkqkIM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Felix + Wehner DO\", :score=>419}, {:title=>\"Adam Boehm\", :score=>244}, {:title=>\"Bettina + Langosh\", :score=>393}], :next_page=>\"t3_abc123_77\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_tACrL1BU8hquSfphg34WPuCw"},{"role":"tool","content":"{:posts=>[{:title=>\"Love + Simonis\", :score=>642}, {:title=>\"Adriana Schimmel\", :score=>309}, {:title=>\"Bradford + Emmerich\", :score=>608}], :next_page=>\"t3_abc123_261\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_oNI0QAIyqOeAOdRd2XYkqkIM"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Apr 2025 11:50:25 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '919' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '10000' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '9992' + X-Ratelimit-Remaining-Tokens: + - '199310' X-Ratelimit-Reset-Requests: - - 35.05s + - 1m8.949s X-Ratelimit-Reset-Tokens: - - 17ms + - 207ms X-Request-Id: - "" Strict-Transport-Security: @@ -324,9 +964,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BIaruHnGqHLxosvsOplFGgqVgQvup", + "id": "chatcmpl-BJfHcVusye744kJxxss68Bd1M7B7v", "object": "chat.completion", - "created": 1743771326, + "created": 1744026624, "model": "gpt-4o-mini-2024-07-18", "choices": [ { @@ -336,7 +976,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_fOhMhp0EbssTNwwOMGSrGnPh", + "id": "call_Q43Bgsf9kORBbam1KxFP7Zmb", "type": "function", "function": { "name": "weather", @@ -352,9 +992,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 182, + "prompt_tokens": 1247, "completion_tokens": 24, - "total_tokens": 206, + "total_tokens": 1271, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -369,19 +1009,51 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_b376dfbbd5" } - recorded_at: Fri, 04 Apr 2025 12:55:27 GMT + recorded_at: Mon, 07 Apr 2025 11:50:25 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 - string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"What''s - the best language to learn?"},{"role":"assistant","tool_calls":[{"id":"call_XwxqrCSfdyIkv4CL1xiQTutZ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must call the tool again and I will give you the answer.","tool_call_id":"call_XwxqrCSfdyIkv4CL1xiQTutZ"},{"role":"assistant","tool_calls":[{"id":"call_AWFco3BPGzSBKcrDSFtp2vMl","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"You - must call the tool again and I will give you the answer.","tool_call_id":"call_AWFco3BPGzSBKcrDSFtp2vMl"},{"role":"user","content":"What''s - the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","tool_calls":[{"id":"call_fOhMhp0EbssTNwwOMGSrGnPh","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current - weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"call_fOhMhp0EbssTNwwOMGSrGnPh"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Gets - the best language to learn","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia + Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. + Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"},{"role":"assistant","tool_calls":[{"id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_F0gbDJjAyfgsyVxKYR9k9JPY","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lashawn + Gerlach\", :score=>769}, {:title=>\"Sen. Carter Cummerata\", :score=>487}, + {:title=>\"Herman Brown\", :score=>766}], :next_page=>\"t3_abc123_198\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs"},{"role":"tool","content":"{:posts=>[{:title=>\"Pres. + Daron Wuckert\", :score=>727}, {:title=>\"Randy Hickle\", :score=>620}, {:title=>\"Elwood + Becker\", :score=>820}], :next_page=>\"t3_abc123_582\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_F0gbDJjAyfgsyVxKYR9k9JPY"},{"role":"assistant","tool_calls":[{"id":"call_6z4JobRNAObALL5j7KfjZ0xo","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mYxGVOPT78IZh99B0JpNscpr","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Julian + Stark IV\", :score=>923}, {:title=>\"Thaddeus Auer\", :score=>148}, {:title=>\"Yong + Lehner DO\", :score=>622}], :next_page=>\"t3_abc123_321\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_6z4JobRNAObALL5j7KfjZ0xo"},{"role":"tool","content":"{:posts=>[{:title=>\"Orville + Paucek\", :score=>640}, {:title=>\"Terrence Zieme\", :score=>425}, {:title=>\"Beulah + Casper\", :score=>476}], :next_page=>\"t3_abc123_613\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_mYxGVOPT78IZh99B0JpNscpr"},{"role":"assistant","tool_calls":[{"id":"call_qzjtQirXooD8SiLNGecmHxoa","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_OcXngJ6QDYjr6H7lOuQtILcC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Sharice + Satterfield\", :score=>613}, {:title=>\"Julietta Greenfelder\", :score=>388}, + {:title=>\"Addie Little\", :score=>16}], :next_page=>\"t3_abc123_500\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_qzjtQirXooD8SiLNGecmHxoa"},{"role":"tool","content":"{:posts=>[{:title=>\"Cesar + Rau\", :score=>942}, {:title=>\"May Schuster\", :score=>207}, {:title=>\"Miranda + O''Conner\", :score=>409}], :next_page=>\"t3_abc123_815\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_OcXngJ6QDYjr6H7lOuQtILcC"},{"role":"assistant","tool_calls":[{"id":"call_vUBH7tVPWqSP1PKTR2uHFxD7","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_xenaDJKczSffSzomAtU5VB9P","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Leslie + Zulauf\", :score=>600}, {:title=>\"Andrew Lind\", :score=>421}, {:title=>\"Fernande + Kub\", :score=>715}], :next_page=>\"t3_abc123_634\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_vUBH7tVPWqSP1PKTR2uHFxD7"},{"role":"tool","content":"{:posts=>[{:title=>\"Ms. + Dewayne Stiedemann\", :score=>130}, {:title=>\"Hung Donnelly Sr.\", :score=>7}, + {:title=>\"Imogene Keeling\", :score=>425}], :next_page=>\"t3_abc123_896\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_xenaDJKczSffSzomAtU5VB9P"},{"role":"assistant","tool_calls":[{"id":"call_tACrL1BU8hquSfphg34WPuCw","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_oNI0QAIyqOeAOdRd2XYkqkIM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Felix + Wehner DO\", :score=>419}, {:title=>\"Adam Boehm\", :score=>244}, {:title=>\"Bettina + Langosh\", :score=>393}], :next_page=>\"t3_abc123_77\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_tACrL1BU8hquSfphg34WPuCw"},{"role":"tool","content":"{:posts=>[{:title=>\"Love + Simonis\", :score=>642}, {:title=>\"Adriana Schimmel\", :score=>309}, {:title=>\"Bradford + Emmerich\", :score=>608}], :next_page=>\"t3_abc123_261\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_oNI0QAIyqOeAOdRd2XYkqkIM"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","tool_calls":[{"id":"call_Q43Bgsf9kORBbam1KxFP7Zmb","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"call_Q43Bgsf9kORBbam1KxFP7Zmb"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' @@ -402,7 +1074,7 @@ http_interactions: message: OK headers: Date: - - Fri, 04 Apr 2025 12:55:28 GMT + - Mon, 07 Apr 2025 11:50:26 GMT Content-Type: - application/json Transfer-Encoding: @@ -414,7 +1086,7 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '823' + - '1030' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: @@ -422,13 +1094,13 @@ http_interactions: X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9995' + - '9991' X-Ratelimit-Remaining-Tokens: - - '199926' + - '199292' X-Ratelimit-Reset-Requests: - - 42.494s + - 1m16.365s X-Ratelimit-Reset-Tokens: - - 22ms + - 212ms X-Request-Id: - "" Strict-Transport-Security: @@ -449,6 +1121,6 @@ http_interactions: body: encoding: ASCII-8BIT string: !binary |- - ewogICJpZCI6ICJjaGF0Y21wbC1CSWFydk9sTGRzUlNhR29yQUhZZnp1dUEybkxpZCIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0Mzc3MTMyNywKICAibW9kZWwiOiAiZ3B0LTRvLW1pbmktMjAyNC0wNy0xOCIsCiAgImNob2ljZXMiOiBbCiAgICB7CiAgICAgICJpbmRleCI6IDAsCiAgICAgICJtZXNzYWdlIjogewogICAgICAgICJyb2xlIjogImFzc2lzdGFudCIsCiAgICAgICAgImNvbnRlbnQiOiAiVGhlIGN1cnJlbnQgd2VhdGhlciBpbiBCZXJsaW4gaXMgMTXCsEMgd2l0aCBhIHdpbmQgc3BlZWQgb2YgMTAga20vaC4iLAogICAgICAgICJyZWZ1c2FsIjogbnVsbCwKICAgICAgICAiYW5ub3RhdGlvbnMiOiBbXQogICAgICB9LAogICAgICAibG9ncHJvYnMiOiBudWxsLAogICAgICAiZmluaXNoX3JlYXNvbiI6ICJzdG9wIgogICAgfQogIF0sCiAgInVzYWdlIjogewogICAgInByb21wdF90b2tlbnMiOiAyMzcsCiAgICAiY29tcGxldGlvbl90b2tlbnMiOiAyMSwKICAgICJ0b3RhbF90b2tlbnMiOiAyNTgsCiAgICAicHJvbXB0X3Rva2Vuc19kZXRhaWxzIjogewogICAgICAiY2FjaGVkX3Rva2VucyI6IDAsCiAgICAgICJhdWRpb190b2tlbnMiOiAwCiAgICB9LAogICAgImNvbXBsZXRpb25fdG9rZW5zX2RldGFpbHMiOiB7CiAgICAgICJyZWFzb25pbmdfdG9rZW5zIjogMCwKICAgICAgImF1ZGlvX3Rva2VucyI6IDAsCiAgICAgICJhY2NlcHRlZF9wcmVkaWN0aW9uX3Rva2VucyI6IDAsCiAgICAgICJyZWplY3RlZF9wcmVkaWN0aW9uX3Rva2VucyI6IDAKICAgIH0KICB9LAogICJzZXJ2aWNlX3RpZXIiOiAiZGVmYXVsdCIsCiAgInN5c3RlbV9maW5nZXJwcmludCI6ICJmcF9iMzc2ZGZiYmQ1Igp9Cg== - recorded_at: Fri, 04 Apr 2025 12:55:28 GMT + ewogICJpZCI6ICJjaGF0Y21wbC1CSmZIZElHRzVkd0owR3J5V01pOWhCT3FObThPeSIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0NDAyNjYyNSwKICAibW9kZWwiOiAiZ3B0LTRvLW1pbmktMjAyNC0wNy0xOCIsCiAgImNob2ljZXMiOiBbCiAgICB7CiAgICAgICJpbmRleCI6IDAsCiAgICAgICJtZXNzYWdlIjogewogICAgICAgICJyb2xlIjogImFzc2lzdGFudCIsCiAgICAgICAgImNvbnRlbnQiOiAiVGhlIGN1cnJlbnQgd2VhdGhlciBpbiBCZXJsaW4gaXMgMTXCsEMgd2l0aCBhIHdpbmQgc3BlZWQgb2YgMTAga20vaC4iLAogICAgICAgICJyZWZ1c2FsIjogbnVsbCwKICAgICAgICAiYW5ub3RhdGlvbnMiOiBbXQogICAgICB9LAogICAgICAibG9ncHJvYnMiOiBudWxsLAogICAgICAiZmluaXNoX3JlYXNvbiI6ICJzdG9wIgogICAgfQogIF0sCiAgInVzYWdlIjogewogICAgInByb21wdF90b2tlbnMiOiAxMzAyLAogICAgImNvbXBsZXRpb25fdG9rZW5zIjogMjEsCiAgICAidG90YWxfdG9rZW5zIjogMTMyMywKICAgICJwcm9tcHRfdG9rZW5zX2RldGFpbHMiOiB7CiAgICAgICJjYWNoZWRfdG9rZW5zIjogMTAyNCwKICAgICAgImF1ZGlvX3Rva2VucyI6IDAKICAgIH0sCiAgICAiY29tcGxldGlvbl90b2tlbnNfZGV0YWlscyI6IHsKICAgICAgInJlYXNvbmluZ190b2tlbnMiOiAwLAogICAgICAiYXVkaW9fdG9rZW5zIjogMCwKICAgICAgImFjY2VwdGVkX3ByZWRpY3Rpb25fdG9rZW5zIjogMCwKICAgICAgInJlamVjdGVkX3ByZWRpY3Rpb25fdG9rZW5zIjogMAogICAgfQogIH0sCiAgInNlcnZpY2VfdGllciI6ICJkZWZhdWx0IiwKICAic3lzdGVtX2ZpbmdlcnByaW50IjogImZwX2IzNzZkZmJiZDUiCn0K + recorded_at: Mon, 07 Apr 2025 11:50:26 GMT recorded_with: VCR 6.3.1 diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index 0afee7c0..561dac9d 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -33,7 +33,16 @@ class LoopingAnswer < RubyLLM::Tool # rubocop:disable Lint/ConstantDefinitionInB description 'Gets the best language to learn' def execute - 'You must call the tool again and I will give you the answer.' + # Fake some posts encouraging fetching the next page + { + posts: [ + { title: Faker::Name.name, score: rand(1000) }, + { title: Faker::Name.name, score: rand(1000) }, + { title: Faker::Name.name, score: rand(1000) } + ], + next_page: "t3_abc123_#{rand(1000)}", + message: "More posts are available using the next_page token." + } end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 25be7c86..98a6cf3e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -23,6 +23,7 @@ require 'fileutils' require 'ruby_llm' require 'webmock/rspec' +require 'faker' # VCR Configuration VCR.configure do |config| From 7885c4b15458497ef70aeca43e097d6509ce46c7 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Mon, 7 Apr 2025 22:02:17 +1000 Subject: [PATCH 10/26] docs: correct docs after changing naming/strategy --- docs/guides/tools.md | 7 ++++--- spec/ruby_llm/chat_tools_spec.rb | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/guides/tools.md b/docs/guides/tools.md index 5c4de1b1..a315d317 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -243,10 +243,10 @@ When including tools it is important to consider if the response could trigger u This can be performed on a per chat basis or provided in the global configuration. ```ruby -# Set a maximum number of tool calls per conversation +# Set a maximum number of tool completions per instantiated chat object chat = RubyLLM.chat(max_tool_completions: 5) chat.ask "Question that triggers tools loop" -# => `execute_tool': Tool calls limit reached: 5 (RubyLLM::ToolCallsLimitReachedError) +# => `execute_tool': Tool completions limit reached: 5 (RubyLLM::ToolCallsLimitReachedError) ``` If you wish to remove this safe-guard you can set the max_tool_completions to `nil`. @@ -258,7 +258,7 @@ chat.ask "Question that triggers tools loop" ### Global Configuration -You can set a default maximum tool calls limit for all chats through the global configuration: +You can set a default maximum tool completion limit for all chats through the global configuration: ```ruby RubyLLM.configure do |config| @@ -281,6 +281,7 @@ When implementing tools that process user input (via the AI): * Avoid using `eval`, `system` or similar methods with unsanitized input * Remember that AI models might be tricked into producing dangerous inputs * Validate all inputs and use appropriate sanitization +* Ensure protection against Cost-based Denial of Service from malicious input, particularly when used in conjunction with tool completions if you remove the default limit ## When to Use Tools diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index 561dac9d..fe4bcb4f 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -30,7 +30,7 @@ def execute end class LoopingAnswer < RubyLLM::Tool # rubocop:disable Lint/ConstantDefinitionInBlock,RSpec/LeakyConstantDeclaration - description 'Gets the best language to learn' + description 'Fetches posts from the r/RandomNames Reddit community.' def execute # Fake some posts encouraging fetching the next page @@ -102,11 +102,11 @@ def execute end it "#{model} can use tools with a tool completions limit" do - chat = RubyLLM.chat(model: model, max_tool_completions: 1) + chat = RubyLLM.chat(model: model, max_tool_completions: 5) .with_tools(LoopingAnswer, Weather) expect do - chat.ask("What's the best language to learn?") + chat.ask("Fetch all of the posts from r/RandomNames. Fetch the next_page listed in the response until it responds with an empty array") end.to raise_error(RubyLLM::ToolCallsLimitReachedError) # Ensure it does not break the next ask. From df2698831a57d523fd4fe17084668d0fdfccf47c Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Mon, 7 Apr 2025 22:08:53 +1000 Subject: [PATCH 11/26] docs: add default to docs --- docs/guides/tools.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/tools.md b/docs/guides/tools.md index abc763f3..e8224107 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -294,7 +294,7 @@ end ## Maximum Tool Completion Limiting -When including tools it is important to consider if the response could trigger unintended recursive calls to the provider. RubyLLM provides built-in protection by providing a default limit, which can be overridden or turned off entirely. +When including tools it is important to consider if the response could trigger unintended recursive calls to the provider. RubyLLM provides built-in protection by providing a default limit of 25, which can be overridden or turned off entirely. This can be performed on a per chat basis or provided in the global configuration. From 19c0cd16924334047378138907c0d8c18f316c09 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Mon, 7 Apr 2025 22:12:39 +1000 Subject: [PATCH 12/26] chore: rename error to match new naming --- docs/guides/tools.md | 2 +- lib/ruby_llm/chat.rb | 2 +- lib/ruby_llm/error.rb | 2 +- spec/ruby_llm/chat_tools_spec.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/guides/tools.md b/docs/guides/tools.md index e8224107..d744d34e 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -302,7 +302,7 @@ This can be performed on a per chat basis or provided in the global configuratio # Set a maximum number of tool completions per instantiated chat object chat = RubyLLM.chat(max_tool_completions: 5) chat.ask "Question that triggers tools loop" -# => `execute_tool': Tool completions limit reached: 5 (RubyLLM::ToolCallsLimitReachedError) +# => `execute_tool': Tool completions limit reached: 5 (RubyLLM::ToolCallCompletionsReachedError) ``` If you wish to remove this safe-guard you can set the max_tool_completions to `nil`. diff --git a/lib/ruby_llm/chat.rb b/lib/ruby_llm/chat.rb index eddd8cd2..bc7186d5 100644 --- a/lib/ruby_llm/chat.rb +++ b/lib/ruby_llm/chat.rb @@ -113,7 +113,7 @@ def handle_tool_calls(response, &) end if max_tool_completions_reached? - raise ToolCallsLimitReachedError, "Tool completions limit reached: #{@max_tool_completions}" + raise ToolCallCompletionsLimitReachedError, "Tool completions limit reached: #{@max_tool_completions}" end @number_of_tool_completions += 1 diff --git a/lib/ruby_llm/error.rb b/lib/ruby_llm/error.rb index 5e1748ed..30522fe9 100644 --- a/lib/ruby_llm/error.rb +++ b/lib/ruby_llm/error.rb @@ -24,7 +24,7 @@ class ConfigurationError < StandardError; end class InvalidRoleError < StandardError; end class ModelNotFoundError < StandardError; end class UnsupportedFunctionsError < StandardError; end - class ToolCallsLimitReachedError < StandardError; end + class ToolCallCompletionsLimitReachedError < StandardError; end # Error classes for different HTTP status codes class BadRequestError < Error; end diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index d9372506..593ad380 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -136,7 +136,7 @@ def execute expect do chat.ask("Fetch all of the posts from r/RandomNames. Fetch the next_page listed in the response until it responds with an empty array") - end.to raise_error(RubyLLM::ToolCallsLimitReachedError) + end.to raise_error(RubyLLM::ToolCallCompletionsLimitReachedError) # Ensure it does not break the next ask. next_response = chat.ask("What's the weather in Berlin? (52.5200, 13.4050)") From d94d6ddf040abaf18c0be4946ff2d9e09b10b674 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Thu, 24 Apr 2025 21:27:55 +1000 Subject: [PATCH 13/26] chore: reorder configuration accessor and add comment --- lib/ruby_llm/configuration.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ruby_llm/configuration.rb b/lib/ruby_llm/configuration.rb index 01479268..3714b851 100644 --- a/lib/ruby_llm/configuration.rb +++ b/lib/ruby_llm/configuration.rb @@ -22,6 +22,8 @@ class Configuration :bedrock_session_token, :openrouter_api_key, :ollama_api_base, + # Default tool configuration + :max_tool_completions, # Default models :default_model, :default_embedding_model, @@ -29,7 +31,6 @@ class Configuration # Connection configuration :request_timeout, :max_retries, - :max_tool_completions, :retry_interval, :retry_backoff_factor, :retry_interval_randomness From 71dba53b16edb8bbf900e3431c6fe4db0384cae4 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Thu, 24 Apr 2025 21:54:04 +1000 Subject: [PATCH 14/26] style: cops - disable / fix --- Gemfile | 2 +- lib/ruby_llm/chat.rb | 13 +++++++++---- spec/ruby_llm/chat_tools_spec.rb | 12 ++++++++---- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index ba7450e4..5d154006 100644 --- a/Gemfile +++ b/Gemfile @@ -32,4 +32,4 @@ group :development do gem 'vcr' gem 'webmock', '~> 3.18' gem 'yard', '>= 0.9' -end \ No newline at end of file +end diff --git a/lib/ruby_llm/chat.rb b/lib/ruby_llm/chat.rb index bf4df601..d4e7474f 100644 --- a/lib/ruby_llm/chat.rb +++ b/lib/ruby_llm/chat.rb @@ -29,13 +29,13 @@ def initialize(model: nil, provider: nil, assume_model_exists: false, context: n new_message: nil, end_message: nil } - @max_tool_completions = max_tool_completions + @max_tool_completions = config.max_tool_completions @number_of_tool_completions = 0 end - def ask(message = nil, with: {}, &block) + def ask(message = nil, with: {}, &) @number_of_tool_completions = 0 - + add_message role: :user, content: Content.new(message, with) complete(&) end @@ -64,6 +64,11 @@ def with_tools(*tools) self end + def with_max_tool_completions(max_tool_completions) + @max_tool_completions = max_tool_completions + self + end + def with_model(model_id, provider: nil, assume_exists: false) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength assume_exists = true if provider && Provider.providers[provider.to_sym].local? @@ -128,7 +133,7 @@ def add_message(message_or_attributes) private - def handle_tool_calls(response, &) + def handle_tool_calls(response, &) # rubocop:disable Metrics/MethodLength response.tool_calls.each_value do |tool_call| @on[:new_message]&.call result = execute_tool tool_call diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index 8ebf4498..ab276611 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -35,7 +35,7 @@ def execute { title: Faker::Name.name, score: rand(1000) } ], next_page: "t3_abc123_#{rand(1000)}", - message: "More posts are available using the next_page token." + message: 'More posts are available using the next_page token.' } end end @@ -146,12 +146,16 @@ def execute expect(response.content).to include('10') end - it "#{model} can use tools with a tool completions limit" do - chat = RubyLLM.chat(model: model, max_tool_completions: 5) + it "#{model} can use tools with a tool completions limit" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations + chat = RubyLLM.chat(model: model) + .with_max_tool_completions(5) .with_tools(LoopingAnswer, Weather) expect do - chat.ask("Fetch all of the posts from r/RandomNames. Fetch the next_page listed in the response until it responds with an empty array") + chat.ask( + 'Fetch all of the posts from r/RandomNames. ' \ + 'Fetch the next_page listed in the response until it responds with an empty array' + ) end.to raise_error(RubyLLM::ToolCallCompletionsLimitReachedError) # Ensure it does not break the next ask. From 6455f080c6d61118b129b3cc192161275c626cfb Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Thu, 24 Apr 2025 22:13:36 +1000 Subject: [PATCH 15/26] test: add spec for configured limit --- ...th_a_configured_tool_completions_limit.yml | 786 +++++++++++ ...h_a_configured_tool_completions_limit.yml} | 581 +++++---- ...se_tools_with_a_tool_completions_limit.yml | 1155 +++++++++++++++++ spec/ruby_llm/chat_tools_spec.rb | 21 + 4 files changed, 2267 insertions(+), 276 deletions(-) create mode 100644 spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_configured_tool_completions_limit.yml rename spec/fixtures/vcr_cassettes/{chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_completions_limit.yml => chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_tool_completions_limit.yml} (56%) create mode 100644 spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_completions_limit.yml diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_configured_tool_completions_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_configured_tool_completions_limit.yml new file mode 100644 index 00000000..ef404205 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_configured_tool_completions_limit.yml @@ -0,0 +1,786 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 12:09:33 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-24T12:09:32Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-24T12:09:33Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-24T12:09:30Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-24T12:09:32Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_014XS6Nk5ruJKvCnE3Ngd2o3","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by repeatedly calling the + `looping_answer` function until we receive an empty array. Here''s how we''ll + do it:"},{"type":"tool_use","id":"toolu_017Nr3y43V1gyPgAHrFsvKji","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":450,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":77}}' + recorded_at: Thu, 24 Apr 2025 12:09:33 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by repeatedly calling the + `looping_answer` function until we receive an empty array. Here''s how we''ll + do it:"},{"type":"tool_use","id":"toolu_017Nr3y43V1gyPgAHrFsvKji","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_017Nr3y43V1gyPgAHrFsvKji","content":"{:posts=>[{:title=>\"Christel + Stehr\", :score=>101}, {:title=>\"Mrs. Roxana D''Amore\", :score=>571}, {:title=>\"Miss + Desirae Kris\", :score=>929}], :next_page=>\"t3_abc123_365\", :message=>\"More + posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 12:09:36 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-24T12:09:35Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-24T12:09:36Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-24T12:09:35Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-24T12:09:35Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01BWUa8rG7ccBeSdxcWxByLn","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I + see there are more posts available. I''ll continue fetching with the next_page + token:"},{"type":"tool_use","id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":627,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":59}}' + recorded_at: Thu, 24 Apr 2025 12:09:36 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by repeatedly calling the + `looping_answer` function until we receive an empty array. Here''s how we''ll + do it:"},{"type":"tool_use","id":"toolu_017Nr3y43V1gyPgAHrFsvKji","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_017Nr3y43V1gyPgAHrFsvKji","content":"{:posts=>[{:title=>\"Christel + Stehr\", :score=>101}, {:title=>\"Mrs. Roxana D''Amore\", :score=>571}, {:title=>\"Miss + Desirae Kris\", :score=>929}], :next_page=>\"t3_abc123_365\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see there are more posts available. I''ll continue fetching with the next_page + token:"},{"type":"tool_use","id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","content":"{:posts=>[{:title=>\"Sharita + Ziemann\", :score=>417}, {:title=>\"Ervin Wilkinson I\", :score=>261}, {:title=>\"Johnathan + Rohan Esq.\", :score=>425}], :next_page=>\"t3_abc123_384\", :message=>\"More + posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 12:09:41 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-24T12:09:40Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-24T12:09:41Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-24T12:09:38Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-24T12:09:40Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01BduqXqqkeg55JTNvHpKvhb","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_0151hgmrEfJ2j8X9AcYSku7V","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":784,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":45}}' + recorded_at: Thu, 24 Apr 2025 12:09:41 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by repeatedly calling the + `looping_answer` function until we receive an empty array. Here''s how we''ll + do it:"},{"type":"tool_use","id":"toolu_017Nr3y43V1gyPgAHrFsvKji","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_017Nr3y43V1gyPgAHrFsvKji","content":"{:posts=>[{:title=>\"Christel + Stehr\", :score=>101}, {:title=>\"Mrs. Roxana D''Amore\", :score=>571}, {:title=>\"Miss + Desirae Kris\", :score=>929}], :next_page=>\"t3_abc123_365\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see there are more posts available. I''ll continue fetching with the next_page + token:"},{"type":"tool_use","id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","content":"{:posts=>[{:title=>\"Sharita + Ziemann\", :score=>417}, {:title=>\"Ervin Wilkinson I\", :score=>261}, {:title=>\"Johnathan + Rohan Esq.\", :score=>425}], :next_page=>\"t3_abc123_384\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_0151hgmrEfJ2j8X9AcYSku7V","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_0151hgmrEfJ2j8X9AcYSku7V","content":"{:posts=>[{:title=>\"Brittni + Torp\", :score=>576}, {:title=>\"Kathe Wiza\", :score=>718}, {:title=>\"Margarett + Cole\", :score=>591}], :next_page=>\"t3_abc123_69\", :message=>\"More posts + are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 12:09:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-24T12:09:44Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-24T12:09:44Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-24T12:09:42Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-24T12:09:44Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01YTpUCWG9Pj1QMBjsJAbobM","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + fetch again:"},{"type":"tool_use","id":"toolu_016F7k3i4NEQw31KaKgL5Xzh","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":921,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":44}}' + recorded_at: Thu, 24 Apr 2025 12:09:44 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by repeatedly calling the + `looping_answer` function until we receive an empty array. Here''s how we''ll + do it:"},{"type":"tool_use","id":"toolu_017Nr3y43V1gyPgAHrFsvKji","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_017Nr3y43V1gyPgAHrFsvKji","content":"{:posts=>[{:title=>\"Christel + Stehr\", :score=>101}, {:title=>\"Mrs. Roxana D''Amore\", :score=>571}, {:title=>\"Miss + Desirae Kris\", :score=>929}], :next_page=>\"t3_abc123_365\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see there are more posts available. I''ll continue fetching with the next_page + token:"},{"type":"tool_use","id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","content":"{:posts=>[{:title=>\"Sharita + Ziemann\", :score=>417}, {:title=>\"Ervin Wilkinson I\", :score=>261}, {:title=>\"Johnathan + Rohan Esq.\", :score=>425}], :next_page=>\"t3_abc123_384\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_0151hgmrEfJ2j8X9AcYSku7V","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_0151hgmrEfJ2j8X9AcYSku7V","content":"{:posts=>[{:title=>\"Brittni + Torp\", :score=>576}, {:title=>\"Kathe Wiza\", :score=>718}, {:title=>\"Margarett + Cole\", :score=>591}], :next_page=>\"t3_abc123_69\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch again:"},{"type":"tool_use","id":"toolu_016F7k3i4NEQw31KaKgL5Xzh","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_016F7k3i4NEQw31KaKgL5Xzh","content":"{:posts=>[{:title=>\"Ivan + Tremblay\", :score=>806}, {:title=>\"Shantay Hermann JD\", :score=>94}, {:title=>\"Tawnya + Barton\", :score=>797}], :next_page=>\"t3_abc123_451\", :message=>\"More posts + are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 12:09:46 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-24T12:09:46Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-24T12:09:46Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-24T12:09:46Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-24T12:09:46Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_013y76EZh1F4K5LngpSYedWT","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + fetch one more time:"},{"type":"tool_use","id":"toolu_015zUxXzMQLsoHC4tK8FqncT","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1060,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":46}}' + recorded_at: Thu, 24 Apr 2025 12:09:46 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by repeatedly calling the + `looping_answer` function until we receive an empty array. Here''s how we''ll + do it:"},{"type":"tool_use","id":"toolu_017Nr3y43V1gyPgAHrFsvKji","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_017Nr3y43V1gyPgAHrFsvKji","content":"{:posts=>[{:title=>\"Christel + Stehr\", :score=>101}, {:title=>\"Mrs. Roxana D''Amore\", :score=>571}, {:title=>\"Miss + Desirae Kris\", :score=>929}], :next_page=>\"t3_abc123_365\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see there are more posts available. I''ll continue fetching with the next_page + token:"},{"type":"tool_use","id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","content":"{:posts=>[{:title=>\"Sharita + Ziemann\", :score=>417}, {:title=>\"Ervin Wilkinson I\", :score=>261}, {:title=>\"Johnathan + Rohan Esq.\", :score=>425}], :next_page=>\"t3_abc123_384\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_0151hgmrEfJ2j8X9AcYSku7V","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_0151hgmrEfJ2j8X9AcYSku7V","content":"{:posts=>[{:title=>\"Brittni + Torp\", :score=>576}, {:title=>\"Kathe Wiza\", :score=>718}, {:title=>\"Margarett + Cole\", :score=>591}], :next_page=>\"t3_abc123_69\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch again:"},{"type":"tool_use","id":"toolu_016F7k3i4NEQw31KaKgL5Xzh","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_016F7k3i4NEQw31KaKgL5Xzh","content":"{:posts=>[{:title=>\"Ivan + Tremblay\", :score=>806}, {:title=>\"Shantay Hermann JD\", :score=>94}, {:title=>\"Tawnya + Barton\", :score=>797}], :next_page=>\"t3_abc123_451\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch one more time:"},{"type":"tool_use","id":"toolu_015zUxXzMQLsoHC4tK8FqncT","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_015zUxXzMQLsoHC4tK8FqncT","content":"{:posts=>[{:title=>\"Amb. + Leonila Morar\", :score=>383}, {:title=>\"Stefania Hills PhD\", :score=>115}, + {:title=>\"Carlos Ritchie\", :score=>384}], :next_page=>\"t3_abc123_209\", + :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 12:09:48 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-24T12:09:48Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-24T12:09:48Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-24T12:09:47Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-24T12:09:48Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01HEZyLWy33YYcVkqMZeBZQV","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + fetch again:"},{"type":"tool_use","id":"toolu_01Q1SNHg8zNysRKygAVNpbzE","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1201,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":44}}' + recorded_at: Thu, 24 Apr 2025 12:09:48 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by repeatedly calling the + `looping_answer` function until we receive an empty array. Here''s how we''ll + do it:"},{"type":"tool_use","id":"toolu_017Nr3y43V1gyPgAHrFsvKji","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_017Nr3y43V1gyPgAHrFsvKji","content":"{:posts=>[{:title=>\"Christel + Stehr\", :score=>101}, {:title=>\"Mrs. Roxana D''Amore\", :score=>571}, {:title=>\"Miss + Desirae Kris\", :score=>929}], :next_page=>\"t3_abc123_365\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see there are more posts available. I''ll continue fetching with the next_page + token:"},{"type":"tool_use","id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","content":"{:posts=>[{:title=>\"Sharita + Ziemann\", :score=>417}, {:title=>\"Ervin Wilkinson I\", :score=>261}, {:title=>\"Johnathan + Rohan Esq.\", :score=>425}], :next_page=>\"t3_abc123_384\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_0151hgmrEfJ2j8X9AcYSku7V","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_0151hgmrEfJ2j8X9AcYSku7V","content":"{:posts=>[{:title=>\"Brittni + Torp\", :score=>576}, {:title=>\"Kathe Wiza\", :score=>718}, {:title=>\"Margarett + Cole\", :score=>591}], :next_page=>\"t3_abc123_69\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch again:"},{"type":"tool_use","id":"toolu_016F7k3i4NEQw31KaKgL5Xzh","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_016F7k3i4NEQw31KaKgL5Xzh","content":"{:posts=>[{:title=>\"Ivan + Tremblay\", :score=>806}, {:title=>\"Shantay Hermann JD\", :score=>94}, {:title=>\"Tawnya + Barton\", :score=>797}], :next_page=>\"t3_abc123_451\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch one more time:"},{"type":"tool_use","id":"toolu_015zUxXzMQLsoHC4tK8FqncT","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_015zUxXzMQLsoHC4tK8FqncT","content":"{:posts=>[{:title=>\"Amb. + Leonila Morar\", :score=>383}, {:title=>\"Stefania Hills PhD\", :score=>115}, + {:title=>\"Carlos Ritchie\", :score=>384}], :next_page=>\"t3_abc123_209\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch again:"},{"type":"tool_use","id":"toolu_01Q1SNHg8zNysRKygAVNpbzE","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Q1SNHg8zNysRKygAVNpbzE","content":"{:posts=>[{:title=>\"Nicolas + Brekke\", :score=>439}, {:title=>\"Rev. Garry Marks\", :score=>839}, {:title=>\"Melodi + Weber\", :score=>223}], :next_page=>\"t3_abc123_768\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 12:09:56 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-24T12:09:55Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-24T12:09:56Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-24T12:09:50Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-24T12:09:55Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_018eLJsyPC8ftr3vNbC3sA9K","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + fetch the current weather for Berlin using its coordinates:"},{"type":"tool_use","id":"toolu_01Q7ea5kfTeXJodDvvWTw49Y","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1362,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":87}}' + recorded_at: Thu, 24 Apr 2025 12:09:56 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by repeatedly calling the + `looping_answer` function until we receive an empty array. Here''s how we''ll + do it:"},{"type":"tool_use","id":"toolu_017Nr3y43V1gyPgAHrFsvKji","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_017Nr3y43V1gyPgAHrFsvKji","content":"{:posts=>[{:title=>\"Christel + Stehr\", :score=>101}, {:title=>\"Mrs. Roxana D''Amore\", :score=>571}, {:title=>\"Miss + Desirae Kris\", :score=>929}], :next_page=>\"t3_abc123_365\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see there are more posts available. I''ll continue fetching with the next_page + token:"},{"type":"tool_use","id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_011gJTVBPtR1xbuAoJE9P8yw","content":"{:posts=>[{:title=>\"Sharita + Ziemann\", :score=>417}, {:title=>\"Ervin Wilkinson I\", :score=>261}, {:title=>\"Johnathan + Rohan Esq.\", :score=>425}], :next_page=>\"t3_abc123_384\", :message=>\"More + posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_0151hgmrEfJ2j8X9AcYSku7V","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_0151hgmrEfJ2j8X9AcYSku7V","content":"{:posts=>[{:title=>\"Brittni + Torp\", :score=>576}, {:title=>\"Kathe Wiza\", :score=>718}, {:title=>\"Margarett + Cole\", :score=>591}], :next_page=>\"t3_abc123_69\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch again:"},{"type":"tool_use","id":"toolu_016F7k3i4NEQw31KaKgL5Xzh","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_016F7k3i4NEQw31KaKgL5Xzh","content":"{:posts=>[{:title=>\"Ivan + Tremblay\", :score=>806}, {:title=>\"Shantay Hermann JD\", :score=>94}, {:title=>\"Tawnya + Barton\", :score=>797}], :next_page=>\"t3_abc123_451\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch one more time:"},{"type":"tool_use","id":"toolu_015zUxXzMQLsoHC4tK8FqncT","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_015zUxXzMQLsoHC4tK8FqncT","content":"{:posts=>[{:title=>\"Amb. + Leonila Morar\", :score=>383}, {:title=>\"Stefania Hills PhD\", :score=>115}, + {:title=>\"Carlos Ritchie\", :score=>384}], :next_page=>\"t3_abc123_209\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch again:"},{"type":"tool_use","id":"toolu_01Q1SNHg8zNysRKygAVNpbzE","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Q1SNHg8zNysRKygAVNpbzE","content":"{:posts=>[{:title=>\"Nicolas + Brekke\", :score=>439}, {:title=>\"Rev. Garry Marks\", :score=>839}, {:title=>\"Melodi + Weber\", :score=>223}], :next_page=>\"t3_abc123_768\", :message=>\"More posts + are available using the next_page token.\"}"}]},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch the current weather for Berlin using its coordinates:"},{"type":"tool_use","id":"toolu_01Q7ea5kfTeXJodDvvWTw49Y","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Q7ea5kfTeXJodDvvWTw49Y","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 12:10:02 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-24T12:10:02Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-24T12:10:02Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-04-24T12:09:57Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-24T12:10:02Z' + Request-Id: + - "" + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: !binary |- + eyJpZCI6Im1zZ18wMVBqVkdVTGpTVlFHVnpld3p3azNnbmIiLCJ0eXBlIjoibWVzc2FnZSIsInJvbGUiOiJhc3Npc3RhbnQiLCJtb2RlbCI6ImNsYXVkZS0zLTUtaGFpa3UtMjAyNDEwMjIiLCJjb250ZW50IjpbeyJ0eXBlIjoidGV4dCIsInRleHQiOiJUaGUgY3VycmVudCB3ZWF0aGVyIGluIEJlcmxpbiBpcyAxNcKwQyB3aXRoIGEgd2luZCBzcGVlZCBvZiAxMCBrbS9oLiJ9XSwic3RvcF9yZWFzb24iOiJlbmRfdHVybiIsInN0b3Bfc2VxdWVuY2UiOm51bGwsInVzYWdlIjp7ImlucHV0X3Rva2VucyI6MTQ4OCwiY2FjaGVfY3JlYXRpb25faW5wdXRfdG9rZW5zIjowLCJjYWNoZV9yZWFkX2lucHV0X3Rva2VucyI6MCwib3V0cHV0X3Rva2VucyI6MjZ9fQ== + recorded_at: Thu, 24 Apr 2025 12:10:02 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_completions_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_tool_completions_limit.yml similarity index 56% rename from spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_completions_limit.yml rename to spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_tool_completions_limit.yml index c1c440ff..fa8f2af8 100644 --- a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4o-mini_can_use_tools_with_a_tool_completions_limit.yml +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_tool_completions_limit.yml @@ -5,7 +5,7 @@ http_interactions: uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 - string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch all of the posts from r/RandomNames. Fetch the next_page listed in the response until it responds with an empty array"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets @@ -29,7 +29,7 @@ http_interactions: message: OK headers: Date: - - Mon, 07 Apr 2025 11:50:17 GMT + - Thu, 24 Apr 2025 12:10:06 GMT Content-Type: - application/json Transfer-Encoding: @@ -41,19 +41,19 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '503' + - '473' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: - - '10000' + - '500' X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9997' + - '499' X-Ratelimit-Remaining-Tokens: - '199967' X-Ratelimit-Reset-Requests: - - 24.916s + - 120ms X-Ratelimit-Reset-Tokens: - 9ms X-Request-Id: @@ -77,10 +77,10 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BJfHUUhAE9awrhlyoz9Qm3B6IoG36", + "id": "chatcmpl-BPpgzCYjBgXUbsZXET0lKeFenvjLG", "object": "chat.completion", - "created": 1744026616, - "model": "gpt-4o-mini-2024-07-18", + "created": 1745496605, + "model": "gpt-4.1-nano-2025-04-14", "choices": [ { "index": 0, @@ -89,7 +89,15 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_o9cJPU9ujtsE3jUnrNfMjtHi", + "id": "call_iARhGzusOhmEcNQugV7JTGSB", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_oXlLzIpxHahjlnNrxGcC1I3p", "type": "function", "function": { "name": "looping_answer", @@ -106,8 +114,8 @@ http_interactions: ], "usage": { "prompt_tokens": 116, - "completion_tokens": 12, - "total_tokens": 128, + "completion_tokens": 42, + "total_tokens": 158, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -120,20 +128,23 @@ http_interactions: } }, "service_tier": "default", - "system_fingerprint": "fp_b376dfbbd5" + "system_fingerprint": "fp_eede8f0d45" } - recorded_at: Mon, 07 Apr 2025 11:50:17 GMT + recorded_at: Thu, 24 Apr 2025 12:10:06 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 - string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia - Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. - Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_iARhGzusOhmEcNQugV7JTGSB","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_oXlLzIpxHahjlnNrxGcC1I3p","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Karol + Rosenbaum\", :score=>215}, {:title=>\"Leeanne Schaden Ret.\", :score=>949}, + {:title=>\"Nathaniel Tromp\", :score=>137}], :next_page=>\"t3_abc123_583\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_iARhGzusOhmEcNQugV7JTGSB"},{"role":"tool","content":"{:posts=>[{:title=>\"Ada + Abbott\", :score=>195}, {:title=>\"Kurtis King\", :score=>353}, {:title=>\"Dylan + Feest\", :score=>940}], :next_page=>\"t3_abc123_34\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_oXlLzIpxHahjlnNrxGcC1I3p"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -155,7 +166,7 @@ http_interactions: message: OK headers: Date: - - Mon, 07 Apr 2025 11:50:18 GMT + - Thu, 24 Apr 2025 12:10:07 GMT Content-Type: - application/json Transfer-Encoding: @@ -167,21 +178,21 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '978' + - '899' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: - - '10000' + - '500' X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9996' + - '499' X-Ratelimit-Remaining-Tokens: - - '199908' + - '199851' X-Ratelimit-Reset-Requests: - - 32.678s + - 120ms X-Ratelimit-Reset-Tokens: - - 27ms + - 44ms X-Request-Id: - "" Strict-Transport-Security: @@ -203,10 +214,10 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BJfHVRYO1N7EATyFtz1eaE0mPbTgg", + "id": "chatcmpl-BPph0v9BBQHFF7YMKMx7ykWazGEN2", "object": "chat.completion", - "created": 1744026617, - "model": "gpt-4o-mini-2024-07-18", + "created": 1745496606, + "model": "gpt-4.1-nano-2025-04-14", "choices": [ { "index": 0, @@ -215,7 +226,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_5ffJQo7EzvQ3aLIbp0dgBNcs", + "id": "call_LAO3pFk25C7hl69JlTCRGPhi", "type": "function", "function": { "name": "looping_answer", @@ -223,7 +234,7 @@ http_interactions: } }, { - "id": "call_F0gbDJjAyfgsyVxKYR9k9JPY", + "id": "call_mb2F7VaGnluAWBqYRrkpyvFQ", "type": "function", "function": { "name": "looping_answer", @@ -239,9 +250,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 206, + "prompt_tokens": 317, "completion_tokens": 42, - "total_tokens": 248, + "total_tokens": 359, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -254,26 +265,29 @@ http_interactions: } }, "service_tier": "default", - "system_fingerprint": "fp_b376dfbbd5" + "system_fingerprint": "fp_eede8f0d45" } - recorded_at: Mon, 07 Apr 2025 11:50:18 GMT + recorded_at: Thu, 24 Apr 2025 12:10:07 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 - string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia - Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. - Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"},{"role":"assistant","tool_calls":[{"id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_F0gbDJjAyfgsyVxKYR9k9JPY","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lashawn - Gerlach\", :score=>769}, {:title=>\"Sen. Carter Cummerata\", :score=>487}, - {:title=>\"Herman Brown\", :score=>766}], :next_page=>\"t3_abc123_198\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs"},{"role":"tool","content":"{:posts=>[{:title=>\"Pres. - Daron Wuckert\", :score=>727}, {:title=>\"Randy Hickle\", :score=>620}, {:title=>\"Elwood - Becker\", :score=>820}], :next_page=>\"t3_abc123_582\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_F0gbDJjAyfgsyVxKYR9k9JPY"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_iARhGzusOhmEcNQugV7JTGSB","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_oXlLzIpxHahjlnNrxGcC1I3p","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Karol + Rosenbaum\", :score=>215}, {:title=>\"Leeanne Schaden Ret.\", :score=>949}, + {:title=>\"Nathaniel Tromp\", :score=>137}], :next_page=>\"t3_abc123_583\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_iARhGzusOhmEcNQugV7JTGSB"},{"role":"tool","content":"{:posts=>[{:title=>\"Ada + Abbott\", :score=>195}, {:title=>\"Kurtis King\", :score=>353}, {:title=>\"Dylan + Feest\", :score=>940}], :next_page=>\"t3_abc123_34\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_oXlLzIpxHahjlnNrxGcC1I3p"},{"role":"assistant","tool_calls":[{"id":"call_LAO3pFk25C7hl69JlTCRGPhi","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mb2F7VaGnluAWBqYRrkpyvFQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Donella + Dickens\", :score=>43}, {:title=>\"Detra Kutch\", :score=>815}, {:title=>\"Rep. + Rudolph Kihn\", :score=>189}], :next_page=>\"t3_abc123_944\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_LAO3pFk25C7hl69JlTCRGPhi"},{"role":"tool","content":"{:posts=>[{:title=>\"Chung + Kassulke\", :score=>325}, {:title=>\"Dr. Jorge Thiel\", :score=>751}, {:title=>\"Christiana + Mayert MD\", :score=>727}], :next_page=>\"t3_abc123_555\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_mb2F7VaGnluAWBqYRrkpyvFQ"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -295,7 +309,7 @@ http_interactions: message: OK headers: Date: - - Mon, 07 Apr 2025 11:50:19 GMT + - Thu, 24 Apr 2025 12:10:09 GMT Content-Type: - application/json Transfer-Encoding: @@ -307,21 +321,21 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '964' + - '1309' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: - - '10000' + - '500' X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9995' + - '499' X-Ratelimit-Remaining-Tokens: - - '199790' + - '199733' X-Ratelimit-Reset-Requests: - - 39.967s + - 120ms X-Ratelimit-Reset-Tokens: - - 63ms + - 80ms X-Request-Id: - "" Strict-Transport-Security: @@ -343,10 +357,10 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BJfHWI3FCT7in1WfLTbxesV7VPwOw", + "id": "chatcmpl-BPph2m5rdp0ywjqtaaSoAKl92BSkh", "object": "chat.completion", - "created": 1744026618, - "model": "gpt-4o-mini-2024-07-18", + "created": 1745496608, + "model": "gpt-4.1-nano-2025-04-14", "choices": [ { "index": 0, @@ -355,7 +369,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_6z4JobRNAObALL5j7KfjZ0xo", + "id": "call_khi5QnW0YeTby4CvDmpQIB8P", "type": "function", "function": { "name": "looping_answer", @@ -363,7 +377,7 @@ http_interactions: } }, { - "id": "call_mYxGVOPT78IZh99B0JpNscpr", + "id": "call_Ec7bc3HczHltwTN6L2g292U0", "type": "function", "function": { "name": "looping_answer", @@ -379,9 +393,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 412, + "prompt_tokens": 523, "completion_tokens": 42, - "total_tokens": 454, + "total_tokens": 565, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -394,32 +408,35 @@ http_interactions: } }, "service_tier": "default", - "system_fingerprint": "fp_b376dfbbd5" + "system_fingerprint": "fp_eede8f0d45" } - recorded_at: Mon, 07 Apr 2025 11:50:19 GMT + recorded_at: Thu, 24 Apr 2025 12:10:09 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 - string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia - Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. - Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"},{"role":"assistant","tool_calls":[{"id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_F0gbDJjAyfgsyVxKYR9k9JPY","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lashawn - Gerlach\", :score=>769}, {:title=>\"Sen. Carter Cummerata\", :score=>487}, - {:title=>\"Herman Brown\", :score=>766}], :next_page=>\"t3_abc123_198\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs"},{"role":"tool","content":"{:posts=>[{:title=>\"Pres. - Daron Wuckert\", :score=>727}, {:title=>\"Randy Hickle\", :score=>620}, {:title=>\"Elwood - Becker\", :score=>820}], :next_page=>\"t3_abc123_582\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_F0gbDJjAyfgsyVxKYR9k9JPY"},{"role":"assistant","tool_calls":[{"id":"call_6z4JobRNAObALL5j7KfjZ0xo","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mYxGVOPT78IZh99B0JpNscpr","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Julian - Stark IV\", :score=>923}, {:title=>\"Thaddeus Auer\", :score=>148}, {:title=>\"Yong - Lehner DO\", :score=>622}], :next_page=>\"t3_abc123_321\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_6z4JobRNAObALL5j7KfjZ0xo"},{"role":"tool","content":"{:posts=>[{:title=>\"Orville - Paucek\", :score=>640}, {:title=>\"Terrence Zieme\", :score=>425}, {:title=>\"Beulah - Casper\", :score=>476}], :next_page=>\"t3_abc123_613\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_mYxGVOPT78IZh99B0JpNscpr"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_iARhGzusOhmEcNQugV7JTGSB","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_oXlLzIpxHahjlnNrxGcC1I3p","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Karol + Rosenbaum\", :score=>215}, {:title=>\"Leeanne Schaden Ret.\", :score=>949}, + {:title=>\"Nathaniel Tromp\", :score=>137}], :next_page=>\"t3_abc123_583\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_iARhGzusOhmEcNQugV7JTGSB"},{"role":"tool","content":"{:posts=>[{:title=>\"Ada + Abbott\", :score=>195}, {:title=>\"Kurtis King\", :score=>353}, {:title=>\"Dylan + Feest\", :score=>940}], :next_page=>\"t3_abc123_34\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_oXlLzIpxHahjlnNrxGcC1I3p"},{"role":"assistant","tool_calls":[{"id":"call_LAO3pFk25C7hl69JlTCRGPhi","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mb2F7VaGnluAWBqYRrkpyvFQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Donella + Dickens\", :score=>43}, {:title=>\"Detra Kutch\", :score=>815}, {:title=>\"Rep. + Rudolph Kihn\", :score=>189}], :next_page=>\"t3_abc123_944\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_LAO3pFk25C7hl69JlTCRGPhi"},{"role":"tool","content":"{:posts=>[{:title=>\"Chung + Kassulke\", :score=>325}, {:title=>\"Dr. Jorge Thiel\", :score=>751}, {:title=>\"Christiana + Mayert MD\", :score=>727}], :next_page=>\"t3_abc123_555\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_mb2F7VaGnluAWBqYRrkpyvFQ"},{"role":"assistant","tool_calls":[{"id":"call_khi5QnW0YeTby4CvDmpQIB8P","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_Ec7bc3HczHltwTN6L2g292U0","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lance + Ondricka\", :score=>478}, {:title=>\"Len Rath\", :score=>718}, {:title=>\"Keitha + McKenzie\", :score=>126}], :next_page=>\"t3_abc123_848\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_khi5QnW0YeTby4CvDmpQIB8P"},{"role":"tool","content":"{:posts=>[{:title=>\"Lacy + Rohan\", :score=>534}, {:title=>\"Syreeta Paucek\", :score=>324}, {:title=>\"Glenn + Bins\", :score=>716}], :next_page=>\"t3_abc123_795\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_Ec7bc3HczHltwTN6L2g292U0"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -441,7 +458,7 @@ http_interactions: message: OK headers: Date: - - Mon, 07 Apr 2025 11:50:21 GMT + - Thu, 24 Apr 2025 12:10:10 GMT Content-Type: - application/json Transfer-Encoding: @@ -453,21 +470,21 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '1060' + - '432' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: - - '10000' + - '500' X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9994' + - '499' X-Ratelimit-Remaining-Tokens: - - '199673' + - '199620' X-Ratelimit-Reset-Requests: - - 47.338s + - 120ms X-Ratelimit-Reset-Tokens: - - 97ms + - 114ms X-Request-Id: - "" Strict-Transport-Security: @@ -489,10 +506,10 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BJfHYu6WdLO5IVcQUXNJkaojVmELC", + "id": "chatcmpl-BPph3UoK72hHmTwzQCRQr98GClRKJ", "object": "chat.completion", - "created": 1744026620, - "model": "gpt-4o-mini-2024-07-18", + "created": 1745496609, + "model": "gpt-4.1-nano-2025-04-14", "choices": [ { "index": 0, @@ -501,7 +518,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_qzjtQirXooD8SiLNGecmHxoa", + "id": "call_PicL6zj98mGQJefPtyw4yUwy", "type": "function", "function": { "name": "looping_answer", @@ -509,7 +526,7 @@ http_interactions: } }, { - "id": "call_OcXngJ6QDYjr6H7lOuQtILcC", + "id": "call_1IfRSvwuy5WwD3a4k0BP8tNQ", "type": "function", "function": { "name": "looping_answer", @@ -525,9 +542,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 615, + "prompt_tokens": 725, "completion_tokens": 42, - "total_tokens": 657, + "total_tokens": 767, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -540,38 +557,41 @@ http_interactions: } }, "service_tier": "default", - "system_fingerprint": "fp_b376dfbbd5" + "system_fingerprint": "fp_eede8f0d45" } - recorded_at: Mon, 07 Apr 2025 11:50:21 GMT + recorded_at: Thu, 24 Apr 2025 12:10:10 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 - string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia - Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. - Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"},{"role":"assistant","tool_calls":[{"id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_F0gbDJjAyfgsyVxKYR9k9JPY","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lashawn - Gerlach\", :score=>769}, {:title=>\"Sen. Carter Cummerata\", :score=>487}, - {:title=>\"Herman Brown\", :score=>766}], :next_page=>\"t3_abc123_198\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs"},{"role":"tool","content":"{:posts=>[{:title=>\"Pres. - Daron Wuckert\", :score=>727}, {:title=>\"Randy Hickle\", :score=>620}, {:title=>\"Elwood - Becker\", :score=>820}], :next_page=>\"t3_abc123_582\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_F0gbDJjAyfgsyVxKYR9k9JPY"},{"role":"assistant","tool_calls":[{"id":"call_6z4JobRNAObALL5j7KfjZ0xo","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mYxGVOPT78IZh99B0JpNscpr","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Julian - Stark IV\", :score=>923}, {:title=>\"Thaddeus Auer\", :score=>148}, {:title=>\"Yong - Lehner DO\", :score=>622}], :next_page=>\"t3_abc123_321\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_6z4JobRNAObALL5j7KfjZ0xo"},{"role":"tool","content":"{:posts=>[{:title=>\"Orville - Paucek\", :score=>640}, {:title=>\"Terrence Zieme\", :score=>425}, {:title=>\"Beulah - Casper\", :score=>476}], :next_page=>\"t3_abc123_613\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_mYxGVOPT78IZh99B0JpNscpr"},{"role":"assistant","tool_calls":[{"id":"call_qzjtQirXooD8SiLNGecmHxoa","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_OcXngJ6QDYjr6H7lOuQtILcC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Sharice - Satterfield\", :score=>613}, {:title=>\"Julietta Greenfelder\", :score=>388}, - {:title=>\"Addie Little\", :score=>16}], :next_page=>\"t3_abc123_500\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_qzjtQirXooD8SiLNGecmHxoa"},{"role":"tool","content":"{:posts=>[{:title=>\"Cesar - Rau\", :score=>942}, {:title=>\"May Schuster\", :score=>207}, {:title=>\"Miranda - O''Conner\", :score=>409}], :next_page=>\"t3_abc123_815\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_OcXngJ6QDYjr6H7lOuQtILcC"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_iARhGzusOhmEcNQugV7JTGSB","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_oXlLzIpxHahjlnNrxGcC1I3p","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Karol + Rosenbaum\", :score=>215}, {:title=>\"Leeanne Schaden Ret.\", :score=>949}, + {:title=>\"Nathaniel Tromp\", :score=>137}], :next_page=>\"t3_abc123_583\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_iARhGzusOhmEcNQugV7JTGSB"},{"role":"tool","content":"{:posts=>[{:title=>\"Ada + Abbott\", :score=>195}, {:title=>\"Kurtis King\", :score=>353}, {:title=>\"Dylan + Feest\", :score=>940}], :next_page=>\"t3_abc123_34\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_oXlLzIpxHahjlnNrxGcC1I3p"},{"role":"assistant","tool_calls":[{"id":"call_LAO3pFk25C7hl69JlTCRGPhi","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mb2F7VaGnluAWBqYRrkpyvFQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Donella + Dickens\", :score=>43}, {:title=>\"Detra Kutch\", :score=>815}, {:title=>\"Rep. + Rudolph Kihn\", :score=>189}], :next_page=>\"t3_abc123_944\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_LAO3pFk25C7hl69JlTCRGPhi"},{"role":"tool","content":"{:posts=>[{:title=>\"Chung + Kassulke\", :score=>325}, {:title=>\"Dr. Jorge Thiel\", :score=>751}, {:title=>\"Christiana + Mayert MD\", :score=>727}], :next_page=>\"t3_abc123_555\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_mb2F7VaGnluAWBqYRrkpyvFQ"},{"role":"assistant","tool_calls":[{"id":"call_khi5QnW0YeTby4CvDmpQIB8P","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_Ec7bc3HczHltwTN6L2g292U0","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lance + Ondricka\", :score=>478}, {:title=>\"Len Rath\", :score=>718}, {:title=>\"Keitha + McKenzie\", :score=>126}], :next_page=>\"t3_abc123_848\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_khi5QnW0YeTby4CvDmpQIB8P"},{"role":"tool","content":"{:posts=>[{:title=>\"Lacy + Rohan\", :score=>534}, {:title=>\"Syreeta Paucek\", :score=>324}, {:title=>\"Glenn + Bins\", :score=>716}], :next_page=>\"t3_abc123_795\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_Ec7bc3HczHltwTN6L2g292U0"},{"role":"assistant","tool_calls":[{"id":"call_PicL6zj98mGQJefPtyw4yUwy","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_1IfRSvwuy5WwD3a4k0BP8tNQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Maximo + Lakin\", :score=>255}, {:title=>\"Earlean Ullrich\", :score=>346}, {:title=>\"Rodrigo + Wuckert\", :score=>63}], :next_page=>\"t3_abc123_354\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_PicL6zj98mGQJefPtyw4yUwy"},{"role":"tool","content":"{:posts=>[{:title=>\"Deena + Lesch\", :score=>797}, {:title=>\"Zenaida Keeling\", :score=>51}, {:title=>\"Ollie + Hagenes\", :score=>797}], :next_page=>\"t3_abc123_129\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_1IfRSvwuy5WwD3a4k0BP8tNQ"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -593,7 +613,7 @@ http_interactions: message: OK headers: Date: - - Mon, 07 Apr 2025 11:50:22 GMT + - Thu, 24 Apr 2025 12:10:10 GMT Content-Type: - application/json Transfer-Encoding: @@ -605,21 +625,21 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '1108' + - '493' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: - - '10000' + - '500' X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9993' + - '499' X-Ratelimit-Remaining-Tokens: - - '199557' + - '199503' X-Ratelimit-Reset-Requests: - - 54.618s + - 120ms X-Ratelimit-Reset-Tokens: - - 132ms + - 148ms X-Request-Id: - "" Strict-Transport-Security: @@ -641,10 +661,10 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BJfHZMvWvzhRpz2Y5HpT8U60CR8Mb", + "id": "chatcmpl-BPph4pBgaIQ6GNWAMZZrAFd8osA98", "object": "chat.completion", - "created": 1744026621, - "model": "gpt-4o-mini-2024-07-18", + "created": 1745496610, + "model": "gpt-4.1-nano-2025-04-14", "choices": [ { "index": 0, @@ -653,7 +673,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_vUBH7tVPWqSP1PKTR2uHFxD7", + "id": "call_0rnA4WJVpv8uddjL5VUvF4PV", "type": "function", "function": { "name": "looping_answer", @@ -661,7 +681,7 @@ http_interactions: } }, { - "id": "call_xenaDJKczSffSzomAtU5VB9P", + "id": "call_kxD1dJUdlGedwrDPUjRiUcdj", "type": "function", "function": { "name": "looping_answer", @@ -677,9 +697,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 817, + "prompt_tokens": 931, "completion_tokens": 42, - "total_tokens": 859, + "total_tokens": 973, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -692,44 +712,47 @@ http_interactions: } }, "service_tier": "default", - "system_fingerprint": "fp_b376dfbbd5" + "system_fingerprint": "fp_eede8f0d45" } - recorded_at: Mon, 07 Apr 2025 11:50:22 GMT + recorded_at: Thu, 24 Apr 2025 12:10:11 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 - string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia - Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. - Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"},{"role":"assistant","tool_calls":[{"id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_F0gbDJjAyfgsyVxKYR9k9JPY","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lashawn - Gerlach\", :score=>769}, {:title=>\"Sen. Carter Cummerata\", :score=>487}, - {:title=>\"Herman Brown\", :score=>766}], :next_page=>\"t3_abc123_198\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs"},{"role":"tool","content":"{:posts=>[{:title=>\"Pres. - Daron Wuckert\", :score=>727}, {:title=>\"Randy Hickle\", :score=>620}, {:title=>\"Elwood - Becker\", :score=>820}], :next_page=>\"t3_abc123_582\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_F0gbDJjAyfgsyVxKYR9k9JPY"},{"role":"assistant","tool_calls":[{"id":"call_6z4JobRNAObALL5j7KfjZ0xo","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mYxGVOPT78IZh99B0JpNscpr","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Julian - Stark IV\", :score=>923}, {:title=>\"Thaddeus Auer\", :score=>148}, {:title=>\"Yong - Lehner DO\", :score=>622}], :next_page=>\"t3_abc123_321\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_6z4JobRNAObALL5j7KfjZ0xo"},{"role":"tool","content":"{:posts=>[{:title=>\"Orville - Paucek\", :score=>640}, {:title=>\"Terrence Zieme\", :score=>425}, {:title=>\"Beulah - Casper\", :score=>476}], :next_page=>\"t3_abc123_613\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_mYxGVOPT78IZh99B0JpNscpr"},{"role":"assistant","tool_calls":[{"id":"call_qzjtQirXooD8SiLNGecmHxoa","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_OcXngJ6QDYjr6H7lOuQtILcC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Sharice - Satterfield\", :score=>613}, {:title=>\"Julietta Greenfelder\", :score=>388}, - {:title=>\"Addie Little\", :score=>16}], :next_page=>\"t3_abc123_500\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_qzjtQirXooD8SiLNGecmHxoa"},{"role":"tool","content":"{:posts=>[{:title=>\"Cesar - Rau\", :score=>942}, {:title=>\"May Schuster\", :score=>207}, {:title=>\"Miranda - O''Conner\", :score=>409}], :next_page=>\"t3_abc123_815\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_OcXngJ6QDYjr6H7lOuQtILcC"},{"role":"assistant","tool_calls":[{"id":"call_vUBH7tVPWqSP1PKTR2uHFxD7","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_xenaDJKczSffSzomAtU5VB9P","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Leslie - Zulauf\", :score=>600}, {:title=>\"Andrew Lind\", :score=>421}, {:title=>\"Fernande - Kub\", :score=>715}], :next_page=>\"t3_abc123_634\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_vUBH7tVPWqSP1PKTR2uHFxD7"},{"role":"tool","content":"{:posts=>[{:title=>\"Ms. - Dewayne Stiedemann\", :score=>130}, {:title=>\"Hung Donnelly Sr.\", :score=>7}, - {:title=>\"Imogene Keeling\", :score=>425}], :next_page=>\"t3_abc123_896\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_xenaDJKczSffSzomAtU5VB9P"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_iARhGzusOhmEcNQugV7JTGSB","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_oXlLzIpxHahjlnNrxGcC1I3p","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Karol + Rosenbaum\", :score=>215}, {:title=>\"Leeanne Schaden Ret.\", :score=>949}, + {:title=>\"Nathaniel Tromp\", :score=>137}], :next_page=>\"t3_abc123_583\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_iARhGzusOhmEcNQugV7JTGSB"},{"role":"tool","content":"{:posts=>[{:title=>\"Ada + Abbott\", :score=>195}, {:title=>\"Kurtis King\", :score=>353}, {:title=>\"Dylan + Feest\", :score=>940}], :next_page=>\"t3_abc123_34\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_oXlLzIpxHahjlnNrxGcC1I3p"},{"role":"assistant","tool_calls":[{"id":"call_LAO3pFk25C7hl69JlTCRGPhi","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mb2F7VaGnluAWBqYRrkpyvFQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Donella + Dickens\", :score=>43}, {:title=>\"Detra Kutch\", :score=>815}, {:title=>\"Rep. + Rudolph Kihn\", :score=>189}], :next_page=>\"t3_abc123_944\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_LAO3pFk25C7hl69JlTCRGPhi"},{"role":"tool","content":"{:posts=>[{:title=>\"Chung + Kassulke\", :score=>325}, {:title=>\"Dr. Jorge Thiel\", :score=>751}, {:title=>\"Christiana + Mayert MD\", :score=>727}], :next_page=>\"t3_abc123_555\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_mb2F7VaGnluAWBqYRrkpyvFQ"},{"role":"assistant","tool_calls":[{"id":"call_khi5QnW0YeTby4CvDmpQIB8P","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_Ec7bc3HczHltwTN6L2g292U0","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lance + Ondricka\", :score=>478}, {:title=>\"Len Rath\", :score=>718}, {:title=>\"Keitha + McKenzie\", :score=>126}], :next_page=>\"t3_abc123_848\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_khi5QnW0YeTby4CvDmpQIB8P"},{"role":"tool","content":"{:posts=>[{:title=>\"Lacy + Rohan\", :score=>534}, {:title=>\"Syreeta Paucek\", :score=>324}, {:title=>\"Glenn + Bins\", :score=>716}], :next_page=>\"t3_abc123_795\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_Ec7bc3HczHltwTN6L2g292U0"},{"role":"assistant","tool_calls":[{"id":"call_PicL6zj98mGQJefPtyw4yUwy","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_1IfRSvwuy5WwD3a4k0BP8tNQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Maximo + Lakin\", :score=>255}, {:title=>\"Earlean Ullrich\", :score=>346}, {:title=>\"Rodrigo + Wuckert\", :score=>63}], :next_page=>\"t3_abc123_354\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_PicL6zj98mGQJefPtyw4yUwy"},{"role":"tool","content":"{:posts=>[{:title=>\"Deena + Lesch\", :score=>797}, {:title=>\"Zenaida Keeling\", :score=>51}, {:title=>\"Ollie + Hagenes\", :score=>797}], :next_page=>\"t3_abc123_129\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_1IfRSvwuy5WwD3a4k0BP8tNQ"},{"role":"assistant","tool_calls":[{"id":"call_0rnA4WJVpv8uddjL5VUvF4PV","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_kxD1dJUdlGedwrDPUjRiUcdj","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Jude + Klein\", :score=>818}, {:title=>\"Mercy Lynch\", :score=>940}, {:title=>\"Josiah + Bartell\", :score=>442}], :next_page=>\"t3_abc123_553\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_0rnA4WJVpv8uddjL5VUvF4PV"},{"role":"tool","content":"{:posts=>[{:title=>\"Daphne + Treutel\", :score=>672}, {:title=>\"Shanelle Herman\", :score=>253}, {:title=>\"Dr. + Serena Bradtke\", :score=>7}], :next_page=>\"t3_abc123_540\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_kxD1dJUdlGedwrDPUjRiUcdj"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -751,7 +774,7 @@ http_interactions: message: OK headers: Date: - - Mon, 07 Apr 2025 11:50:24 GMT + - Thu, 24 Apr 2025 12:10:11 GMT Content-Type: - application/json Transfer-Encoding: @@ -763,21 +786,21 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '1141' + - '512' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: - - '10000' + - '500' X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9992' + - '499' X-Ratelimit-Remaining-Tokens: - - '199438' + - '199388' X-Ratelimit-Reset-Requests: - - 1m1.833s + - 120ms X-Ratelimit-Reset-Tokens: - - 168ms + - 183ms X-Request-Id: - "" Strict-Transport-Security: @@ -799,10 +822,10 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BJfHal5hqHoOExtmnzdhwi3nDEWwq", + "id": "chatcmpl-BPph5pIgT4QLsDkatOWsmg0MLcUKy", "object": "chat.completion", - "created": 1744026622, - "model": "gpt-4o-mini-2024-07-18", + "created": 1745496611, + "model": "gpt-4.1-nano-2025-04-14", "choices": [ { "index": 0, @@ -811,7 +834,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_tACrL1BU8hquSfphg34WPuCw", + "id": "call_iZkAio8U8tRHZomLAFFDuNIV", "type": "function", "function": { "name": "looping_answer", @@ -819,7 +842,7 @@ http_interactions: } }, { - "id": "call_oNI0QAIyqOeAOdRd2XYkqkIM", + "id": "call_Tmf0sooEevILL1QzITsxmmqd", "type": "function", "function": { "name": "looping_answer", @@ -835,9 +858,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 1020, + "prompt_tokens": 1133, "completion_tokens": 42, - "total_tokens": 1062, + "total_tokens": 1175, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -850,50 +873,53 @@ http_interactions: } }, "service_tier": "default", - "system_fingerprint": "fp_b376dfbbd5" + "system_fingerprint": "fp_eede8f0d45" } - recorded_at: Mon, 07 Apr 2025 11:50:24 GMT + recorded_at: Thu, 24 Apr 2025 12:10:11 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 - string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia - Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. - Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"},{"role":"assistant","tool_calls":[{"id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_F0gbDJjAyfgsyVxKYR9k9JPY","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lashawn - Gerlach\", :score=>769}, {:title=>\"Sen. Carter Cummerata\", :score=>487}, - {:title=>\"Herman Brown\", :score=>766}], :next_page=>\"t3_abc123_198\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs"},{"role":"tool","content":"{:posts=>[{:title=>\"Pres. - Daron Wuckert\", :score=>727}, {:title=>\"Randy Hickle\", :score=>620}, {:title=>\"Elwood - Becker\", :score=>820}], :next_page=>\"t3_abc123_582\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_F0gbDJjAyfgsyVxKYR9k9JPY"},{"role":"assistant","tool_calls":[{"id":"call_6z4JobRNAObALL5j7KfjZ0xo","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mYxGVOPT78IZh99B0JpNscpr","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Julian - Stark IV\", :score=>923}, {:title=>\"Thaddeus Auer\", :score=>148}, {:title=>\"Yong - Lehner DO\", :score=>622}], :next_page=>\"t3_abc123_321\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_6z4JobRNAObALL5j7KfjZ0xo"},{"role":"tool","content":"{:posts=>[{:title=>\"Orville - Paucek\", :score=>640}, {:title=>\"Terrence Zieme\", :score=>425}, {:title=>\"Beulah - Casper\", :score=>476}], :next_page=>\"t3_abc123_613\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_mYxGVOPT78IZh99B0JpNscpr"},{"role":"assistant","tool_calls":[{"id":"call_qzjtQirXooD8SiLNGecmHxoa","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_OcXngJ6QDYjr6H7lOuQtILcC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Sharice - Satterfield\", :score=>613}, {:title=>\"Julietta Greenfelder\", :score=>388}, - {:title=>\"Addie Little\", :score=>16}], :next_page=>\"t3_abc123_500\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_qzjtQirXooD8SiLNGecmHxoa"},{"role":"tool","content":"{:posts=>[{:title=>\"Cesar - Rau\", :score=>942}, {:title=>\"May Schuster\", :score=>207}, {:title=>\"Miranda - O''Conner\", :score=>409}], :next_page=>\"t3_abc123_815\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_OcXngJ6QDYjr6H7lOuQtILcC"},{"role":"assistant","tool_calls":[{"id":"call_vUBH7tVPWqSP1PKTR2uHFxD7","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_xenaDJKczSffSzomAtU5VB9P","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Leslie - Zulauf\", :score=>600}, {:title=>\"Andrew Lind\", :score=>421}, {:title=>\"Fernande - Kub\", :score=>715}], :next_page=>\"t3_abc123_634\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_vUBH7tVPWqSP1PKTR2uHFxD7"},{"role":"tool","content":"{:posts=>[{:title=>\"Ms. - Dewayne Stiedemann\", :score=>130}, {:title=>\"Hung Donnelly Sr.\", :score=>7}, - {:title=>\"Imogene Keeling\", :score=>425}], :next_page=>\"t3_abc123_896\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_xenaDJKczSffSzomAtU5VB9P"},{"role":"assistant","tool_calls":[{"id":"call_tACrL1BU8hquSfphg34WPuCw","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_oNI0QAIyqOeAOdRd2XYkqkIM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Felix - Wehner DO\", :score=>419}, {:title=>\"Adam Boehm\", :score=>244}, {:title=>\"Bettina - Langosh\", :score=>393}], :next_page=>\"t3_abc123_77\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_tACrL1BU8hquSfphg34WPuCw"},{"role":"tool","content":"{:posts=>[{:title=>\"Love - Simonis\", :score=>642}, {:title=>\"Adriana Schimmel\", :score=>309}, {:title=>\"Bradford - Emmerich\", :score=>608}], :next_page=>\"t3_abc123_261\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_oNI0QAIyqOeAOdRd2XYkqkIM"},{"role":"user","content":"What''s + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_iARhGzusOhmEcNQugV7JTGSB","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_oXlLzIpxHahjlnNrxGcC1I3p","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Karol + Rosenbaum\", :score=>215}, {:title=>\"Leeanne Schaden Ret.\", :score=>949}, + {:title=>\"Nathaniel Tromp\", :score=>137}], :next_page=>\"t3_abc123_583\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_iARhGzusOhmEcNQugV7JTGSB"},{"role":"tool","content":"{:posts=>[{:title=>\"Ada + Abbott\", :score=>195}, {:title=>\"Kurtis King\", :score=>353}, {:title=>\"Dylan + Feest\", :score=>940}], :next_page=>\"t3_abc123_34\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_oXlLzIpxHahjlnNrxGcC1I3p"},{"role":"assistant","tool_calls":[{"id":"call_LAO3pFk25C7hl69JlTCRGPhi","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mb2F7VaGnluAWBqYRrkpyvFQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Donella + Dickens\", :score=>43}, {:title=>\"Detra Kutch\", :score=>815}, {:title=>\"Rep. + Rudolph Kihn\", :score=>189}], :next_page=>\"t3_abc123_944\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_LAO3pFk25C7hl69JlTCRGPhi"},{"role":"tool","content":"{:posts=>[{:title=>\"Chung + Kassulke\", :score=>325}, {:title=>\"Dr. Jorge Thiel\", :score=>751}, {:title=>\"Christiana + Mayert MD\", :score=>727}], :next_page=>\"t3_abc123_555\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_mb2F7VaGnluAWBqYRrkpyvFQ"},{"role":"assistant","tool_calls":[{"id":"call_khi5QnW0YeTby4CvDmpQIB8P","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_Ec7bc3HczHltwTN6L2g292U0","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lance + Ondricka\", :score=>478}, {:title=>\"Len Rath\", :score=>718}, {:title=>\"Keitha + McKenzie\", :score=>126}], :next_page=>\"t3_abc123_848\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_khi5QnW0YeTby4CvDmpQIB8P"},{"role":"tool","content":"{:posts=>[{:title=>\"Lacy + Rohan\", :score=>534}, {:title=>\"Syreeta Paucek\", :score=>324}, {:title=>\"Glenn + Bins\", :score=>716}], :next_page=>\"t3_abc123_795\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_Ec7bc3HczHltwTN6L2g292U0"},{"role":"assistant","tool_calls":[{"id":"call_PicL6zj98mGQJefPtyw4yUwy","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_1IfRSvwuy5WwD3a4k0BP8tNQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Maximo + Lakin\", :score=>255}, {:title=>\"Earlean Ullrich\", :score=>346}, {:title=>\"Rodrigo + Wuckert\", :score=>63}], :next_page=>\"t3_abc123_354\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_PicL6zj98mGQJefPtyw4yUwy"},{"role":"tool","content":"{:posts=>[{:title=>\"Deena + Lesch\", :score=>797}, {:title=>\"Zenaida Keeling\", :score=>51}, {:title=>\"Ollie + Hagenes\", :score=>797}], :next_page=>\"t3_abc123_129\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_1IfRSvwuy5WwD3a4k0BP8tNQ"},{"role":"assistant","tool_calls":[{"id":"call_0rnA4WJVpv8uddjL5VUvF4PV","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_kxD1dJUdlGedwrDPUjRiUcdj","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Jude + Klein\", :score=>818}, {:title=>\"Mercy Lynch\", :score=>940}, {:title=>\"Josiah + Bartell\", :score=>442}], :next_page=>\"t3_abc123_553\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_0rnA4WJVpv8uddjL5VUvF4PV"},{"role":"tool","content":"{:posts=>[{:title=>\"Daphne + Treutel\", :score=>672}, {:title=>\"Shanelle Herman\", :score=>253}, {:title=>\"Dr. + Serena Bradtke\", :score=>7}], :next_page=>\"t3_abc123_540\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_kxD1dJUdlGedwrDPUjRiUcdj"},{"role":"assistant","tool_calls":[{"id":"call_iZkAio8U8tRHZomLAFFDuNIV","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_Tmf0sooEevILL1QzITsxmmqd","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Calvin + Carter\", :score=>501}, {:title=>\"Wilber Schaden MD\", :score=>331}, {:title=>\"Chance + Grady\", :score=>881}], :next_page=>\"t3_abc123_690\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_iZkAio8U8tRHZomLAFFDuNIV"},{"role":"tool","content":"{:posts=>[{:title=>\"Lesa + Cummerata\", :score=>202}, {:title=>\"Philip Medhurst\", :score=>318}, {:title=>\"Emmitt + Block MD\", :score=>505}], :next_page=>\"t3_abc123_993\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_Tmf0sooEevILL1QzITsxmmqd"},{"role":"user","content":"What''s the weather in Berlin? (52.5200, 13.4050)"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude @@ -916,7 +942,7 @@ http_interactions: message: OK headers: Date: - - Mon, 07 Apr 2025 11:50:25 GMT + - Thu, 24 Apr 2025 12:10:12 GMT Content-Type: - application/json Transfer-Encoding: @@ -928,21 +954,21 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '919' + - '603' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: - - '10000' + - '500' X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9992' + - '499' X-Ratelimit-Remaining-Tokens: - - '199310' + - '199258' X-Ratelimit-Reset-Requests: - - 1m8.949s + - 120ms X-Ratelimit-Reset-Tokens: - - 207ms + - 222ms X-Request-Id: - "" Strict-Transport-Security: @@ -964,10 +990,10 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BJfHcVusye744kJxxss68Bd1M7B7v", + "id": "chatcmpl-BPph6G7SnVyXbBbREGM0CiT9ysYue", "object": "chat.completion", - "created": 1744026624, - "model": "gpt-4o-mini-2024-07-18", + "created": 1745496612, + "model": "gpt-4.1-nano-2025-04-14", "choices": [ { "index": 0, @@ -976,7 +1002,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_Q43Bgsf9kORBbam1KxFP7Zmb", + "id": "call_vQVi7SowdPFzXp5HCPhNbKvO", "type": "function", "function": { "name": "weather", @@ -992,11 +1018,11 @@ http_interactions: } ], "usage": { - "prompt_tokens": 1247, + "prompt_tokens": 1355, "completion_tokens": 24, - "total_tokens": 1271, + "total_tokens": 1379, "prompt_tokens_details": { - "cached_tokens": 0, + "cached_tokens": 1024, "audio_tokens": 0 }, "completion_tokens_details": { @@ -1007,52 +1033,55 @@ http_interactions: } }, "service_tier": "default", - "system_fingerprint": "fp_b376dfbbd5" + "system_fingerprint": "fp_eede8f0d45" } - recorded_at: Mon, 07 Apr 2025 11:50:25 GMT + recorded_at: Thu, 24 Apr 2025 12:10:12 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions body: encoding: UTF-8 - string: '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Fetch + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_o9cJPU9ujtsE3jUnrNfMjtHi","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Eladia - Rath\", :score=>975}, {:title=>\"Dalene Pagac\", :score=>404}, {:title=>\"Sen. - Birdie Russel\", :score=>860}], :next_page=>\"t3_abc123_36\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_o9cJPU9ujtsE3jUnrNfMjtHi"},{"role":"assistant","tool_calls":[{"id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_F0gbDJjAyfgsyVxKYR9k9JPY","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lashawn - Gerlach\", :score=>769}, {:title=>\"Sen. Carter Cummerata\", :score=>487}, - {:title=>\"Herman Brown\", :score=>766}], :next_page=>\"t3_abc123_198\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_5ffJQo7EzvQ3aLIbp0dgBNcs"},{"role":"tool","content":"{:posts=>[{:title=>\"Pres. - Daron Wuckert\", :score=>727}, {:title=>\"Randy Hickle\", :score=>620}, {:title=>\"Elwood - Becker\", :score=>820}], :next_page=>\"t3_abc123_582\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_F0gbDJjAyfgsyVxKYR9k9JPY"},{"role":"assistant","tool_calls":[{"id":"call_6z4JobRNAObALL5j7KfjZ0xo","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mYxGVOPT78IZh99B0JpNscpr","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Julian - Stark IV\", :score=>923}, {:title=>\"Thaddeus Auer\", :score=>148}, {:title=>\"Yong - Lehner DO\", :score=>622}], :next_page=>\"t3_abc123_321\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_6z4JobRNAObALL5j7KfjZ0xo"},{"role":"tool","content":"{:posts=>[{:title=>\"Orville - Paucek\", :score=>640}, {:title=>\"Terrence Zieme\", :score=>425}, {:title=>\"Beulah - Casper\", :score=>476}], :next_page=>\"t3_abc123_613\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_mYxGVOPT78IZh99B0JpNscpr"},{"role":"assistant","tool_calls":[{"id":"call_qzjtQirXooD8SiLNGecmHxoa","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_OcXngJ6QDYjr6H7lOuQtILcC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Sharice - Satterfield\", :score=>613}, {:title=>\"Julietta Greenfelder\", :score=>388}, - {:title=>\"Addie Little\", :score=>16}], :next_page=>\"t3_abc123_500\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_qzjtQirXooD8SiLNGecmHxoa"},{"role":"tool","content":"{:posts=>[{:title=>\"Cesar - Rau\", :score=>942}, {:title=>\"May Schuster\", :score=>207}, {:title=>\"Miranda - O''Conner\", :score=>409}], :next_page=>\"t3_abc123_815\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_OcXngJ6QDYjr6H7lOuQtILcC"},{"role":"assistant","tool_calls":[{"id":"call_vUBH7tVPWqSP1PKTR2uHFxD7","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_xenaDJKczSffSzomAtU5VB9P","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Leslie - Zulauf\", :score=>600}, {:title=>\"Andrew Lind\", :score=>421}, {:title=>\"Fernande - Kub\", :score=>715}], :next_page=>\"t3_abc123_634\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_vUBH7tVPWqSP1PKTR2uHFxD7"},{"role":"tool","content":"{:posts=>[{:title=>\"Ms. - Dewayne Stiedemann\", :score=>130}, {:title=>\"Hung Donnelly Sr.\", :score=>7}, - {:title=>\"Imogene Keeling\", :score=>425}], :next_page=>\"t3_abc123_896\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_xenaDJKczSffSzomAtU5VB9P"},{"role":"assistant","tool_calls":[{"id":"call_tACrL1BU8hquSfphg34WPuCw","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_oNI0QAIyqOeAOdRd2XYkqkIM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Felix - Wehner DO\", :score=>419}, {:title=>\"Adam Boehm\", :score=>244}, {:title=>\"Bettina - Langosh\", :score=>393}], :next_page=>\"t3_abc123_77\", :message=>\"More posts - are available using the next_page token.\"}","tool_call_id":"call_tACrL1BU8hquSfphg34WPuCw"},{"role":"tool","content":"{:posts=>[{:title=>\"Love - Simonis\", :score=>642}, {:title=>\"Adriana Schimmel\", :score=>309}, {:title=>\"Bradford - Emmerich\", :score=>608}], :next_page=>\"t3_abc123_261\", :message=>\"More - posts are available using the next_page token.\"}","tool_call_id":"call_oNI0QAIyqOeAOdRd2XYkqkIM"},{"role":"user","content":"What''s - the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","tool_calls":[{"id":"call_Q43Bgsf9kORBbam1KxFP7Zmb","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current - weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"call_Q43Bgsf9kORBbam1KxFP7Zmb"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_iARhGzusOhmEcNQugV7JTGSB","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_oXlLzIpxHahjlnNrxGcC1I3p","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Karol + Rosenbaum\", :score=>215}, {:title=>\"Leeanne Schaden Ret.\", :score=>949}, + {:title=>\"Nathaniel Tromp\", :score=>137}], :next_page=>\"t3_abc123_583\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_iARhGzusOhmEcNQugV7JTGSB"},{"role":"tool","content":"{:posts=>[{:title=>\"Ada + Abbott\", :score=>195}, {:title=>\"Kurtis King\", :score=>353}, {:title=>\"Dylan + Feest\", :score=>940}], :next_page=>\"t3_abc123_34\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_oXlLzIpxHahjlnNrxGcC1I3p"},{"role":"assistant","tool_calls":[{"id":"call_LAO3pFk25C7hl69JlTCRGPhi","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_mb2F7VaGnluAWBqYRrkpyvFQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Donella + Dickens\", :score=>43}, {:title=>\"Detra Kutch\", :score=>815}, {:title=>\"Rep. + Rudolph Kihn\", :score=>189}], :next_page=>\"t3_abc123_944\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_LAO3pFk25C7hl69JlTCRGPhi"},{"role":"tool","content":"{:posts=>[{:title=>\"Chung + Kassulke\", :score=>325}, {:title=>\"Dr. Jorge Thiel\", :score=>751}, {:title=>\"Christiana + Mayert MD\", :score=>727}], :next_page=>\"t3_abc123_555\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_mb2F7VaGnluAWBqYRrkpyvFQ"},{"role":"assistant","tool_calls":[{"id":"call_khi5QnW0YeTby4CvDmpQIB8P","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_Ec7bc3HczHltwTN6L2g292U0","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Lance + Ondricka\", :score=>478}, {:title=>\"Len Rath\", :score=>718}, {:title=>\"Keitha + McKenzie\", :score=>126}], :next_page=>\"t3_abc123_848\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_khi5QnW0YeTby4CvDmpQIB8P"},{"role":"tool","content":"{:posts=>[{:title=>\"Lacy + Rohan\", :score=>534}, {:title=>\"Syreeta Paucek\", :score=>324}, {:title=>\"Glenn + Bins\", :score=>716}], :next_page=>\"t3_abc123_795\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_Ec7bc3HczHltwTN6L2g292U0"},{"role":"assistant","tool_calls":[{"id":"call_PicL6zj98mGQJefPtyw4yUwy","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_1IfRSvwuy5WwD3a4k0BP8tNQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Maximo + Lakin\", :score=>255}, {:title=>\"Earlean Ullrich\", :score=>346}, {:title=>\"Rodrigo + Wuckert\", :score=>63}], :next_page=>\"t3_abc123_354\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_PicL6zj98mGQJefPtyw4yUwy"},{"role":"tool","content":"{:posts=>[{:title=>\"Deena + Lesch\", :score=>797}, {:title=>\"Zenaida Keeling\", :score=>51}, {:title=>\"Ollie + Hagenes\", :score=>797}], :next_page=>\"t3_abc123_129\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_1IfRSvwuy5WwD3a4k0BP8tNQ"},{"role":"assistant","tool_calls":[{"id":"call_0rnA4WJVpv8uddjL5VUvF4PV","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_kxD1dJUdlGedwrDPUjRiUcdj","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Jude + Klein\", :score=>818}, {:title=>\"Mercy Lynch\", :score=>940}, {:title=>\"Josiah + Bartell\", :score=>442}], :next_page=>\"t3_abc123_553\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_0rnA4WJVpv8uddjL5VUvF4PV"},{"role":"tool","content":"{:posts=>[{:title=>\"Daphne + Treutel\", :score=>672}, {:title=>\"Shanelle Herman\", :score=>253}, {:title=>\"Dr. + Serena Bradtke\", :score=>7}], :next_page=>\"t3_abc123_540\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_kxD1dJUdlGedwrDPUjRiUcdj"},{"role":"assistant","tool_calls":[{"id":"call_iZkAio8U8tRHZomLAFFDuNIV","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_Tmf0sooEevILL1QzITsxmmqd","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Calvin + Carter\", :score=>501}, {:title=>\"Wilber Schaden MD\", :score=>331}, {:title=>\"Chance + Grady\", :score=>881}], :next_page=>\"t3_abc123_690\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_iZkAio8U8tRHZomLAFFDuNIV"},{"role":"tool","content":"{:posts=>[{:title=>\"Lesa + Cummerata\", :score=>202}, {:title=>\"Philip Medhurst\", :score=>318}, {:title=>\"Emmitt + Block MD\", :score=>505}], :next_page=>\"t3_abc123_993\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_Tmf0sooEevILL1QzITsxmmqd"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","tool_calls":[{"id":"call_vQVi7SowdPFzXp5HCPhNbKvO","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"call_vQVi7SowdPFzXp5HCPhNbKvO"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -1074,7 +1103,7 @@ http_interactions: message: OK headers: Date: - - Mon, 07 Apr 2025 11:50:26 GMT + - Thu, 24 Apr 2025 12:10:13 GMT Content-Type: - application/json Transfer-Encoding: @@ -1086,21 +1115,21 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '1030' + - '480' Openai-Version: - '2020-10-01' X-Ratelimit-Limit-Requests: - - '10000' + - '500' X-Ratelimit-Limit-Tokens: - '200000' X-Ratelimit-Remaining-Requests: - - '9991' + - '499' X-Ratelimit-Remaining-Tokens: - - '199292' + - '199242' X-Ratelimit-Reset-Requests: - - 1m16.365s + - 120ms X-Ratelimit-Reset-Tokens: - - 212ms + - 227ms X-Request-Id: - "" Strict-Transport-Security: @@ -1121,6 +1150,6 @@ http_interactions: body: encoding: ASCII-8BIT string: !binary |- - ewogICJpZCI6ICJjaGF0Y21wbC1CSmZIZElHRzVkd0owR3J5V01pOWhCT3FObThPeSIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0NDAyNjYyNSwKICAibW9kZWwiOiAiZ3B0LTRvLW1pbmktMjAyNC0wNy0xOCIsCiAgImNob2ljZXMiOiBbCiAgICB7CiAgICAgICJpbmRleCI6IDAsCiAgICAgICJtZXNzYWdlIjogewogICAgICAgICJyb2xlIjogImFzc2lzdGFudCIsCiAgICAgICAgImNvbnRlbnQiOiAiVGhlIGN1cnJlbnQgd2VhdGhlciBpbiBCZXJsaW4gaXMgMTXCsEMgd2l0aCBhIHdpbmQgc3BlZWQgb2YgMTAga20vaC4iLAogICAgICAgICJyZWZ1c2FsIjogbnVsbCwKICAgICAgICAiYW5ub3RhdGlvbnMiOiBbXQogICAgICB9LAogICAgICAibG9ncHJvYnMiOiBudWxsLAogICAgICAiZmluaXNoX3JlYXNvbiI6ICJzdG9wIgogICAgfQogIF0sCiAgInVzYWdlIjogewogICAgInByb21wdF90b2tlbnMiOiAxMzAyLAogICAgImNvbXBsZXRpb25fdG9rZW5zIjogMjEsCiAgICAidG90YWxfdG9rZW5zIjogMTMyMywKICAgICJwcm9tcHRfdG9rZW5zX2RldGFpbHMiOiB7CiAgICAgICJjYWNoZWRfdG9rZW5zIjogMTAyNCwKICAgICAgImF1ZGlvX3Rva2VucyI6IDAKICAgIH0sCiAgICAiY29tcGxldGlvbl90b2tlbnNfZGV0YWlscyI6IHsKICAgICAgInJlYXNvbmluZ190b2tlbnMiOiAwLAogICAgICAiYXVkaW9fdG9rZW5zIjogMCwKICAgICAgImFjY2VwdGVkX3ByZWRpY3Rpb25fdG9rZW5zIjogMCwKICAgICAgInJlamVjdGVkX3ByZWRpY3Rpb25fdG9rZW5zIjogMAogICAgfQogIH0sCiAgInNlcnZpY2VfdGllciI6ICJkZWZhdWx0IiwKICAic3lzdGVtX2ZpbmdlcnByaW50IjogImZwX2IzNzZkZmJiZDUiCn0K - recorded_at: Mon, 07 Apr 2025 11:50:26 GMT + ewogICJpZCI6ICJjaGF0Y21wbC1CUHBoN2hlODEyN3BUalQ4SjFwbTNTd1Z3RjhjciIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0NTQ5NjYxMywKICAibW9kZWwiOiAiZ3B0LTQuMS1uYW5vLTIwMjUtMDQtMTQiLAogICJjaG9pY2VzIjogWwogICAgewogICAgICAiaW5kZXgiOiAwLAogICAgICAibWVzc2FnZSI6IHsKICAgICAgICAicm9sZSI6ICJhc3Npc3RhbnQiLAogICAgICAgICJjb250ZW50IjogIlRoZSBjdXJyZW50IHdlYXRoZXIgaW4gQmVybGluIGlzIDE1wrBDIHdpdGggYSB3aW5kIHNwZWVkIG9mIDEwIGttL2guIiwKICAgICAgICAicmVmdXNhbCI6IG51bGwsCiAgICAgICAgImFubm90YXRpb25zIjogW10KICAgICAgfSwKICAgICAgImxvZ3Byb2JzIjogbnVsbCwKICAgICAgImZpbmlzaF9yZWFzb24iOiAic3RvcCIKICAgIH0KICBdLAogICJ1c2FnZSI6IHsKICAgICJwcm9tcHRfdG9rZW5zIjogMTQxMCwKICAgICJjb21wbGV0aW9uX3Rva2VucyI6IDIxLAogICAgInRvdGFsX3Rva2VucyI6IDE0MzEsCiAgICAicHJvbXB0X3Rva2Vuc19kZXRhaWxzIjogewogICAgICAiY2FjaGVkX3Rva2VucyI6IDEyODAsCiAgICAgICJhdWRpb190b2tlbnMiOiAwCiAgICB9LAogICAgImNvbXBsZXRpb25fdG9rZW5zX2RldGFpbHMiOiB7CiAgICAgICJyZWFzb25pbmdfdG9rZW5zIjogMCwKICAgICAgImF1ZGlvX3Rva2VucyI6IDAsCiAgICAgICJhY2NlcHRlZF9wcmVkaWN0aW9uX3Rva2VucyI6IDAsCiAgICAgICJyZWplY3RlZF9wcmVkaWN0aW9uX3Rva2VucyI6IDAKICAgIH0KICB9LAogICJzZXJ2aWNlX3RpZXIiOiAiZGVmYXVsdCIsCiAgInN5c3RlbV9maW5nZXJwcmludCI6ICJmcF9lZWRlOGYwZDQ1Igp9Cg== + recorded_at: Thu, 24 Apr 2025 12:10:13 GMT recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_completions_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_completions_limit.yml new file mode 100644 index 00000000..1bd4178f --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_completions_limit.yml @@ -0,0 +1,1155 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 11:49:54 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '502' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199967' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 9ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BPpNRQ3Kf2ZNayo7EwLW9yYCndgty", + "object": "chat.completion", + "created": 1745495393, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_d8qx8jbBFXzZh329crhwdAo2", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_nrzB09UlqiWoGXhixAb04sEC", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 116, + "completion_tokens": 42, + "total_tokens": 158, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_eede8f0d45" + } + recorded_at: Thu, 24 Apr 2025 11:49:54 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_d8qx8jbBFXzZh329crhwdAo2","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_nrzB09UlqiWoGXhixAb04sEC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Ayanna + Kutch\", :score=>828}, {:title=>\"Jaclyn Huel Ret.\", :score=>116}, {:title=>\"Vincenzo + Stoltenberg Ret.\", :score=>452}], :next_page=>\"t3_abc123_754\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_d8qx8jbBFXzZh329crhwdAo2"},{"role":"tool","content":"{:posts=>[{:title=>\"Sherrie + Dickinson\", :score=>310}, {:title=>\"Ezra Gorczany Esq.\", :score=>897}, + {:title=>\"Kathryne Lockman\", :score=>252}], :next_page=>\"t3_abc123_507\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nrzB09UlqiWoGXhixAb04sEC"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 11:49:55 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '511' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199845' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 46ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BPpNS9Akp4Qv04BV0VZAMSLYd7uiN", + "object": "chat.completion", + "created": 1745495394, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_jGIjYrxdxDZCoHhyEcNhaTKp", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_3CdHeNDzCWeNWK4lcE4Oqbb6", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 328, + "completion_tokens": 42, + "total_tokens": 370, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_eede8f0d45" + } + recorded_at: Thu, 24 Apr 2025 11:49:54 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_d8qx8jbBFXzZh329crhwdAo2","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_nrzB09UlqiWoGXhixAb04sEC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Ayanna + Kutch\", :score=>828}, {:title=>\"Jaclyn Huel Ret.\", :score=>116}, {:title=>\"Vincenzo + Stoltenberg Ret.\", :score=>452}], :next_page=>\"t3_abc123_754\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_d8qx8jbBFXzZh329crhwdAo2"},{"role":"tool","content":"{:posts=>[{:title=>\"Sherrie + Dickinson\", :score=>310}, {:title=>\"Ezra Gorczany Esq.\", :score=>897}, + {:title=>\"Kathryne Lockman\", :score=>252}], :next_page=>\"t3_abc123_507\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nrzB09UlqiWoGXhixAb04sEC"},{"role":"assistant","tool_calls":[{"id":"call_jGIjYrxdxDZCoHhyEcNhaTKp","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_3CdHeNDzCWeNWK4lcE4Oqbb6","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Louis + Hansen\", :score=>809}, {:title=>\"Sen. Douglas Stiedemann\", :score=>640}, + {:title=>\"Fr. Isaias Parker\", :score=>817}], :next_page=>\"t3_abc123_679\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_jGIjYrxdxDZCoHhyEcNhaTKp"},{"role":"tool","content":"{:posts=>[{:title=>\"Emerita + Toy\", :score=>302}, {:title=>\"Thomas Effertz\", :score=>168}, {:title=>\"Shasta + Hayes\", :score=>720}], :next_page=>\"t3_abc123_25\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_3CdHeNDzCWeNWK4lcE4Oqbb6"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 11:49:55 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '494' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199728' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 81ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BPpNTPowUpnBC6JpnieMvwiOT8KjJ", + "object": "chat.completion", + "created": 1745495395, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_HdJrQKB0CdKBjQqwhR7DfuMl", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_QAScwdX87rVNoMe3ssPl7iQs", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 528, + "completion_tokens": 42, + "total_tokens": 570, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_eede8f0d45" + } + recorded_at: Thu, 24 Apr 2025 11:49:55 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_d8qx8jbBFXzZh329crhwdAo2","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_nrzB09UlqiWoGXhixAb04sEC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Ayanna + Kutch\", :score=>828}, {:title=>\"Jaclyn Huel Ret.\", :score=>116}, {:title=>\"Vincenzo + Stoltenberg Ret.\", :score=>452}], :next_page=>\"t3_abc123_754\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_d8qx8jbBFXzZh329crhwdAo2"},{"role":"tool","content":"{:posts=>[{:title=>\"Sherrie + Dickinson\", :score=>310}, {:title=>\"Ezra Gorczany Esq.\", :score=>897}, + {:title=>\"Kathryne Lockman\", :score=>252}], :next_page=>\"t3_abc123_507\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nrzB09UlqiWoGXhixAb04sEC"},{"role":"assistant","tool_calls":[{"id":"call_jGIjYrxdxDZCoHhyEcNhaTKp","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_3CdHeNDzCWeNWK4lcE4Oqbb6","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Louis + Hansen\", :score=>809}, {:title=>\"Sen. Douglas Stiedemann\", :score=>640}, + {:title=>\"Fr. Isaias Parker\", :score=>817}], :next_page=>\"t3_abc123_679\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_jGIjYrxdxDZCoHhyEcNhaTKp"},{"role":"tool","content":"{:posts=>[{:title=>\"Emerita + Toy\", :score=>302}, {:title=>\"Thomas Effertz\", :score=>168}, {:title=>\"Shasta + Hayes\", :score=>720}], :next_page=>\"t3_abc123_25\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_3CdHeNDzCWeNWK4lcE4Oqbb6"},{"role":"assistant","tool_calls":[{"id":"call_HdJrQKB0CdKBjQqwhR7DfuMl","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_QAScwdX87rVNoMe3ssPl7iQs","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Quintin + Crooks CPA\", :score=>661}, {:title=>\"Diego Conn\", :score=>441}, {:title=>\"Pres. + Darin Macejkovic\", :score=>454}], :next_page=>\"t3_abc123_514\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_HdJrQKB0CdKBjQqwhR7DfuMl"},{"role":"tool","content":"{:posts=>[{:title=>\"Mary + Conroy\", :score=>797}, {:title=>\"Miss Halley Swift\", :score=>3}, {:title=>\"Mrs. + Rene Schmitt\", :score=>260}], :next_page=>\"t3_abc123_900\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_QAScwdX87rVNoMe3ssPl7iQs"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 11:49:57 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '691' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199608' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 117ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BPpNUwNwXUdXoYi0Yzn2QSOqctZt9", + "object": "chat.completion", + "created": 1745495396, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_KKc6pmjmScPWptd3wVWM1yEs", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_xdn8oJDDQnAnpdR4ZsoU4rWL", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 736, + "completion_tokens": 42, + "total_tokens": 778, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_eede8f0d45" + } + recorded_at: Thu, 24 Apr 2025 11:49:56 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_d8qx8jbBFXzZh329crhwdAo2","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_nrzB09UlqiWoGXhixAb04sEC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Ayanna + Kutch\", :score=>828}, {:title=>\"Jaclyn Huel Ret.\", :score=>116}, {:title=>\"Vincenzo + Stoltenberg Ret.\", :score=>452}], :next_page=>\"t3_abc123_754\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_d8qx8jbBFXzZh329crhwdAo2"},{"role":"tool","content":"{:posts=>[{:title=>\"Sherrie + Dickinson\", :score=>310}, {:title=>\"Ezra Gorczany Esq.\", :score=>897}, + {:title=>\"Kathryne Lockman\", :score=>252}], :next_page=>\"t3_abc123_507\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nrzB09UlqiWoGXhixAb04sEC"},{"role":"assistant","tool_calls":[{"id":"call_jGIjYrxdxDZCoHhyEcNhaTKp","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_3CdHeNDzCWeNWK4lcE4Oqbb6","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Louis + Hansen\", :score=>809}, {:title=>\"Sen. Douglas Stiedemann\", :score=>640}, + {:title=>\"Fr. Isaias Parker\", :score=>817}], :next_page=>\"t3_abc123_679\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_jGIjYrxdxDZCoHhyEcNhaTKp"},{"role":"tool","content":"{:posts=>[{:title=>\"Emerita + Toy\", :score=>302}, {:title=>\"Thomas Effertz\", :score=>168}, {:title=>\"Shasta + Hayes\", :score=>720}], :next_page=>\"t3_abc123_25\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_3CdHeNDzCWeNWK4lcE4Oqbb6"},{"role":"assistant","tool_calls":[{"id":"call_HdJrQKB0CdKBjQqwhR7DfuMl","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_QAScwdX87rVNoMe3ssPl7iQs","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Quintin + Crooks CPA\", :score=>661}, {:title=>\"Diego Conn\", :score=>441}, {:title=>\"Pres. + Darin Macejkovic\", :score=>454}], :next_page=>\"t3_abc123_514\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_HdJrQKB0CdKBjQqwhR7DfuMl"},{"role":"tool","content":"{:posts=>[{:title=>\"Mary + Conroy\", :score=>797}, {:title=>\"Miss Halley Swift\", :score=>3}, {:title=>\"Mrs. + Rene Schmitt\", :score=>260}], :next_page=>\"t3_abc123_900\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_QAScwdX87rVNoMe3ssPl7iQs"},{"role":"assistant","tool_calls":[{"id":"call_KKc6pmjmScPWptd3wVWM1yEs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_xdn8oJDDQnAnpdR4ZsoU4rWL","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Kasey + Gerhold\", :score=>196}, {:title=>\"Karri Bahringer\", :score=>392}, {:title=>\"Rev. + Jeffrey Crona\", :score=>653}], :next_page=>\"t3_abc123_22\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_KKc6pmjmScPWptd3wVWM1yEs"},{"role":"tool","content":"{:posts=>[{:title=>\"Gov. + Demarcus Emmerich\", :score=>568}, {:title=>\"Gerry Bradtke DVM\", :score=>393}, + {:title=>\"Ethel Hammes DVM\", :score=>702}], :next_page=>\"t3_abc123_148\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_xdn8oJDDQnAnpdR4ZsoU4rWL"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 11:49:58 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '721' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199488' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 153ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BPpNVjbf4UQZRQFzopwSVQ8LK6rG6", + "object": "chat.completion", + "created": 1745495397, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_XUfo5dMMm1gmfae28rfynI3G", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_Ib84TlF5oUBAEOUdRRUIQKf4", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 949, + "completion_tokens": 42, + "total_tokens": 991, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_eede8f0d45" + } + recorded_at: Thu, 24 Apr 2025 11:49:57 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_d8qx8jbBFXzZh329crhwdAo2","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_nrzB09UlqiWoGXhixAb04sEC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Ayanna + Kutch\", :score=>828}, {:title=>\"Jaclyn Huel Ret.\", :score=>116}, {:title=>\"Vincenzo + Stoltenberg Ret.\", :score=>452}], :next_page=>\"t3_abc123_754\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_d8qx8jbBFXzZh329crhwdAo2"},{"role":"tool","content":"{:posts=>[{:title=>\"Sherrie + Dickinson\", :score=>310}, {:title=>\"Ezra Gorczany Esq.\", :score=>897}, + {:title=>\"Kathryne Lockman\", :score=>252}], :next_page=>\"t3_abc123_507\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nrzB09UlqiWoGXhixAb04sEC"},{"role":"assistant","tool_calls":[{"id":"call_jGIjYrxdxDZCoHhyEcNhaTKp","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_3CdHeNDzCWeNWK4lcE4Oqbb6","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Louis + Hansen\", :score=>809}, {:title=>\"Sen. Douglas Stiedemann\", :score=>640}, + {:title=>\"Fr. Isaias Parker\", :score=>817}], :next_page=>\"t3_abc123_679\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_jGIjYrxdxDZCoHhyEcNhaTKp"},{"role":"tool","content":"{:posts=>[{:title=>\"Emerita + Toy\", :score=>302}, {:title=>\"Thomas Effertz\", :score=>168}, {:title=>\"Shasta + Hayes\", :score=>720}], :next_page=>\"t3_abc123_25\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_3CdHeNDzCWeNWK4lcE4Oqbb6"},{"role":"assistant","tool_calls":[{"id":"call_HdJrQKB0CdKBjQqwhR7DfuMl","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_QAScwdX87rVNoMe3ssPl7iQs","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Quintin + Crooks CPA\", :score=>661}, {:title=>\"Diego Conn\", :score=>441}, {:title=>\"Pres. + Darin Macejkovic\", :score=>454}], :next_page=>\"t3_abc123_514\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_HdJrQKB0CdKBjQqwhR7DfuMl"},{"role":"tool","content":"{:posts=>[{:title=>\"Mary + Conroy\", :score=>797}, {:title=>\"Miss Halley Swift\", :score=>3}, {:title=>\"Mrs. + Rene Schmitt\", :score=>260}], :next_page=>\"t3_abc123_900\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_QAScwdX87rVNoMe3ssPl7iQs"},{"role":"assistant","tool_calls":[{"id":"call_KKc6pmjmScPWptd3wVWM1yEs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_xdn8oJDDQnAnpdR4ZsoU4rWL","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Kasey + Gerhold\", :score=>196}, {:title=>\"Karri Bahringer\", :score=>392}, {:title=>\"Rev. + Jeffrey Crona\", :score=>653}], :next_page=>\"t3_abc123_22\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_KKc6pmjmScPWptd3wVWM1yEs"},{"role":"tool","content":"{:posts=>[{:title=>\"Gov. + Demarcus Emmerich\", :score=>568}, {:title=>\"Gerry Bradtke DVM\", :score=>393}, + {:title=>\"Ethel Hammes DVM\", :score=>702}], :next_page=>\"t3_abc123_148\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_xdn8oJDDQnAnpdR4ZsoU4rWL"},{"role":"assistant","tool_calls":[{"id":"call_XUfo5dMMm1gmfae28rfynI3G","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_Ib84TlF5oUBAEOUdRRUIQKf4","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Joslyn + McCullough IV\", :score=>325}, {:title=>\"Emmanuel Swift II\", :score=>469}, + {:title=>\"Lonny Jakubowski PhD\", :score=>467}], :next_page=>\"t3_abc123_208\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_XUfo5dMMm1gmfae28rfynI3G"},{"role":"tool","content":"{:posts=>[{:title=>\"Dr. + Alissa Denesik\", :score=>665}, {:title=>\"Emil Gleichner\", :score=>283}, + {:title=>\"Lakiesha Funk\", :score=>186}], :next_page=>\"t3_abc123_801\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_Ib84TlF5oUBAEOUdRRUIQKf4"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 11:49:58 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '572' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199367' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 189ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BPpNWfx17JSlItbDfJ58V0R2o0fuv", + "object": "chat.completion", + "created": 1745495398, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_0wUmxw4Zgw2d6fbfb8a6sOVB", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_jz73d0gM9I95M4c3sZWAOf2J", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 1159, + "completion_tokens": 42, + "total_tokens": 1201, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_eede8f0d45" + } + recorded_at: Thu, 24 Apr 2025 11:49:58 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_d8qx8jbBFXzZh329crhwdAo2","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_nrzB09UlqiWoGXhixAb04sEC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Ayanna + Kutch\", :score=>828}, {:title=>\"Jaclyn Huel Ret.\", :score=>116}, {:title=>\"Vincenzo + Stoltenberg Ret.\", :score=>452}], :next_page=>\"t3_abc123_754\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_d8qx8jbBFXzZh329crhwdAo2"},{"role":"tool","content":"{:posts=>[{:title=>\"Sherrie + Dickinson\", :score=>310}, {:title=>\"Ezra Gorczany Esq.\", :score=>897}, + {:title=>\"Kathryne Lockman\", :score=>252}], :next_page=>\"t3_abc123_507\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nrzB09UlqiWoGXhixAb04sEC"},{"role":"assistant","tool_calls":[{"id":"call_jGIjYrxdxDZCoHhyEcNhaTKp","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_3CdHeNDzCWeNWK4lcE4Oqbb6","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Louis + Hansen\", :score=>809}, {:title=>\"Sen. Douglas Stiedemann\", :score=>640}, + {:title=>\"Fr. Isaias Parker\", :score=>817}], :next_page=>\"t3_abc123_679\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_jGIjYrxdxDZCoHhyEcNhaTKp"},{"role":"tool","content":"{:posts=>[{:title=>\"Emerita + Toy\", :score=>302}, {:title=>\"Thomas Effertz\", :score=>168}, {:title=>\"Shasta + Hayes\", :score=>720}], :next_page=>\"t3_abc123_25\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_3CdHeNDzCWeNWK4lcE4Oqbb6"},{"role":"assistant","tool_calls":[{"id":"call_HdJrQKB0CdKBjQqwhR7DfuMl","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_QAScwdX87rVNoMe3ssPl7iQs","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Quintin + Crooks CPA\", :score=>661}, {:title=>\"Diego Conn\", :score=>441}, {:title=>\"Pres. + Darin Macejkovic\", :score=>454}], :next_page=>\"t3_abc123_514\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_HdJrQKB0CdKBjQqwhR7DfuMl"},{"role":"tool","content":"{:posts=>[{:title=>\"Mary + Conroy\", :score=>797}, {:title=>\"Miss Halley Swift\", :score=>3}, {:title=>\"Mrs. + Rene Schmitt\", :score=>260}], :next_page=>\"t3_abc123_900\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_QAScwdX87rVNoMe3ssPl7iQs"},{"role":"assistant","tool_calls":[{"id":"call_KKc6pmjmScPWptd3wVWM1yEs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_xdn8oJDDQnAnpdR4ZsoU4rWL","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Kasey + Gerhold\", :score=>196}, {:title=>\"Karri Bahringer\", :score=>392}, {:title=>\"Rev. + Jeffrey Crona\", :score=>653}], :next_page=>\"t3_abc123_22\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_KKc6pmjmScPWptd3wVWM1yEs"},{"role":"tool","content":"{:posts=>[{:title=>\"Gov. + Demarcus Emmerich\", :score=>568}, {:title=>\"Gerry Bradtke DVM\", :score=>393}, + {:title=>\"Ethel Hammes DVM\", :score=>702}], :next_page=>\"t3_abc123_148\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_xdn8oJDDQnAnpdR4ZsoU4rWL"},{"role":"assistant","tool_calls":[{"id":"call_XUfo5dMMm1gmfae28rfynI3G","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_Ib84TlF5oUBAEOUdRRUIQKf4","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Joslyn + McCullough IV\", :score=>325}, {:title=>\"Emmanuel Swift II\", :score=>469}, + {:title=>\"Lonny Jakubowski PhD\", :score=>467}], :next_page=>\"t3_abc123_208\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_XUfo5dMMm1gmfae28rfynI3G"},{"role":"tool","content":"{:posts=>[{:title=>\"Dr. + Alissa Denesik\", :score=>665}, {:title=>\"Emil Gleichner\", :score=>283}, + {:title=>\"Lakiesha Funk\", :score=>186}], :next_page=>\"t3_abc123_801\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_Ib84TlF5oUBAEOUdRRUIQKf4"},{"role":"assistant","tool_calls":[{"id":"call_0wUmxw4Zgw2d6fbfb8a6sOVB","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_jz73d0gM9I95M4c3sZWAOf2J","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Sen. + Paris Effertz\", :score=>649}, {:title=>\"Rachal Farrell Jr.\", :score=>670}, + {:title=>\"Kiesha Quitzon\", :score=>393}], :next_page=>\"t3_abc123_247\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_0wUmxw4Zgw2d6fbfb8a6sOVB"},{"role":"tool","content":"{:posts=>[{:title=>\"Ms. + Tamica Denesik\", :score=>556}, {:title=>\"Maxie Homenick\", :score=>719}, + {:title=>\"Ingeborg Sanford III\", :score=>961}], :next_page=>\"t3_abc123_901\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_jz73d0gM9I95M4c3sZWAOf2J"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 11:49:59 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '441' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199233' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 229ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BPpNXH91MxYK9r2EwmH6at3AlYARs", + "object": "chat.completion", + "created": 1745495399, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_WhsB6G8UcXtSXxgHsxr2K3xE", + "type": "function", + "function": { + "name": "weather", + "arguments": "{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 1391, + "completion_tokens": 24, + "total_tokens": 1415, + "prompt_tokens_details": { + "cached_tokens": 1152, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_eede8f0d45" + } + recorded_at: Thu, 24 Apr 2025 11:49:59 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array"},{"role":"assistant","tool_calls":[{"id":"call_d8qx8jbBFXzZh329crhwdAo2","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_nrzB09UlqiWoGXhixAb04sEC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Ayanna + Kutch\", :score=>828}, {:title=>\"Jaclyn Huel Ret.\", :score=>116}, {:title=>\"Vincenzo + Stoltenberg Ret.\", :score=>452}], :next_page=>\"t3_abc123_754\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_d8qx8jbBFXzZh329crhwdAo2"},{"role":"tool","content":"{:posts=>[{:title=>\"Sherrie + Dickinson\", :score=>310}, {:title=>\"Ezra Gorczany Esq.\", :score=>897}, + {:title=>\"Kathryne Lockman\", :score=>252}], :next_page=>\"t3_abc123_507\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nrzB09UlqiWoGXhixAb04sEC"},{"role":"assistant","tool_calls":[{"id":"call_jGIjYrxdxDZCoHhyEcNhaTKp","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_3CdHeNDzCWeNWK4lcE4Oqbb6","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Louis + Hansen\", :score=>809}, {:title=>\"Sen. Douglas Stiedemann\", :score=>640}, + {:title=>\"Fr. Isaias Parker\", :score=>817}], :next_page=>\"t3_abc123_679\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_jGIjYrxdxDZCoHhyEcNhaTKp"},{"role":"tool","content":"{:posts=>[{:title=>\"Emerita + Toy\", :score=>302}, {:title=>\"Thomas Effertz\", :score=>168}, {:title=>\"Shasta + Hayes\", :score=>720}], :next_page=>\"t3_abc123_25\", :message=>\"More posts + are available using the next_page token.\"}","tool_call_id":"call_3CdHeNDzCWeNWK4lcE4Oqbb6"},{"role":"assistant","tool_calls":[{"id":"call_HdJrQKB0CdKBjQqwhR7DfuMl","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_QAScwdX87rVNoMe3ssPl7iQs","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Quintin + Crooks CPA\", :score=>661}, {:title=>\"Diego Conn\", :score=>441}, {:title=>\"Pres. + Darin Macejkovic\", :score=>454}], :next_page=>\"t3_abc123_514\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_HdJrQKB0CdKBjQqwhR7DfuMl"},{"role":"tool","content":"{:posts=>[{:title=>\"Mary + Conroy\", :score=>797}, {:title=>\"Miss Halley Swift\", :score=>3}, {:title=>\"Mrs. + Rene Schmitt\", :score=>260}], :next_page=>\"t3_abc123_900\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_QAScwdX87rVNoMe3ssPl7iQs"},{"role":"assistant","tool_calls":[{"id":"call_KKc6pmjmScPWptd3wVWM1yEs","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_xdn8oJDDQnAnpdR4ZsoU4rWL","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Kasey + Gerhold\", :score=>196}, {:title=>\"Karri Bahringer\", :score=>392}, {:title=>\"Rev. + Jeffrey Crona\", :score=>653}], :next_page=>\"t3_abc123_22\", :message=>\"More + posts are available using the next_page token.\"}","tool_call_id":"call_KKc6pmjmScPWptd3wVWM1yEs"},{"role":"tool","content":"{:posts=>[{:title=>\"Gov. + Demarcus Emmerich\", :score=>568}, {:title=>\"Gerry Bradtke DVM\", :score=>393}, + {:title=>\"Ethel Hammes DVM\", :score=>702}], :next_page=>\"t3_abc123_148\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_xdn8oJDDQnAnpdR4ZsoU4rWL"},{"role":"assistant","tool_calls":[{"id":"call_XUfo5dMMm1gmfae28rfynI3G","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_Ib84TlF5oUBAEOUdRRUIQKf4","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Joslyn + McCullough IV\", :score=>325}, {:title=>\"Emmanuel Swift II\", :score=>469}, + {:title=>\"Lonny Jakubowski PhD\", :score=>467}], :next_page=>\"t3_abc123_208\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_XUfo5dMMm1gmfae28rfynI3G"},{"role":"tool","content":"{:posts=>[{:title=>\"Dr. + Alissa Denesik\", :score=>665}, {:title=>\"Emil Gleichner\", :score=>283}, + {:title=>\"Lakiesha Funk\", :score=>186}], :next_page=>\"t3_abc123_801\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_Ib84TlF5oUBAEOUdRRUIQKf4"},{"role":"assistant","tool_calls":[{"id":"call_0wUmxw4Zgw2d6fbfb8a6sOVB","type":"function","function":{"name":"looping_answer","arguments":"{}"}},{"id":"call_jz73d0gM9I95M4c3sZWAOf2J","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Sen. + Paris Effertz\", :score=>649}, {:title=>\"Rachal Farrell Jr.\", :score=>670}, + {:title=>\"Kiesha Quitzon\", :score=>393}], :next_page=>\"t3_abc123_247\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_0wUmxw4Zgw2d6fbfb8a6sOVB"},{"role":"tool","content":"{:posts=>[{:title=>\"Ms. + Tamica Denesik\", :score=>556}, {:title=>\"Maxie Homenick\", :score=>719}, + {:title=>\"Ingeborg Sanford III\", :score=>961}], :next_page=>\"t3_abc123_901\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_jz73d0gM9I95M4c3sZWAOf2J"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","tool_calls":[{"id":"call_WhsB6G8UcXtSXxgHsxr2K3xE","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"call_WhsB6G8UcXtSXxgHsxr2K3xE"}],"temperature":0.7,"stream":false,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 24 Apr 2025 11:50:00 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '686' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199216' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 234ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: !binary |- + ewogICJpZCI6ICJjaGF0Y21wbC1CUHBOWWc1T2tKR3BCZnprd3NLOFhNMWxwa3dEcCIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0NTQ5NTQwMCwKICAibW9kZWwiOiAiZ3B0LTQuMS1uYW5vLTIwMjUtMDQtMTQiLAogICJjaG9pY2VzIjogWwogICAgewogICAgICAiaW5kZXgiOiAwLAogICAgICAibWVzc2FnZSI6IHsKICAgICAgICAicm9sZSI6ICJhc3Npc3RhbnQiLAogICAgICAgICJjb250ZW50IjogIlRoZSBjdXJyZW50IHdlYXRoZXIgaW4gQmVybGluIGlzIDE1wrBDIHdpdGggYSB3aW5kIHNwZWVkIG9mIDEwIGttL2guIiwKICAgICAgICAicmVmdXNhbCI6IG51bGwsCiAgICAgICAgImFubm90YXRpb25zIjogW10KICAgICAgfSwKICAgICAgImxvZ3Byb2JzIjogbnVsbCwKICAgICAgImZpbmlzaF9yZWFzb24iOiAic3RvcCIKICAgIH0KICBdLAogICJ1c2FnZSI6IHsKICAgICJwcm9tcHRfdG9rZW5zIjogMTQ0NiwKICAgICJjb21wbGV0aW9uX3Rva2VucyI6IDIxLAogICAgInRvdGFsX3Rva2VucyI6IDE0NjcsCiAgICAicHJvbXB0X3Rva2Vuc19kZXRhaWxzIjogewogICAgICAiY2FjaGVkX3Rva2VucyI6IDEyODAsCiAgICAgICJhdWRpb190b2tlbnMiOiAwCiAgICB9LAogICAgImNvbXBsZXRpb25fdG9rZW5zX2RldGFpbHMiOiB7CiAgICAgICJyZWFzb25pbmdfdG9rZW5zIjogMCwKICAgICAgImF1ZGlvX3Rva2VucyI6IDAsCiAgICAgICJhY2NlcHRlZF9wcmVkaWN0aW9uX3Rva2VucyI6IDAsCiAgICAgICJyZWplY3RlZF9wcmVkaWN0aW9uX3Rva2VucyI6IDAKICAgIH0KICB9LAogICJzZXJ2aWNlX3RpZXIiOiAiZGVmYXVsdCIsCiAgInN5c3RlbV9maW5nZXJwcmludCI6ICJmcF9lZWRlOGYwZDQ1Igp9Cg== + recorded_at: Thu, 24 Apr 2025 11:50:00 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index ab276611..a5696098 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -146,6 +146,27 @@ def execute expect(response.content).to include('10') end + it "#{model} can use tools with a configured tool completions limit" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations + RubyLLM.configure do |config| + config.max_tool_completions = 5 + end + + chat = RubyLLM.chat(model: model) + .with_tools(LoopingAnswer, Weather) + + expect do + chat.ask( + 'Fetch all of the posts from r/RandomNames. ' \ + 'Fetch the next_page listed in the response until it responds with an empty array' + ) + end.to raise_error(RubyLLM::ToolCallCompletionsLimitReachedError) + + # Ensure it does not break the next ask. + next_response = chat.ask("What's the weather in Berlin? (52.5200, 13.4050)") + expect(next_response.content).to include('15') + expect(next_response.content).to include('10') + end + it "#{model} can use tools with a tool completions limit" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations chat = RubyLLM.chat(model: model) .with_max_tool_completions(5) From 5a44bfff8d429135f94ca6ffd4e4118d642767eb Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Thu, 24 Apr 2025 22:16:18 +1000 Subject: [PATCH 16/26] docs: adjust tools docs --- docs/guides/tools.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guides/tools.md b/docs/guides/tools.md index 651f42fa..52b66bf3 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -204,14 +204,14 @@ This can be performed on a per chat basis or provided in the global configuratio ```ruby # Set a maximum number of tool completions per instantiated chat object -chat = RubyLLM.chat(max_tool_completions: 5) +chat = RubyLLM.chat.with_max_tool_completions(5) chat.ask "Question that triggers tools loop" # => `execute_tool': Tool completions limit reached: 5 (RubyLLM::ToolCallCompletionsReachedError) ``` If you wish to remove this safe-guard you can set the max_tool_completions to `nil`. ```ruby -chat = RubyLLM.chat(max_tool_completions: nil) +chat = RubyLLM.chat.with_max_tool_completions(nil) chat.ask "Question that triggers tools loop" # Loops until you've used all your credit... ``` @@ -231,7 +231,7 @@ This setting can still be overridden per-chat when needed: ```ruby # Override the global setting for this specific chat -chat = RubyLLM.chat(max_tool_completions: 15) +chat = RubyLLM.chat.with_max_tool_completions(5) ``` ## Security Considerations From d09ce9280ab0543e485fa9ffc341f39230645f77 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Sat, 3 May 2025 12:58:26 +1000 Subject: [PATCH 17/26] bug: ensure with_max_tool_completions available through acts_as helpers --- lib/ruby_llm/active_record/acts_as.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ruby_llm/active_record/acts_as.rb b/lib/ruby_llm/active_record/acts_as.rb index 3520cf60..c3d641f8 100644 --- a/lib/ruby_llm/active_record/acts_as.rb +++ b/lib/ruby_llm/active_record/acts_as.rb @@ -103,6 +103,11 @@ def with_tools(...) self end + def with_max_tool_completions(...) + to_llm.with_max_tool_completions(...) + self + end + def with_model(...) to_llm.with_model(...) self From 018cc3b8937d1c11fbe20bbe6369bdc80b0a16bc Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Wed, 11 Jun 2025 23:18:24 +1000 Subject: [PATCH 18/26] deps: remove faker gem --- Gemfile | 1 - spec/ruby_llm/chat_tools_spec.rb | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 1d56c9eb..77f77d5f 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,6 @@ group :development do gem 'bundler', '>= 2.0' gem 'codecov' gem 'dotenv' - gem 'faker' gem 'ferrum' gem 'irb' gem 'nokogiri' diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index a5696098..7e5c1381 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -26,13 +26,17 @@ def execute class LoopingAnswer < RubyLLM::Tool # rubocop:disable Lint/ConstantDefinitionInBlock,RSpec/LeakyConstantDeclaration description 'Fetches posts from the r/RandomNames Reddit community.' + def generate_fake_title + "Topic #{SecureRandom.hex(10)}" + end + def execute # Fake some posts encouraging fetching the next page { posts: [ - { title: Faker::Name.name, score: rand(1000) }, - { title: Faker::Name.name, score: rand(1000) }, - { title: Faker::Name.name, score: rand(1000) } + { title: generate_fake_title, score: rand(1000) }, + { title: generate_fake_title, score: rand(1000) }, + { title: generate_fake_title, score: rand(1000) } ], next_page: "t3_abc123_#{rand(1000)}", message: 'More posts are available using the next_page token.' From 4cb6765da82fa86716284b4bc2a779df23e6f4bb Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Wed, 11 Jun 2025 23:22:30 +1000 Subject: [PATCH 19/26] chore: use existing context instead of with_max_tool_completions --- lib/ruby_llm/active_record/acts_as.rb | 5 ----- lib/ruby_llm/chat.rb | 14 ++++++-------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/ruby_llm/active_record/acts_as.rb b/lib/ruby_llm/active_record/acts_as.rb index 8c8548ce..5b915391 100644 --- a/lib/ruby_llm/active_record/acts_as.rb +++ b/lib/ruby_llm/active_record/acts_as.rb @@ -115,11 +115,6 @@ def with_tools(...) self end - def with_max_tool_completions(...) - to_llm.with_max_tool_completions(...) - self - end - def with_model(...) update(model_id: to_llm.with_model(...).model.id) self diff --git a/lib/ruby_llm/chat.rb b/lib/ruby_llm/chat.rb index c1953f00..642fdba7 100644 --- a/lib/ruby_llm/chat.rb +++ b/lib/ruby_llm/chat.rb @@ -11,7 +11,7 @@ module RubyLLM class Chat include Enumerable - attr_reader :model, :messages, :tools, :number_of_tool_completions + attr_reader :model, :messages, :tools def initialize(model: nil, provider: nil, assume_model_exists: false, context: nil) if assume_model_exists && !provider @@ -29,7 +29,7 @@ def initialize(model: nil, provider: nil, assume_model_exists: false, context: n new_message: nil, end_message: nil } - @max_tool_completions = config.max_tool_completions + @max_tool_completions = @config.max_tool_completions @number_of_tool_completions = 0 end @@ -64,11 +64,6 @@ def with_tools(*tools) self end - def with_max_tool_completions(max_tool_completions) - @max_tool_completions = max_tool_completions - self - end - def with_model(model_id, provider: nil, assume_exists: false) @model, @provider = Models.resolve(model_id, provider:, assume_exists:) @connection = @context ? @context.connection_for(@provider) : @provider.connection(@config) @@ -82,7 +77,10 @@ def with_temperature(temperature) def with_context(context) @context = context - @config = context.config + if context.config + @config = context.config + @max_tool_completions = @config.max_tool_completions + end with_model(@model.id, provider: @provider.slug, assume_exists: true) self end From 6cb8ec317b81715c07c87c0ffa0baf8b1b494a75 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Wed, 11 Jun 2025 23:26:58 +1000 Subject: [PATCH 20/26] test: adjust spec for context use --- spec/ruby_llm/chat_tools_spec.rb | 7 +++++-- spec/spec_helper.rb | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index 7e5c1381..08bb6c15 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -171,9 +171,12 @@ def execute expect(next_response.content).to include('10') end - it "#{model} can use tools with a tool completions limit" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations + it "#{model} can use tools with a tool completions limit using context" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations + context = RubyLLM.context do |ctx| + ctx.max_tool_completions = 5 + end chat = RubyLLM.chat(model: model) - .with_max_tool_completions(5) + .with_context(context) .with_tools(LoopingAnswer, Weather) expect do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2d5e4648..4d436c41 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -42,7 +42,6 @@ require 'fileutils' require 'ruby_llm' require 'webmock/rspec' -require 'faker' # VCR Configuration VCR.configure do |config| From 4cdb924bebfa5fbd5b62f588b8b056f0b4ff3880 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Thu, 12 Jun 2025 20:32:21 +1000 Subject: [PATCH 21/26] chore: rename to max_tool_llm_calls --- docs/guides/tools.md | 18 +++++++++++------- lib/ruby_llm/chat.rb | 20 ++++++++++---------- lib/ruby_llm/configuration.rb | 4 ++-- spec/ruby_llm/chat_tools_spec.rb | 4 ++-- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/docs/guides/tools.md b/docs/guides/tools.md index 848a8701..57c6b09e 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -200,22 +200,26 @@ Proper error handling within your `execute` method is crucial. See the [Error Handling Guide]({% link guides/error-handling.md %}#handling-errors-within-tools) for more discussion. -## Maximum Tool Completion Limiting +## Maximum Tool LLM Requests When including tools it is important to consider if the response could trigger unintended recursive calls to the provider. RubyLLM provides built-in protection by providing a default limit of 25, which can be overridden or turned off entirely. -This can be performed on a per chat basis or provided in the global configuration. +Note this is a limit on the number of requests made to the provider, not the number of tool calls made by the application. **The limit is checked after all the requested tool executions have been performed**, this is to prevent the chat from +becoming invalid if you wish to continue the conversation after the error. + +This can be performed on a per chat basis using `RubyLLM.context` (see configuration documentation) or provided in the global configuration. ```ruby # Set a maximum number of tool completions per instantiated chat object -chat = RubyLLM.chat.with_max_tool_completions(5) +context = RubyLLM.context do { |ctx| ctx.max_tool_llm_calls = 5 } +chat = RubyLLM.chat.with_context(context) chat.ask "Question that triggers tools loop" # => `execute_tool': Tool completions limit reached: 5 (RubyLLM::ToolCallCompletionsReachedError) ``` -If you wish to remove this safe-guard you can set the max_tool_completions to `nil`. +If you wish to remove this safe-guard you can set the max_tool_llm_calls to `nil`. ```ruby -chat = RubyLLM.chat.with_max_tool_completions(nil) +chat = RubyLLM.chat.with_max_tool_llm_calls(nil) chat.ask "Question that triggers tools loop" # Loops until you've used all your credit... ``` @@ -227,7 +231,7 @@ You can set a default maximum tool completion limit for all chats through the gl ```ruby RubyLLM.configure do |config| # Default is 25 calls per conversation - config.max_tool_completions = 10 # Set a more conservative limit + config.max_tool_llm_calls = 10 # Set a more conservative limit end ``` @@ -235,7 +239,7 @@ This setting can still be overridden per-chat when needed: ```ruby # Override the global setting for this specific chat -chat = RubyLLM.chat.with_max_tool_completions(5) +chat = RubyLLM.chat.with_max_tool_llm_calls(5) ``` ## Security Considerations diff --git a/lib/ruby_llm/chat.rb b/lib/ruby_llm/chat.rb index 642fdba7..21e052db 100644 --- a/lib/ruby_llm/chat.rb +++ b/lib/ruby_llm/chat.rb @@ -29,12 +29,12 @@ def initialize(model: nil, provider: nil, assume_model_exists: false, context: n new_message: nil, end_message: nil } - @max_tool_completions = @config.max_tool_completions - @number_of_tool_completions = 0 + @max_tool_llm_calls = @config.max_tool_llm_calls + @number_of_tool_llm_calls = 0 end def ask(message = nil, with: nil, &) - @number_of_tool_completions = 0 + @number_of_tool_llm_calls = 0 add_message role: :user, content: Content.new(message, with) complete(&) @@ -79,7 +79,7 @@ def with_context(context) @context = context if context.config @config = context.config - @max_tool_completions = @config.max_tool_completions + @max_tool_llm_calls = @config.max_tool_llm_calls end with_model(@model.id, provider: @provider.slug, assume_exists: true) self @@ -139,11 +139,11 @@ def handle_tool_calls(response, &) @on[:end_message]&.call(message) end - if max_tool_completions_reached? - raise ToolCallCompletionsLimitReachedError, "Tool completions limit reached: #{@max_tool_completions}" + if max_tool_llm_calls_reached? + raise ToolCallCompletionsLimitReachedError, "Tool LLM calls limit reached: #{@max_tool_llm_calls}" end - @number_of_tool_completions += 1 + @number_of_tool_llm_calls += 1 complete(&) end @@ -161,10 +161,10 @@ def add_tool_result(tool_use_id, result) ) end - def max_tool_completions_reached? - return false unless @max_tool_completions + def max_tool_llm_calls_reached? + return false unless @max_tool_llm_calls - @number_of_tool_completions >= @max_tool_completions + @number_of_tool_llm_calls >= @max_tool_llm_calls end end end diff --git a/lib/ruby_llm/configuration.rb b/lib/ruby_llm/configuration.rb index 9d0a617e..952f7553 100644 --- a/lib/ruby_llm/configuration.rb +++ b/lib/ruby_llm/configuration.rb @@ -25,7 +25,7 @@ class Configuration :openrouter_api_key, :ollama_api_base, # Default tool configuration - :max_tool_completions, + :max_tool_llm_calls, # Default models :default_model, :default_embedding_model, @@ -57,7 +57,7 @@ def initialize @default_image_model = 'dall-e-3' # Default restrictions - @max_tool_completions = 25 + @max_tool_llm_calls = 25 # Logging configuration @log_file = $stdout diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index 08bb6c15..5301e380 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -152,7 +152,7 @@ def execute it "#{model} can use tools with a configured tool completions limit" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations RubyLLM.configure do |config| - config.max_tool_completions = 5 + config.max_tool_llm_calls = 5 end chat = RubyLLM.chat(model: model) @@ -173,7 +173,7 @@ def execute it "#{model} can use tools with a tool completions limit using context" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations context = RubyLLM.context do |ctx| - ctx.max_tool_completions = 5 + ctx.max_tool_llm_calls = 5 end chat = RubyLLM.chat(model: model) .with_context(context) From f8fc8a519d75b3f7f14885928735145c69a28fc4 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Thu, 12 Jun 2025 20:39:53 +1000 Subject: [PATCH 22/26] docs: minor doc correction after rename --- docs/guides/tools.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/tools.md b/docs/guides/tools.md index 57c6b09e..b0600835 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -250,7 +250,7 @@ Treat any arguments passed to your `execute` method as potentially untrusted use * **NEVER** use methods like `eval`, `system`, `send`, or direct SQL interpolation with raw arguments from the AI. * **Validate and Sanitize:** Always validate parameter types, ranges, formats, and allowed values. Sanitize strings to prevent injection attacks if they are used in database queries or system commands (though ideally, avoid direct system commands). * **Principle of Least Privilege:** Ensure the code within `execute` only has access to the resources it absolutely needs. -* **Cost-based Denial of Service:** Ensure protection against malicious input or usage, particularly when used in conjunction with tool completions if you remove the default limit +* **Cost-based Denial of Service:** Ensure protection against malicious input or usage, particularly when used in conjunction with tool calls if you remove the default limit. ## Next Steps From 731fcc63a6c6e83def838c0d092b5093eebdc2fa Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Thu, 12 Jun 2025 20:41:25 +1000 Subject: [PATCH 23/26] chore: rename error class --- lib/ruby_llm/chat.rb | 2 +- lib/ruby_llm/error.rb | 2 +- spec/ruby_llm/chat_tools_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ruby_llm/chat.rb b/lib/ruby_llm/chat.rb index 21e052db..29c07ad6 100644 --- a/lib/ruby_llm/chat.rb +++ b/lib/ruby_llm/chat.rb @@ -140,7 +140,7 @@ def handle_tool_calls(response, &) end if max_tool_llm_calls_reached? - raise ToolCallCompletionsLimitReachedError, "Tool LLM calls limit reached: #{@max_tool_llm_calls}" + raise ToolCallLimitReachedError, "Tool LLM calls limit reached: #{@max_tool_llm_calls}" end @number_of_tool_llm_calls += 1 diff --git a/lib/ruby_llm/error.rb b/lib/ruby_llm/error.rb index 1e2995c2..33651777 100644 --- a/lib/ruby_llm/error.rb +++ b/lib/ruby_llm/error.rb @@ -24,7 +24,7 @@ class ConfigurationError < StandardError; end class InvalidRoleError < StandardError; end class ModelNotFoundError < StandardError; end class UnsupportedFunctionsError < StandardError; end - class ToolCallCompletionsLimitReachedError < StandardError; end + class ToolCallLimitReachedError < StandardError; end class UnsupportedAttachmentError < StandardError; end # Error classes for different HTTP status codes diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index 5301e380..4dee9d65 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -163,7 +163,7 @@ def execute 'Fetch all of the posts from r/RandomNames. ' \ 'Fetch the next_page listed in the response until it responds with an empty array' ) - end.to raise_error(RubyLLM::ToolCallCompletionsLimitReachedError) + end.to raise_error(RubyLLM::ToolCallLimitReachedError) # Ensure it does not break the next ask. next_response = chat.ask("What's the weather in Berlin? (52.5200, 13.4050)") @@ -184,7 +184,7 @@ def execute 'Fetch all of the posts from r/RandomNames. ' \ 'Fetch the next_page listed in the response until it responds with an empty array' ) - end.to raise_error(RubyLLM::ToolCallCompletionsLimitReachedError) + end.to raise_error(RubyLLM::ToolCallLimitReachedError) # Ensure it does not break the next ask. next_response = chat.ask("What's the weather in Berlin? (52.5200, 13.4050)") From 092ff2c356a78fff952453b122e60619036652e3 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Thu, 12 Jun 2025 21:17:24 +1000 Subject: [PATCH 24/26] test: ensure spec cases for openrouter, openai, anthropic passing --- ...with_a_configured_tool_llm_calls_limit.yml | 423 ++++++++++ ...a_tool_completions_limit_using_context.yml | 420 ++++++++++ ...with_a_configured_tool_llm_calls_limit.yml | 584 +++++++++++++ ...a_tool_completions_limit_using_context.yml | 579 +++++++++++++ ...with_a_configured_tool_llm_calls_limit.yml | 765 ++++++++++++++++++ ...a_tool_completions_limit_using_context.yml | 765 ++++++++++++++++++ spec/ruby_llm/chat_tools_spec.rb | 16 +- 7 files changed, 3546 insertions(+), 6 deletions(-) create mode 100644 spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_configured_tool_llm_calls_limit.yml create mode 100644 spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_tool_completions_limit_using_context.yml create mode 100644 spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_configured_tool_llm_calls_limit.yml create mode 100644 spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit_using_context.yml create mode 100644 spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_tool_llm_calls_limit.yml create mode 100644 spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_completions_limit_using_context.yml diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_configured_tool_llm_calls_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_configured_tool_llm_calls_limit.yml new file mode 100644 index 00000000..25f9a132 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_configured_tool_llm_calls_limit.yml @@ -0,0 +1,423 @@ +--- +http_interactions: +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:14 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n{\"id\":\"gen-1749726852-2Bgs0lMtGiZ68mL5ODIx\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726852,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I'll continue fetching pages until an empty array is returned.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_0183VSDfuSdUfVQLsPdckhEM\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":488,\"completion_tokens\":74,\"total_tokens\":562}}" + recorded_at: Thu, 12 Jun 2025 11:14:15 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_0183VSDfuSdUfVQLsPdckhEM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 8bd6955f661aa073152c\", :score=>681}, {:title=>\"Topic 599fec120d59157f57e3\", + :score=>647}, {:title=>\"Topic bbabdf73c02727e4a0b1\", :score=>584}], :next_page=>\"t3_abc123_198\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_0183VSDfuSdUfVQLsPdckhEM"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:18 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n{\"id\":\"gen-1749726855-3HAS4ly156xQABjDIefn\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726855,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":677,\"completion_tokens\":48,\"total_tokens\":725}}" + recorded_at: Thu, 12 Jun 2025 11:14:18 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_0183VSDfuSdUfVQLsPdckhEM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 8bd6955f661aa073152c\", :score=>681}, {:title=>\"Topic 599fec120d59157f57e3\", + :score=>647}, {:title=>\"Topic bbabdf73c02727e4a0b1\", :score=>584}], :next_page=>\"t3_abc123_198\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_0183VSDfuSdUfVQLsPdckhEM"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + a44a1d12f9bbb415be2a\", :score=>248}, {:title=>\"Topic 76ee52b58ec4350d6971\", + :score=>268}, {:title=>\"Topic fe016eb349423e666836\", :score=>26}], :next_page=>\"t3_abc123_855\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:21 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n\n \n\n + \ \n{\"id\":\"gen-1749726858-z60WI5mpsFOkJTGmqx9K\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726858,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":838,\"completion_tokens\":48,\"total_tokens\":886}}" + recorded_at: Thu, 12 Jun 2025 11:14:21 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_0183VSDfuSdUfVQLsPdckhEM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 8bd6955f661aa073152c\", :score=>681}, {:title=>\"Topic 599fec120d59157f57e3\", + :score=>647}, {:title=>\"Topic bbabdf73c02727e4a0b1\", :score=>584}], :next_page=>\"t3_abc123_198\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_0183VSDfuSdUfVQLsPdckhEM"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + a44a1d12f9bbb415be2a\", :score=>248}, {:title=>\"Topic 76ee52b58ec4350d6971\", + :score=>268}, {:title=>\"Topic fe016eb349423e666836\", :score=>26}], :next_page=>\"t3_abc123_855\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + e789ecb0c8321582994d\", :score=>896}, {:title=>\"Topic 42dacca3b4c9c1f48ba9\", + :score=>370}, {:title=>\"Topic 101b5f348c0657d48f46\", :score=>612}], :next_page=>\"t3_abc123_549\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:24 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n{\"id\":\"gen-1749726861-T8Q9CGf40rDORwBDZ2K4\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726861,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_011XhcWpFadGvHzF2f56HdiL\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":1004,\"completion_tokens\":48,\"total_tokens\":1052}}" + recorded_at: Thu, 12 Jun 2025 11:14:24 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_0183VSDfuSdUfVQLsPdckhEM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 8bd6955f661aa073152c\", :score=>681}, {:title=>\"Topic 599fec120d59157f57e3\", + :score=>647}, {:title=>\"Topic bbabdf73c02727e4a0b1\", :score=>584}], :next_page=>\"t3_abc123_198\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_0183VSDfuSdUfVQLsPdckhEM"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + a44a1d12f9bbb415be2a\", :score=>248}, {:title=>\"Topic 76ee52b58ec4350d6971\", + :score=>268}, {:title=>\"Topic fe016eb349423e666836\", :score=>26}], :next_page=>\"t3_abc123_855\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + e789ecb0c8321582994d\", :score=>896}, {:title=>\"Topic 42dacca3b4c9c1f48ba9\", + :score=>370}, {:title=>\"Topic 101b5f348c0657d48f46\", :score=>612}], :next_page=>\"t3_abc123_549\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_011XhcWpFadGvHzF2f56HdiL","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + d9a1fe19e58042916f25\", :score=>975}, {:title=>\"Topic 06e1bacd0b4d3767c6a8\", + :score=>600}, {:title=>\"Topic a375207cc38fa80db3a8\", :score=>816}], :next_page=>\"t3_abc123_187\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_011XhcWpFadGvHzF2f56HdiL"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:26 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n{\"id\":\"gen-1749726864-vyQBuScXOtcu0QcmJAod\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726864,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + fetch the current weather for Berlin using the provided coordinates:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_01NND4KWpnVoGtGJY4qMqoR1\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"weather\",\"arguments\":\"{\\\"latitude\\\": + \\\"52.5200\\\", \\\"longitude\\\": \\\"13.4050\\\"}\"}}]}}],\"usage\":{\"prompt_tokens\":1195,\"completion_tokens\":88,\"total_tokens\":1283}}" + recorded_at: Thu, 12 Jun 2025 11:14:27 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_0183VSDfuSdUfVQLsPdckhEM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 8bd6955f661aa073152c\", :score=>681}, {:title=>\"Topic 599fec120d59157f57e3\", + :score=>647}, {:title=>\"Topic bbabdf73c02727e4a0b1\", :score=>584}], :next_page=>\"t3_abc123_198\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_0183VSDfuSdUfVQLsPdckhEM"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + a44a1d12f9bbb415be2a\", :score=>248}, {:title=>\"Topic 76ee52b58ec4350d6971\", + :score=>268}, {:title=>\"Topic fe016eb349423e666836\", :score=>26}], :next_page=>\"t3_abc123_855\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + e789ecb0c8321582994d\", :score=>896}, {:title=>\"Topic 42dacca3b4c9c1f48ba9\", + :score=>370}, {:title=>\"Topic 101b5f348c0657d48f46\", :score=>612}], :next_page=>\"t3_abc123_549\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_011XhcWpFadGvHzF2f56HdiL","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + d9a1fe19e58042916f25\", :score=>975}, {:title=>\"Topic 06e1bacd0b4d3767c6a8\", + :score=>600}, {:title=>\"Topic a375207cc38fa80db3a8\", :score=>816}], :next_page=>\"t3_abc123_187\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_011XhcWpFadGvHzF2f56HdiL"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","content":"I''ll + fetch the current weather for Berlin using the provided coordinates:","tool_calls":[{"id":"toolu_01NND4KWpnVoGtGJY4qMqoR1","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"toolu_01NND4KWpnVoGtGJY4qMqoR1"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:30 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: !binary |- + CiAgICAgICAgIAoKICAgICAgICAgCgogICAgICAgICAKCiAgICAgICAgIAoKICAgICAgICAgCnsiaWQiOiJnZW4tMTc0OTcyNjg2OC13b3llRUJPeEJ3YjhSSVlvbDlBaiIsInByb3ZpZGVyIjoiQW50aHJvcGljIiwibW9kZWwiOiJhbnRocm9waWMvY2xhdWRlLTMuNS1oYWlrdSIsIm9iamVjdCI6ImNoYXQuY29tcGxldGlvbiIsImNyZWF0ZWQiOjE3NDk3MjY4NjgsImNob2ljZXMiOlt7ImxvZ3Byb2JzIjpudWxsLCJmaW5pc2hfcmVhc29uIjoic3RvcCIsIm5hdGl2ZV9maW5pc2hfcmVhc29uIjoic3RvcCIsImluZGV4IjowLCJtZXNzYWdlIjp7InJvbGUiOiJhc3Npc3RhbnQiLCJjb250ZW50IjoiVGhlIGN1cnJlbnQgd2VhdGhlciBpbiBCZXJsaW4gaXMgMTXCsEMgd2l0aCBhIHdpbmQgc3BlZWQgb2YgMTAga20vaC4iLCJyZWZ1c2FsIjpudWxsLCJyZWFzb25pbmciOm51bGx9fV0sInVzYWdlIjp7InByb21wdF90b2tlbnMiOjEzMjIsImNvbXBsZXRpb25fdG9rZW5zIjoyNiwidG90YWxfdG9rZW5zIjoxMzQ4fX0= + recorded_at: Thu, 12 Jun 2025 11:14:30 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_tool_completions_limit_using_context.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_tool_completions_limit_using_context.yml new file mode 100644 index 00000000..906a2800 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_tool_completions_limit_using_context.yml @@ -0,0 +1,420 @@ +--- +http_interactions: +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:50 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1749726889-2rWkRNf6vkvwi3jpjDB3\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726889,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I'll continue fetching pages until an empty array is returned.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_011Mur6e3VbEniFyXz6fprsz\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":488,\"completion_tokens\":75,\"total_tokens\":563}}" + recorded_at: Thu, 12 Jun 2025 11:14:51 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_011Mur6e3VbEniFyXz6fprsz","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 2ebc05d89e84827594f3\", :score=>744}, {:title=>\"Topic b5dbc6e4380e912018cd\", + :score=>233}, {:title=>\"Topic 560b1e7c32d0ba09a99b\", :score=>735}], :next_page=>\"t3_abc123_326\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_011Mur6e3VbEniFyXz6fprsz"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:55 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n\n \n{\"id\":\"gen-1749726891-SOMFZNuoKMb1ep0WA674\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726891,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":682,\"completion_tokens\":48,\"total_tokens\":730}}" + recorded_at: Thu, 12 Jun 2025 11:14:55 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_011Mur6e3VbEniFyXz6fprsz","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 2ebc05d89e84827594f3\", :score=>744}, {:title=>\"Topic b5dbc6e4380e912018cd\", + :score=>233}, {:title=>\"Topic 560b1e7c32d0ba09a99b\", :score=>735}], :next_page=>\"t3_abc123_326\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_011Mur6e3VbEniFyXz6fprsz"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + ec0c62550f6b8b03bc0a\", :score=>978}, {:title=>\"Topic 41256b0e667243743f77\", + :score=>817}, {:title=>\"Topic 9326037e334a6e25e168\", :score=>669}], :next_page=>\"t3_abc123_247\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:56 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n{\"id\":\"gen-1749726895-v7DW3RIk39BA8BNqJZR5\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726895,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":846,\"completion_tokens\":48,\"total_tokens\":894}}" + recorded_at: Thu, 12 Jun 2025 11:14:57 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_011Mur6e3VbEniFyXz6fprsz","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 2ebc05d89e84827594f3\", :score=>744}, {:title=>\"Topic b5dbc6e4380e912018cd\", + :score=>233}, {:title=>\"Topic 560b1e7c32d0ba09a99b\", :score=>735}], :next_page=>\"t3_abc123_326\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_011Mur6e3VbEniFyXz6fprsz"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + ec0c62550f6b8b03bc0a\", :score=>978}, {:title=>\"Topic 41256b0e667243743f77\", + :score=>817}, {:title=>\"Topic 9326037e334a6e25e168\", :score=>669}], :next_page=>\"t3_abc123_247\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 437c1483ca20e842af6f\", :score=>360}, {:title=>\"Topic 1e71b95fdef7589639bc\", + :score=>747}, {:title=>\"Topic 8a1e2006a8ee01e8a0ea\", :score=>394}], :next_page=>\"t3_abc123_363\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:58 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n{\"id\":\"gen-1749726897-mUhcSDeT7XP2VK2Egn1M\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726897,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_01VWPy77vMnWRB3qKkvZMao6\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":1013,\"completion_tokens\":48,\"total_tokens\":1061}}" + recorded_at: Thu, 12 Jun 2025 11:14:59 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_011Mur6e3VbEniFyXz6fprsz","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 2ebc05d89e84827594f3\", :score=>744}, {:title=>\"Topic b5dbc6e4380e912018cd\", + :score=>233}, {:title=>\"Topic 560b1e7c32d0ba09a99b\", :score=>735}], :next_page=>\"t3_abc123_326\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_011Mur6e3VbEniFyXz6fprsz"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + ec0c62550f6b8b03bc0a\", :score=>978}, {:title=>\"Topic 41256b0e667243743f77\", + :score=>817}, {:title=>\"Topic 9326037e334a6e25e168\", :score=>669}], :next_page=>\"t3_abc123_247\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 437c1483ca20e842af6f\", :score=>360}, {:title=>\"Topic 1e71b95fdef7589639bc\", + :score=>747}, {:title=>\"Topic 8a1e2006a8ee01e8a0ea\", :score=>394}], :next_page=>\"t3_abc123_363\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_01VWPy77vMnWRB3qKkvZMao6","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 74b28b7c2f101aefe2e3\", :score=>754}, {:title=>\"Topic a548e747af75cd7387b0\", + :score=>627}, {:title=>\"Topic 7496349bff6d13f001c2\", :score=>759}], :next_page=>\"t3_abc123_374\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_01VWPy77vMnWRB3qKkvZMao6"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:15:02 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n\n \n\n \n{\"id\":\"gen-1749726899-Uny9RIdcwKUY6vExhOnu\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726899,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + fetch the current weather for Berlin using the provided coordinates.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01CfkEJkDdVdEHbSPqM1biwV\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"weather\",\"arguments\":\"{\\\"latitude\\\": + \\\"52.5200\\\", \\\"longitude\\\": \\\"13.4050\\\"}\"}}]}}],\"usage\":{\"prompt_tokens\":1204,\"completion_tokens\":88,\"total_tokens\":1292}}" + recorded_at: Thu, 12 Jun 2025 11:15:03 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_011Mur6e3VbEniFyXz6fprsz","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 2ebc05d89e84827594f3\", :score=>744}, {:title=>\"Topic b5dbc6e4380e912018cd\", + :score=>233}, {:title=>\"Topic 560b1e7c32d0ba09a99b\", :score=>735}], :next_page=>\"t3_abc123_326\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_011Mur6e3VbEniFyXz6fprsz"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + ec0c62550f6b8b03bc0a\", :score=>978}, {:title=>\"Topic 41256b0e667243743f77\", + :score=>817}, {:title=>\"Topic 9326037e334a6e25e168\", :score=>669}], :next_page=>\"t3_abc123_247\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 437c1483ca20e842af6f\", :score=>360}, {:title=>\"Topic 1e71b95fdef7589639bc\", + :score=>747}, {:title=>\"Topic 8a1e2006a8ee01e8a0ea\", :score=>394}], :next_page=>\"t3_abc123_363\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_01VWPy77vMnWRB3qKkvZMao6","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 74b28b7c2f101aefe2e3\", :score=>754}, {:title=>\"Topic a548e747af75cd7387b0\", + :score=>627}, {:title=>\"Topic 7496349bff6d13f001c2\", :score=>759}], :next_page=>\"t3_abc123_374\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_01VWPy77vMnWRB3qKkvZMao6"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","content":"I''ll + fetch the current weather for Berlin using the provided coordinates.","tool_calls":[{"id":"toolu_vrtx_01CfkEJkDdVdEHbSPqM1biwV","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"toolu_vrtx_01CfkEJkDdVdEHbSPqM1biwV"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:15:04 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: !binary |- + CiAgICAgICAgIAoKICAgICAgICAgCnsiaWQiOiJnZW4tMTc0OTcyNjkwMy1NbEk0NUR6aHF3OUV6MHhGWUZ1NCIsInByb3ZpZGVyIjoiQW50aHJvcGljIiwibW9kZWwiOiJhbnRocm9waWMvY2xhdWRlLTMuNS1oYWlrdSIsIm9iamVjdCI6ImNoYXQuY29tcGxldGlvbiIsImNyZWF0ZWQiOjE3NDk3MjY5MDMsImNob2ljZXMiOlt7ImxvZ3Byb2JzIjpudWxsLCJmaW5pc2hfcmVhc29uIjoic3RvcCIsIm5hdGl2ZV9maW5pc2hfcmVhc29uIjoic3RvcCIsImluZGV4IjowLCJtZXNzYWdlIjp7InJvbGUiOiJhc3Npc3RhbnQiLCJjb250ZW50IjoiVGhlIGN1cnJlbnQgd2VhdGhlciBpbiBCZXJsaW4gaXMgMTXCsEMgd2l0aCBhIHdpbmQgc3BlZWQgb2YgMTAga20vaC4iLCJyZWZ1c2FsIjpudWxsLCJyZWFzb25pbmciOm51bGx9fV0sInVzYWdlIjp7InByb21wdF90b2tlbnMiOjEzMzEsImNvbXBsZXRpb25fdG9rZW5zIjoyNiwidG90YWxfdG9rZW5zIjoxMzU3fX0= + recorded_at: Thu, 12 Jun 2025 11:15:04 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_configured_tool_llm_calls_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_configured_tool_llm_calls_limit.yml new file mode 100644 index 00000000..52e3a6ad --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_configured_tool_llm_calls_limit.yml @@ -0,0 +1,584 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:13:40 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-06-12T11:13:39Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T11:13:40Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T11:13:33Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T11:13:39Z' + Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01Ef527sBZsrhfDDQad7EBwQ","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_019U4fskwwsQjyrufocMMqKi","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":488,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":75,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 11:13:40 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_019U4fskwwsQjyrufocMMqKi","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019U4fskwwsQjyrufocMMqKi","content":"{:posts=>[{:title=>\"Topic + 63d35d87ed04f0e9104b\", :score=>482}, {:title=>\"Topic 66ce249eee030c444048\", + :score=>534}, {:title=>\"Topic 311eb7b85e576ed7a627\", :score=>737}], :next_page=>\"t3_abc123_192\", + :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:13:47 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-06-12T11:13:46Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T11:13:47Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T11:13:41Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T11:13:46Z' + Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01DpNhpUNNdB2yYFWuktvqen","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I + see there are more pages available. I''ll continue fetching with the next_page + token:"},{"type":"tool_use","id":"toolu_01MPYHpnu7FcTNn7GJKApmam","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":678,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":59,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 11:13:47 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_019U4fskwwsQjyrufocMMqKi","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019U4fskwwsQjyrufocMMqKi","content":"{:posts=>[{:title=>\"Topic + 63d35d87ed04f0e9104b\", :score=>482}, {:title=>\"Topic 66ce249eee030c444048\", + :score=>534}, {:title=>\"Topic 311eb7b85e576ed7a627\", :score=>737}], :next_page=>\"t3_abc123_192\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see there are more pages available. I''ll continue fetching with the next_page + token:"},{"type":"tool_use","id":"toolu_01MPYHpnu7FcTNn7GJKApmam","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01MPYHpnu7FcTNn7GJKApmam","content":"{:posts=>[{:title=>\"Topic + ea33769c3c6e44935763\", :score=>542}, {:title=>\"Topic 34ef51f7dd8594f5f24c\", + :score=>599}, {:title=>\"Topic f6203297d81fab22efa2\", :score=>161}], :next_page=>\"t3_abc123_303\", + :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:13:54 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-06-12T11:13:53Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T11:13:54Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T11:13:49Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T11:13:53Z' + Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01XFENm2cBzPn2qDU8UAsUtT","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"Continuing + to fetch more pages:"},{"type":"tool_use","id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":852,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":46,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 11:13:54 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_019U4fskwwsQjyrufocMMqKi","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019U4fskwwsQjyrufocMMqKi","content":"{:posts=>[{:title=>\"Topic + 63d35d87ed04f0e9104b\", :score=>482}, {:title=>\"Topic 66ce249eee030c444048\", + :score=>534}, {:title=>\"Topic 311eb7b85e576ed7a627\", :score=>737}], :next_page=>\"t3_abc123_192\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see there are more pages available. I''ll continue fetching with the next_page + token:"},{"type":"tool_use","id":"toolu_01MPYHpnu7FcTNn7GJKApmam","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01MPYHpnu7FcTNn7GJKApmam","content":"{:posts=>[{:title=>\"Topic + ea33769c3c6e44935763\", :score=>542}, {:title=>\"Topic 34ef51f7dd8594f5f24c\", + :score=>599}, {:title=>\"Topic f6203297d81fab22efa2\", :score=>161}], :next_page=>\"t3_abc123_303\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"Continuing + to fetch more pages:"},{"type":"tool_use","id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","content":"{:posts=>[{:title=>\"Topic + 0c3c2159d659b637c8ed\", :score=>362}, {:title=>\"Topic c273b6f59cfc9ec17853\", + :score=>187}, {:title=>\"Topic 5645c9c6ca9275a71641\", :score=>302}], :next_page=>\"t3_abc123_536\", + :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:13:56 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-06-12T11:13:56Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T11:13:56Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T11:13:55Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T11:13:56Z' + Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01LNaSrJpLhE69F1ugSoFCEP","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01UzgebX95P15VVLuRrxVwPv","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1016,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":45,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 11:13:56 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_019U4fskwwsQjyrufocMMqKi","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019U4fskwwsQjyrufocMMqKi","content":"{:posts=>[{:title=>\"Topic + 63d35d87ed04f0e9104b\", :score=>482}, {:title=>\"Topic 66ce249eee030c444048\", + :score=>534}, {:title=>\"Topic 311eb7b85e576ed7a627\", :score=>737}], :next_page=>\"t3_abc123_192\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see there are more pages available. I''ll continue fetching with the next_page + token:"},{"type":"tool_use","id":"toolu_01MPYHpnu7FcTNn7GJKApmam","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01MPYHpnu7FcTNn7GJKApmam","content":"{:posts=>[{:title=>\"Topic + ea33769c3c6e44935763\", :score=>542}, {:title=>\"Topic 34ef51f7dd8594f5f24c\", + :score=>599}, {:title=>\"Topic f6203297d81fab22efa2\", :score=>161}], :next_page=>\"t3_abc123_303\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"Continuing + to fetch more pages:"},{"type":"tool_use","id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","content":"{:posts=>[{:title=>\"Topic + 0c3c2159d659b637c8ed\", :score=>362}, {:title=>\"Topic c273b6f59cfc9ec17853\", + :score=>187}, {:title=>\"Topic 5645c9c6ca9275a71641\", :score=>302}], :next_page=>\"t3_abc123_536\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01UzgebX95P15VVLuRrxVwPv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01UzgebX95P15VVLuRrxVwPv","content":"{:posts=>[{:title=>\"Topic + c9f5b715b4d6084e2ee8\", :score=>582}, {:title=>\"Topic 7e57110ce7e58704deb9\", + :score=>594}, {:title=>\"Topic eb7911dedf86d6b6d445\", :score=>438}], :next_page=>\"t3_abc123_643\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"user","content":[{"type":"text","text":"What''s + the weather in Berlin? (52.5200, 13.4050)"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:00 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '49000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-06-12T11:13:59Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T11:14:00Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T11:13:58Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '59000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T11:13:59Z' + Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01Lm8cM4cSZRzPyjBXzSUnw1","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + fetch the current weather for Berlin using its coordinates."},{"type":"tool_use","id":"toolu_01Msb1TvF5w72yFgXa1ADtvC","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1205,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":87,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 11:14:00 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_019U4fskwwsQjyrufocMMqKi","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019U4fskwwsQjyrufocMMqKi","content":"{:posts=>[{:title=>\"Topic + 63d35d87ed04f0e9104b\", :score=>482}, {:title=>\"Topic 66ce249eee030c444048\", + :score=>534}, {:title=>\"Topic 311eb7b85e576ed7a627\", :score=>737}], :next_page=>\"t3_abc123_192\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I + see there are more pages available. I''ll continue fetching with the next_page + token:"},{"type":"tool_use","id":"toolu_01MPYHpnu7FcTNn7GJKApmam","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01MPYHpnu7FcTNn7GJKApmam","content":"{:posts=>[{:title=>\"Topic + ea33769c3c6e44935763\", :score=>542}, {:title=>\"Topic 34ef51f7dd8594f5f24c\", + :score=>599}, {:title=>\"Topic f6203297d81fab22efa2\", :score=>161}], :next_page=>\"t3_abc123_303\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"Continuing + to fetch more pages:"},{"type":"tool_use","id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","content":"{:posts=>[{:title=>\"Topic + 0c3c2159d659b637c8ed\", :score=>362}, {:title=>\"Topic c273b6f59cfc9ec17853\", + :score=>187}, {:title=>\"Topic 5645c9c6ca9275a71641\", :score=>302}], :next_page=>\"t3_abc123_536\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching:"},{"type":"tool_use","id":"toolu_01UzgebX95P15VVLuRrxVwPv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01UzgebX95P15VVLuRrxVwPv","content":"{:posts=>[{:title=>\"Topic + c9f5b715b4d6084e2ee8\", :score=>582}, {:title=>\"Topic 7e57110ce7e58704deb9\", + :score=>594}, {:title=>\"Topic eb7911dedf86d6b6d445\", :score=>438}], :next_page=>\"t3_abc123_643\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"user","content":[{"type":"text","text":"What''s + the weather in Berlin? (52.5200, 13.4050)"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch the current weather for Berlin using its coordinates."},{"type":"tool_use","id":"toolu_01Msb1TvF5w72yFgXa1ADtvC","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Msb1TvF5w72yFgXa1ADtvC","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:06 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '49000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-06-12T11:14:06Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T11:14:06Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T11:14:01Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '59000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T11:14:06Z' + Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: !binary |- + eyJpZCI6Im1zZ18wMUN4YzlyclRFb2g2YTJGRG50QlN4RmYiLCJ0eXBlIjoibWVzc2FnZSIsInJvbGUiOiJhc3Npc3RhbnQiLCJtb2RlbCI6ImNsYXVkZS0zLTUtaGFpa3UtMjAyNDEwMjIiLCJjb250ZW50IjpbeyJ0eXBlIjoidGV4dCIsInRleHQiOiJUaGUgY3VycmVudCB3ZWF0aGVyIGluIEJlcmxpbiBpcyAxNcKwQyB3aXRoIGEgd2luZCBzcGVlZCBvZiAxMCBrbS9oLiJ9XSwic3RvcF9yZWFzb24iOiJlbmRfdHVybiIsInN0b3Bfc2VxdWVuY2UiOm51bGwsInVzYWdlIjp7ImlucHV0X3Rva2VucyI6MTMzMSwiY2FjaGVfY3JlYXRpb25faW5wdXRfdG9rZW5zIjowLCJjYWNoZV9yZWFkX2lucHV0X3Rva2VucyI6MCwib3V0cHV0X3Rva2VucyI6MjYsInNlcnZpY2VfdGllciI6InN0YW5kYXJkIn19 + recorded_at: Thu, 12 Jun 2025 11:14:06 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit_using_context.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit_using_context.yml new file mode 100644 index 00000000..4f199151 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit_using_context.yml @@ -0,0 +1,579 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:40 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-06-12T11:14:39Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T11:14:40Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T11:14:39Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T11:14:39Z' + Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01NYtKzFXruFqkFTjxSBfi74","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":488,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":75,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 11:14:40 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","content":"{:posts=>[{:title=>\"Topic + 4464d333d3798ae8205c\", :score=>964}, {:title=>\"Topic c734949aeb5cabe9c98b\", + :score=>880}, {:title=>\"Topic 06f1be4809602ec05a16\", :score=>604}], :next_page=>\"t3_abc123_757\", + :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:41 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '49000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-06-12T11:14:41Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T11:14:41Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '48' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T11:14:42Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '59000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T11:14:41Z' + Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01JKiidkTvjkzPnQ5R4t6gm6","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":678,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":48,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 11:14:41 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","content":"{:posts=>[{:title=>\"Topic + 4464d333d3798ae8205c\", :score=>964}, {:title=>\"Topic c734949aeb5cabe9c98b\", + :score=>880}, {:title=>\"Topic 06f1be4809602ec05a16\", :score=>604}], :next_page=>\"t3_abc123_757\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","content":"{:posts=>[{:title=>\"Topic + f8c72ebbf6b6d3c4499b\", :score=>105}, {:title=>\"Topic 29ceffecc53ae81b8a6c\", + :score=>165}, {:title=>\"Topic 95fbb12a4bccfdfc9d77\", :score=>572}], :next_page=>\"t3_abc123_391\", + :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:43 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '49000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-06-12T11:14:44Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T11:14:43Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '47' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T11:14:44Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '59000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T11:14:43Z' + Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01MM5teEjQJC5TD8gEjEFHY6","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":849,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":48,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 11:14:43 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","content":"{:posts=>[{:title=>\"Topic + 4464d333d3798ae8205c\", :score=>964}, {:title=>\"Topic c734949aeb5cabe9c98b\", + :score=>880}, {:title=>\"Topic 06f1be4809602ec05a16\", :score=>604}], :next_page=>\"t3_abc123_757\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","content":"{:posts=>[{:title=>\"Topic + f8c72ebbf6b6d3c4499b\", :score=>105}, {:title=>\"Topic 29ceffecc53ae81b8a6c\", + :score=>165}, {:title=>\"Topic 95fbb12a4bccfdfc9d77\", :score=>572}], :next_page=>\"t3_abc123_391\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","content":"{:posts=>[{:title=>\"Topic + bdadfc5f2e1988226d05\", :score=>968}, {:title=>\"Topic 4db858b16007708bbda2\", + :score=>744}, {:title=>\"Topic 797dac1157f42ccf1e95\", :score=>774}], :next_page=>\"t3_abc123_352\", + :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '48000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-06-12T11:14:47Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T11:14:44Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '47' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T11:14:47Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '58000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T11:14:44Z' + Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_011rUMzEw7nTjdiDyJwHmC1U","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01XYvbjjjRT2M3W1QkxXRx6W","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1012,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":48,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 11:14:44 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","content":"{:posts=>[{:title=>\"Topic + 4464d333d3798ae8205c\", :score=>964}, {:title=>\"Topic c734949aeb5cabe9c98b\", + :score=>880}, {:title=>\"Topic 06f1be4809602ec05a16\", :score=>604}], :next_page=>\"t3_abc123_757\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","content":"{:posts=>[{:title=>\"Topic + f8c72ebbf6b6d3c4499b\", :score=>105}, {:title=>\"Topic 29ceffecc53ae81b8a6c\", + :score=>165}, {:title=>\"Topic 95fbb12a4bccfdfc9d77\", :score=>572}], :next_page=>\"t3_abc123_391\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","content":"{:posts=>[{:title=>\"Topic + bdadfc5f2e1988226d05\", :score=>968}, {:title=>\"Topic 4db858b16007708bbda2\", + :score=>744}, {:title=>\"Topic 797dac1157f42ccf1e95\", :score=>774}], :next_page=>\"t3_abc123_352\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01XYvbjjjRT2M3W1QkxXRx6W","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01XYvbjjjRT2M3W1QkxXRx6W","content":"{:posts=>[{:title=>\"Topic + 20d949e06c308dfd6a25\", :score=>935}, {:title=>\"Topic 0efe44ae9e7ee2e9b45c\", + :score=>413}, {:title=>\"Topic aa91410aa242c760c0e9\", :score=>652}], :next_page=>\"t3_abc123_76\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"user","content":[{"type":"text","text":"What''s + the weather in Berlin? (52.5200, 13.4050)"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:47 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '48000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-06-12T11:14:48Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T11:14:48Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '47' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T11:14:48Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '58000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T11:14:48Z' + Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: '{"id":"msg_01Qz7dMSeWr9t4Vebh2qCMSL","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + fetch the current weather for Berlin using its coordinates."},{"type":"tool_use","id":"toolu_01MmpDBvLhN67FWbQ8ThFEFT","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1204,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":87,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 11:14:47 GMT +- request: + method: post + uri: https://api.anthropic.com/v1/messages + body: + encoding: UTF-8 + string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","content":"{:posts=>[{:title=>\"Topic + 4464d333d3798ae8205c\", :score=>964}, {:title=>\"Topic c734949aeb5cabe9c98b\", + :score=>880}, {:title=>\"Topic 06f1be4809602ec05a16\", :score=>604}], :next_page=>\"t3_abc123_757\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","content":"{:posts=>[{:title=>\"Topic + f8c72ebbf6b6d3c4499b\", :score=>105}, {:title=>\"Topic 29ceffecc53ae81b8a6c\", + :score=>165}, {:title=>\"Topic 95fbb12a4bccfdfc9d77\", :score=>572}], :next_page=>\"t3_abc123_391\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","content":"{:posts=>[{:title=>\"Topic + bdadfc5f2e1988226d05\", :score=>968}, {:title=>\"Topic 4db858b16007708bbda2\", + :score=>744}, {:title=>\"Topic 797dac1157f42ccf1e95\", :score=>774}], :next_page=>\"t3_abc123_352\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01XYvbjjjRT2M3W1QkxXRx6W","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01XYvbjjjRT2M3W1QkxXRx6W","content":"{:posts=>[{:title=>\"Topic + 20d949e06c308dfd6a25\", :score=>935}, {:title=>\"Topic 0efe44ae9e7ee2e9b45c\", + :score=>413}, {:title=>\"Topic aa91410aa242c760c0e9\", :score=>652}], :next_page=>\"t3_abc123_76\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"user","content":[{"type":"text","text":"What''s + the weather in Berlin? (52.5200, 13.4050)"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + fetch the current weather for Berlin using its coordinates."},{"type":"tool_use","id":"toolu_01MmpDBvLhN67FWbQ8ThFEFT","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01MmpDBvLhN67FWbQ8ThFEFT","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets + current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}]}' + headers: + User-Agent: + - Faraday v2.12.2 + X-Api-Key: + - "" + Anthropic-Version: + - '2023-06-01' + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:49 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '49000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-06-12T11:14:50Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T11:14:49Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '48' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T11:14:49Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '59000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T11:14:49Z' + Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Anthropic-Organization-Id: + - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + X-Robots-Tag: + - none + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: !binary |- + eyJpZCI6Im1zZ18wMVVUU1c4Ylc3TWhEMndtOFIyOWhidWUiLCJ0eXBlIjoibWVzc2FnZSIsInJvbGUiOiJhc3Npc3RhbnQiLCJtb2RlbCI6ImNsYXVkZS0zLTUtaGFpa3UtMjAyNDEwMjIiLCJjb250ZW50IjpbeyJ0eXBlIjoidGV4dCIsInRleHQiOiJUaGUgY3VycmVudCB3ZWF0aGVyIGluIEJlcmxpbiBpcyAxNcKwQyB3aXRoIGEgd2luZCBzcGVlZCBvZiAxMCBrbS9oLiJ9XSwic3RvcF9yZWFzb24iOiJlbmRfdHVybiIsInN0b3Bfc2VxdWVuY2UiOm51bGwsInVzYWdlIjp7ImlucHV0X3Rva2VucyI6MTMzMCwiY2FjaGVfY3JlYXRpb25faW5wdXRfdG9rZW5zIjowLCJjYWNoZV9yZWFkX2lucHV0X3Rva2VucyI6MCwib3V0cHV0X3Rva2VucyI6MjYsInNlcnZpY2VfdGllciI6InN0YW5kYXJkIn19 + recorded_at: Thu, 12 Jun 2025 11:14:49 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_tool_llm_calls_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_tool_llm_calls_limit.yml new file mode 100644 index 00000000..37b7a587 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_tool_llm_calls_limit.yml @@ -0,0 +1,765 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:07 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '325' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '331' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199923' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 22ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BhaAguGQIrLgMNzx13mbihjUe4tNy", + "object": "chat.completion", + "created": 1749726846, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_ecTjk8XOMKWrWjU1JU38TYDU", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 151, + "completion_tokens": 11, + "total_tokens": 162, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_38343a2f8f" + } + recorded_at: Thu, 12 Jun 2025 11:14:07 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_ecTjk8XOMKWrWjU1JU38TYDU","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 261c4ef44a20238a01ae\", :score=>486}, {:title=>\"Topic 8d600fdd8e8b401cfb34\", + :score=>980}, {:title=>\"Topic c445b59484add1a7b72d\", :score=>426}], :next_page=>\"t3_abc123_547\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ecTjk8XOMKWrWjU1JU38TYDU"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:07 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '446' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '455' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199856' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 43ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BhaAhrvOpgt8OO7zPVI6ZRxynpoBb", + "object": "chat.completion", + "created": 1749726847, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_ZyrNsChAtbkXx4LU91SCFFau", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 269, + "completion_tokens": 11, + "total_tokens": 280, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_38343a2f8f" + } + recorded_at: Thu, 12 Jun 2025 11:14:07 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_ecTjk8XOMKWrWjU1JU38TYDU","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 261c4ef44a20238a01ae\", :score=>486}, {:title=>\"Topic 8d600fdd8e8b401cfb34\", + :score=>980}, {:title=>\"Topic c445b59484add1a7b72d\", :score=>426}], :next_page=>\"t3_abc123_547\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ecTjk8XOMKWrWjU1JU38TYDU"},{"role":"assistant","tool_calls":[{"id":"call_ZyrNsChAtbkXx4LU91SCFFau","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 8fe8a19a3500808df733\", :score=>338}, {:title=>\"Topic 3df3366498cef55fbefa\", + :score=>704}, {:title=>\"Topic ba46229f94f578b50f16\", :score=>224}], :next_page=>\"t3_abc123_717\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ZyrNsChAtbkXx4LU91SCFFau"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:08 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '194' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '199' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199787' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 63ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BhaAiT04r1UUdck9SqWN4im4kdGdP", + "object": "chat.completion", + "created": 1749726848, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_nZBn760g3YG8RkGVmSkGZCHQ", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 382, + "completion_tokens": 11, + "total_tokens": 393, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_38343a2f8f" + } + recorded_at: Thu, 12 Jun 2025 11:14:08 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_ecTjk8XOMKWrWjU1JU38TYDU","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 261c4ef44a20238a01ae\", :score=>486}, {:title=>\"Topic 8d600fdd8e8b401cfb34\", + :score=>980}, {:title=>\"Topic c445b59484add1a7b72d\", :score=>426}], :next_page=>\"t3_abc123_547\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ecTjk8XOMKWrWjU1JU38TYDU"},{"role":"assistant","tool_calls":[{"id":"call_ZyrNsChAtbkXx4LU91SCFFau","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 8fe8a19a3500808df733\", :score=>338}, {:title=>\"Topic 3df3366498cef55fbefa\", + :score=>704}, {:title=>\"Topic ba46229f94f578b50f16\", :score=>224}], :next_page=>\"t3_abc123_717\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ZyrNsChAtbkXx4LU91SCFFau"},{"role":"assistant","tool_calls":[{"id":"call_nZBn760g3YG8RkGVmSkGZCHQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 63b8a6a18bacf684f6f8\", :score=>805}, {:title=>\"Topic e69bbce55230161ed037\", + :score=>849}, {:title=>\"Topic 44a20d5624875bac9bb0\", :score=>836}], :next_page=>\"t3_abc123_518\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nZBn760g3YG8RkGVmSkGZCHQ"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:09 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '405' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '411' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199721' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 83ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BhaAiD5LyQ3JHhahsg6fGQBaE1PxO", + "object": "chat.completion", + "created": 1749726848, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_71eF3qGUyI6hSQPEW8rCZEi4", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 498, + "completion_tokens": 11, + "total_tokens": 509, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_38343a2f8f" + } + recorded_at: Thu, 12 Jun 2025 11:14:09 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_ecTjk8XOMKWrWjU1JU38TYDU","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 261c4ef44a20238a01ae\", :score=>486}, {:title=>\"Topic 8d600fdd8e8b401cfb34\", + :score=>980}, {:title=>\"Topic c445b59484add1a7b72d\", :score=>426}], :next_page=>\"t3_abc123_547\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ecTjk8XOMKWrWjU1JU38TYDU"},{"role":"assistant","tool_calls":[{"id":"call_ZyrNsChAtbkXx4LU91SCFFau","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 8fe8a19a3500808df733\", :score=>338}, {:title=>\"Topic 3df3366498cef55fbefa\", + :score=>704}, {:title=>\"Topic ba46229f94f578b50f16\", :score=>224}], :next_page=>\"t3_abc123_717\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ZyrNsChAtbkXx4LU91SCFFau"},{"role":"assistant","tool_calls":[{"id":"call_nZBn760g3YG8RkGVmSkGZCHQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 63b8a6a18bacf684f6f8\", :score=>805}, {:title=>\"Topic e69bbce55230161ed037\", + :score=>849}, {:title=>\"Topic 44a20d5624875bac9bb0\", :score=>836}], :next_page=>\"t3_abc123_518\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nZBn760g3YG8RkGVmSkGZCHQ"},{"role":"assistant","tool_calls":[{"id":"call_71eF3qGUyI6hSQPEW8rCZEi4","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + e2ef7f0122f81e4cd152\", :score=>591}, {:title=>\"Topic 62916ca9a4dfb0bc2321\", + :score=>479}, {:title=>\"Topic 476e4ca8d25846d79dd8\", :score=>222}], :next_page=>\"t3_abc123_872\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_71eF3qGUyI6hSQPEW8rCZEi4"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:10 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '364' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '368' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199640' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 108ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BhaAjAlUkjq0oLlYU4tRFfwal6Q9r", + "object": "chat.completion", + "created": 1749726849, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_J7PR4gEK6SKWx7cecLAXyyjQ", + "type": "function", + "function": { + "name": "weather", + "arguments": "{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 639, + "completion_tokens": 23, + "total_tokens": 662, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_38343a2f8f" + } + recorded_at: Thu, 12 Jun 2025 11:14:10 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_ecTjk8XOMKWrWjU1JU38TYDU","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 261c4ef44a20238a01ae\", :score=>486}, {:title=>\"Topic 8d600fdd8e8b401cfb34\", + :score=>980}, {:title=>\"Topic c445b59484add1a7b72d\", :score=>426}], :next_page=>\"t3_abc123_547\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ecTjk8XOMKWrWjU1JU38TYDU"},{"role":"assistant","tool_calls":[{"id":"call_ZyrNsChAtbkXx4LU91SCFFau","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 8fe8a19a3500808df733\", :score=>338}, {:title=>\"Topic 3df3366498cef55fbefa\", + :score=>704}, {:title=>\"Topic ba46229f94f578b50f16\", :score=>224}], :next_page=>\"t3_abc123_717\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ZyrNsChAtbkXx4LU91SCFFau"},{"role":"assistant","tool_calls":[{"id":"call_nZBn760g3YG8RkGVmSkGZCHQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 63b8a6a18bacf684f6f8\", :score=>805}, {:title=>\"Topic e69bbce55230161ed037\", + :score=>849}, {:title=>\"Topic 44a20d5624875bac9bb0\", :score=>836}], :next_page=>\"t3_abc123_518\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nZBn760g3YG8RkGVmSkGZCHQ"},{"role":"assistant","tool_calls":[{"id":"call_71eF3qGUyI6hSQPEW8rCZEi4","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + e2ef7f0122f81e4cd152\", :score=>591}, {:title=>\"Topic 62916ca9a4dfb0bc2321\", + :score=>479}, {:title=>\"Topic 476e4ca8d25846d79dd8\", :score=>222}], :next_page=>\"t3_abc123_872\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_71eF3qGUyI6hSQPEW8rCZEi4"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","tool_calls":[{"id":"call_J7PR4gEK6SKWx7cecLAXyyjQ","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"call_J7PR4gEK6SKWx7cecLAXyyjQ"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:14:11 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '369' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '372' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199623' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 112ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: !binary |- + ewogICJpZCI6ICJjaGF0Y21wbC1CaGFBbEFsOTFnRERZSWVXUjVPdENlQjI1Z3o2bCIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0OTcyNjg1MSwKICAibW9kZWwiOiAiZ3B0LTQuMS1uYW5vLTIwMjUtMDQtMTQiLAogICJjaG9pY2VzIjogWwogICAgewogICAgICAiaW5kZXgiOiAwLAogICAgICAibWVzc2FnZSI6IHsKICAgICAgICAicm9sZSI6ICJhc3Npc3RhbnQiLAogICAgICAgICJjb250ZW50IjogIlRoZSBjdXJyZW50IHdlYXRoZXIgaW4gQmVybGluIGlzIDE1wrBDIHdpdGggYSB3aW5kIHNwZWVkIG9mIDEwIGttL2guIiwKICAgICAgICAicmVmdXNhbCI6IG51bGwsCiAgICAgICAgImFubm90YXRpb25zIjogW10KICAgICAgfSwKICAgICAgImxvZ3Byb2JzIjogbnVsbCwKICAgICAgImZpbmlzaF9yZWFzb24iOiAic3RvcCIKICAgIH0KICBdLAogICJ1c2FnZSI6IHsKICAgICJwcm9tcHRfdG9rZW5zIjogNjk0LAogICAgImNvbXBsZXRpb25fdG9rZW5zIjogMjAsCiAgICAidG90YWxfdG9rZW5zIjogNzE0LAogICAgInByb21wdF90b2tlbnNfZGV0YWlscyI6IHsKICAgICAgImNhY2hlZF90b2tlbnMiOiAwLAogICAgICAiYXVkaW9fdG9rZW5zIjogMAogICAgfSwKICAgICJjb21wbGV0aW9uX3Rva2Vuc19kZXRhaWxzIjogewogICAgICAicmVhc29uaW5nX3Rva2VucyI6IDAsCiAgICAgICJhdWRpb190b2tlbnMiOiAwLAogICAgICAiYWNjZXB0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwLAogICAgICAicmVqZWN0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwCiAgICB9CiAgfSwKICAic2VydmljZV90aWVyIjogImRlZmF1bHQiLAogICJzeXN0ZW1fZmluZ2VycHJpbnQiOiAiZnBfMzgzNDNhMmY4ZiIKfQo= + recorded_at: Thu, 12 Jun 2025 11:14:11 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_completions_limit_using_context.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_completions_limit_using_context.yml new file mode 100644 index 00000000..e25d8b4d --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_completions_limit_using_context.yml @@ -0,0 +1,765 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:16:15 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '333' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '338' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199923' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 22ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BhaClWCiivT9dD2l06ye92txJH3AD", + "object": "chat.completion", + "created": 1749726975, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_LrJSdlzzVbnltmHnllLZTZ2r", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 151, + "completion_tokens": 11, + "total_tokens": 162, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_38343a2f8f" + } + recorded_at: Thu, 12 Jun 2025 11:16:15 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_LrJSdlzzVbnltmHnllLZTZ2r","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 891adfe5f027228357af\", :score=>437}, {:title=>\"Topic 4cbb882b7224b9d73728\", + :score=>428}, {:title=>\"Topic 119eb548956d5dfb8a50\", :score=>93}], :next_page=>\"t3_abc123_552\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_LrJSdlzzVbnltmHnllLZTZ2r"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:16:16 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '409' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '415' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199856' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 43ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BhaCmICBmUJdKfxyKYXXUMJGgv1Fu", + "object": "chat.completion", + "created": 1749726976, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_rHAK0L9HRNil78q9s2SKmffl", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 266, + "completion_tokens": 11, + "total_tokens": 277, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_38343a2f8f" + } + recorded_at: Thu, 12 Jun 2025 11:16:16 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_LrJSdlzzVbnltmHnllLZTZ2r","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 891adfe5f027228357af\", :score=>437}, {:title=>\"Topic 4cbb882b7224b9d73728\", + :score=>428}, {:title=>\"Topic 119eb548956d5dfb8a50\", :score=>93}], :next_page=>\"t3_abc123_552\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_LrJSdlzzVbnltmHnllLZTZ2r"},{"role":"assistant","tool_calls":[{"id":"call_rHAK0L9HRNil78q9s2SKmffl","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + dd3a240ceed3b4313294\", :score=>77}, {:title=>\"Topic 8bbcd5822e7446295df5\", + :score=>288}, {:title=>\"Topic 87c26d71be66c3dc15a8\", :score=>370}], :next_page=>\"t3_abc123_179\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_rHAK0L9HRNil78q9s2SKmffl"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:16:17 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '445' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '458' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199788' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 63ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BhaCnrGrqKbqB9snE37dAvvxPs1X1", + "object": "chat.completion", + "created": 1749726977, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_yTg7WzETrynxLmzdOpONIN6N", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 382, + "completion_tokens": 11, + "total_tokens": 393, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_38343a2f8f" + } + recorded_at: Thu, 12 Jun 2025 11:16:17 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_LrJSdlzzVbnltmHnllLZTZ2r","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 891adfe5f027228357af\", :score=>437}, {:title=>\"Topic 4cbb882b7224b9d73728\", + :score=>428}, {:title=>\"Topic 119eb548956d5dfb8a50\", :score=>93}], :next_page=>\"t3_abc123_552\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_LrJSdlzzVbnltmHnllLZTZ2r"},{"role":"assistant","tool_calls":[{"id":"call_rHAK0L9HRNil78q9s2SKmffl","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + dd3a240ceed3b4313294\", :score=>77}, {:title=>\"Topic 8bbcd5822e7446295df5\", + :score=>288}, {:title=>\"Topic 87c26d71be66c3dc15a8\", :score=>370}], :next_page=>\"t3_abc123_179\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_rHAK0L9HRNil78q9s2SKmffl"},{"role":"assistant","tool_calls":[{"id":"call_yTg7WzETrynxLmzdOpONIN6N","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 9c2a8743bb56050c8fad\", :score=>225}, {:title=>\"Topic 2258bbc0dde2d1224eb4\", + :score=>843}, {:title=>\"Topic 7dfeede2513675bff3ef\", :score=>120}], :next_page=>\"t3_abc123_999\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_yTg7WzETrynxLmzdOpONIN6N"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:16:18 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '811' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '815' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199721' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 83ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BhaCosGM8E1v1Sifcm7MuS277qxyY", + "object": "chat.completion", + "created": 1749726978, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_y7zNG6Alwvbt9GqqVTcJBArI", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 499, + "completion_tokens": 11, + "total_tokens": 510, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_38343a2f8f" + } + recorded_at: Thu, 12 Jun 2025 11:16:18 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_LrJSdlzzVbnltmHnllLZTZ2r","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 891adfe5f027228357af\", :score=>437}, {:title=>\"Topic 4cbb882b7224b9d73728\", + :score=>428}, {:title=>\"Topic 119eb548956d5dfb8a50\", :score=>93}], :next_page=>\"t3_abc123_552\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_LrJSdlzzVbnltmHnllLZTZ2r"},{"role":"assistant","tool_calls":[{"id":"call_rHAK0L9HRNil78q9s2SKmffl","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + dd3a240ceed3b4313294\", :score=>77}, {:title=>\"Topic 8bbcd5822e7446295df5\", + :score=>288}, {:title=>\"Topic 87c26d71be66c3dc15a8\", :score=>370}], :next_page=>\"t3_abc123_179\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_rHAK0L9HRNil78q9s2SKmffl"},{"role":"assistant","tool_calls":[{"id":"call_yTg7WzETrynxLmzdOpONIN6N","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 9c2a8743bb56050c8fad\", :score=>225}, {:title=>\"Topic 2258bbc0dde2d1224eb4\", + :score=>843}, {:title=>\"Topic 7dfeede2513675bff3ef\", :score=>120}], :next_page=>\"t3_abc123_999\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_yTg7WzETrynxLmzdOpONIN6N"},{"role":"assistant","tool_calls":[{"id":"call_y7zNG6Alwvbt9GqqVTcJBArI","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + aa4bebabf923fd00f446\", :score=>574}, {:title=>\"Topic 05bb3f0e5085a195cff4\", + :score=>438}, {:title=>\"Topic fc7cca6fbd7bcaa35deb\", :score=>823}], :next_page=>\"t3_abc123_281\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_y7zNG6Alwvbt9GqqVTcJBArI"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:16:19 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '376' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '381' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199640' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 108ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: | + { + "id": "chatcmpl-BhaCpUtoqEX80IuepfwcEjbE7cwoc", + "object": "chat.completion", + "created": 1749726979, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_l2sQv7QaVvAHRE5gYbDxtlsD", + "type": "function", + "function": { + "name": "weather", + "arguments": "{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 635, + "completion_tokens": 23, + "total_tokens": 658, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_38343a2f8f" + } + recorded_at: Thu, 12 Jun 2025 11:16:19 GMT +- request: + method: post + uri: https://api.openai.com/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_LrJSdlzzVbnltmHnllLZTZ2r","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 891adfe5f027228357af\", :score=>437}, {:title=>\"Topic 4cbb882b7224b9d73728\", + :score=>428}, {:title=>\"Topic 119eb548956d5dfb8a50\", :score=>93}], :next_page=>\"t3_abc123_552\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_LrJSdlzzVbnltmHnllLZTZ2r"},{"role":"assistant","tool_calls":[{"id":"call_rHAK0L9HRNil78q9s2SKmffl","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + dd3a240ceed3b4313294\", :score=>77}, {:title=>\"Topic 8bbcd5822e7446295df5\", + :score=>288}, {:title=>\"Topic 87c26d71be66c3dc15a8\", :score=>370}], :next_page=>\"t3_abc123_179\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_rHAK0L9HRNil78q9s2SKmffl"},{"role":"assistant","tool_calls":[{"id":"call_yTg7WzETrynxLmzdOpONIN6N","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 9c2a8743bb56050c8fad\", :score=>225}, {:title=>\"Topic 2258bbc0dde2d1224eb4\", + :score=>843}, {:title=>\"Topic 7dfeede2513675bff3ef\", :score=>120}], :next_page=>\"t3_abc123_999\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_yTg7WzETrynxLmzdOpONIN6N"},{"role":"assistant","tool_calls":[{"id":"call_y7zNG6Alwvbt9GqqVTcJBArI","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + aa4bebabf923fd00f446\", :score=>574}, {:title=>\"Topic 05bb3f0e5085a195cff4\", + :score=>438}, {:title=>\"Topic fc7cca6fbd7bcaa35deb\", :score=>823}], :next_page=>\"t3_abc123_281\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_y7zNG6Alwvbt9GqqVTcJBArI"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","tool_calls":[{"id":"call_l2sQv7QaVvAHRE5gYbDxtlsD","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"call_l2sQv7QaVvAHRE5gYbDxtlsD"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 11:16:21 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '780' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '801' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199623' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 112ms + X-Request-Id: + - "" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - "" + - "" + X-Content-Type-Options: + - nosniff + Server: + - cloudflare + Cf-Ray: + - "" + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: !binary |- + ewogICJpZCI6ICJjaGF0Y21wbC1CaGFDcWpDTHI1eFpjNjVrQ3AzcXcyRXF5em5TNSIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0OTcyNjk4MCwKICAibW9kZWwiOiAiZ3B0LTQuMS1uYW5vLTIwMjUtMDQtMTQiLAogICJjaG9pY2VzIjogWwogICAgewogICAgICAiaW5kZXgiOiAwLAogICAgICAibWVzc2FnZSI6IHsKICAgICAgICAicm9sZSI6ICJhc3Npc3RhbnQiLAogICAgICAgICJjb250ZW50IjogIlRoZSBjdXJyZW50IHdlYXRoZXIgaW4gQmVybGluIGlzIDE1wrBDIHdpdGggYSB3aW5kIHNwZWVkIG9mIDEwIGttL2guIiwKICAgICAgICAicmVmdXNhbCI6IG51bGwsCiAgICAgICAgImFubm90YXRpb25zIjogW10KICAgICAgfSwKICAgICAgImxvZ3Byb2JzIjogbnVsbCwKICAgICAgImZpbmlzaF9yZWFzb24iOiAic3RvcCIKICAgIH0KICBdLAogICJ1c2FnZSI6IHsKICAgICJwcm9tcHRfdG9rZW5zIjogNjkwLAogICAgImNvbXBsZXRpb25fdG9rZW5zIjogMjAsCiAgICAidG90YWxfdG9rZW5zIjogNzEwLAogICAgInByb21wdF90b2tlbnNfZGV0YWlscyI6IHsKICAgICAgImNhY2hlZF90b2tlbnMiOiAwLAogICAgICAiYXVkaW9fdG9rZW5zIjogMAogICAgfSwKICAgICJjb21wbGV0aW9uX3Rva2Vuc19kZXRhaWxzIjogewogICAgICAicmVhc29uaW5nX3Rva2VucyI6IDAsCiAgICAgICJhdWRpb190b2tlbnMiOiAwLAogICAgICAiYWNjZXB0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwLAogICAgICAicmVqZWN0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwCiAgICB9CiAgfSwKICAic2VydmljZV90aWVyIjogImRlZmF1bHQiLAogICJzeXN0ZW1fZmluZ2VycHJpbnQiOiAiZnBfZjEyMTY3YjM3MCIKfQo= + recorded_at: Thu, 12 Jun 2025 11:16:21 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/ruby_llm/chat_tools_spec.rb b/spec/ruby_llm/chat_tools_spec.rb index 4dee9d65..fecaa17c 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -150,9 +150,9 @@ def execute expect(response.content).to include('10') end - it "#{model} can use tools with a configured tool completions limit" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations + it "#{model} can use tools with a configured tool llm calls limit" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations RubyLLM.configure do |config| - config.max_tool_llm_calls = 5 + config.max_tool_llm_calls = 3 end chat = RubyLLM.chat(model: model) @@ -161,7 +161,9 @@ def execute expect do chat.ask( 'Fetch all of the posts from r/RandomNames. ' \ - 'Fetch the next_page listed in the response until it responds with an empty array' + 'Fetch the next_page listed in the response until it responds with an empty array ' \ + 'do not ask to continue fetching the subsequent pages until the last page is reached.' \ + 'If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely.' \ ) end.to raise_error(RubyLLM::ToolCallLimitReachedError) @@ -171,9 +173,9 @@ def execute expect(next_response.content).to include('10') end - it "#{model} can use tools with a tool completions limit using context" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations + it "#{model} can use tools with a tool llm calls limit using context" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations context = RubyLLM.context do |ctx| - ctx.max_tool_llm_calls = 5 + ctx.max_tool_llm_calls = 3 end chat = RubyLLM.chat(model: model) .with_context(context) @@ -182,7 +184,9 @@ def execute expect do chat.ask( 'Fetch all of the posts from r/RandomNames. ' \ - 'Fetch the next_page listed in the response until it responds with an empty array' + 'Fetch the next_page listed in the response until it responds with an empty array ' \ + 'do not ask to continue fetching the subsequent pages until the last page is reached.' \ + 'If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely.' \ ) end.to raise_error(RubyLLM::ToolCallLimitReachedError) From a0a1fa89e2859a64b369e10a81c24a698dc1557c Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Thu, 12 Jun 2025 22:34:50 +1000 Subject: [PATCH 25/26] bug: fix +1 issue for llm tool lomts --- lib/ruby_llm/chat.rb | 4 +- ...with_a_configured_tool_llm_calls_limit.yml | 210 +++------ ...a_tool_completions_limit_using_context.yml | 420 ------------------ ...h_a_tool_llm_calls_limit_using_context.yml | 346 +++++++++++++++ ...with_a_configured_tool_llm_calls_limit.yml | 263 ++++------- ..._a_tool_llm_calls_limit_using_context.yml} | 268 ++++------- ...with_a_configured_tool_llm_calls_limit.yml | 292 ++++-------- ..._a_tool_llm_calls_limit_using_context.yml} | 298 ++++--------- 8 files changed, 726 insertions(+), 1375 deletions(-) delete mode 100644 spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_tool_completions_limit_using_context.yml create mode 100644 spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml rename spec/fixtures/vcr_cassettes/{chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit_using_context.yml => chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml} (57%) rename spec/fixtures/vcr_cassettes/{chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_completions_limit_using_context.yml => chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml} (62%) diff --git a/lib/ruby_llm/chat.rb b/lib/ruby_llm/chat.rb index 29c07ad6..6c69ee91 100644 --- a/lib/ruby_llm/chat.rb +++ b/lib/ruby_llm/chat.rb @@ -132,6 +132,8 @@ def reset_messages! private def handle_tool_calls(response, &) + @number_of_tool_llm_calls += 1 + response.tool_calls.each_value do |tool_call| @on[:new_message]&.call result = execute_tool tool_call @@ -139,11 +141,11 @@ def handle_tool_calls(response, &) @on[:end_message]&.call(message) end + # Perform this afterwards to ensure messages remain valid for the next call if max_tool_llm_calls_reached? raise ToolCallLimitReachedError, "Tool LLM calls limit reached: #{@max_tool_llm_calls}" end - @number_of_tool_llm_calls += 1 complete(&) end diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_configured_tool_llm_calls_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_configured_tool_llm_calls_limit.yml index 25f9a132..4120a365 100644 --- a/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_configured_tool_llm_calls_limit.yml +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_configured_tool_llm_calls_limit.yml @@ -31,7 +31,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:14 GMT + - Thu, 12 Jun 2025 12:36:37 GMT Content-Type: - application/json Transfer-Encoding: @@ -56,10 +56,10 @@ http_interactions: body: encoding: ASCII-8BIT string: "\n \n\n \n\n \n\n \n\n \n\n - \ \n\n \n{\"id\":\"gen-1749726852-2Bgs0lMtGiZ68mL5ODIx\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726852,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll - help you fetch all the posts from r/RandomNames using the `looping_answer` - function. I'll continue fetching pages until an empty array is returned.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_0183VSDfuSdUfVQLsPdckhEM\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":488,\"completion_tokens\":74,\"total_tokens\":562}}" - recorded_at: Thu, 12 Jun 2025 11:14:15 GMT + \ \n{\"id\":\"gen-1749731795-9O4E8hStra7L5F6z2hmS\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749731795,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I'll continue fetching pages until an empty array is returned.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01Jfdbhe8rUYGtwGNchV2qqs\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":488,\"completion_tokens\":75,\"total_tokens\":563}}" + recorded_at: Thu, 12 Jun 2025 12:36:38 GMT - request: method: post uri: https://openrouter.ai/api/v1/chat/completions @@ -70,11 +70,11 @@ http_interactions: until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll - help you fetch all the posts from r/RandomNames using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_0183VSDfuSdUfVQLsPdckhEM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 8bd6955f661aa073152c\", :score=>681}, {:title=>\"Topic 599fec120d59157f57e3\", - :score=>647}, {:title=>\"Topic bbabdf73c02727e4a0b1\", :score=>584}], :next_page=>\"t3_abc123_198\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_0183VSDfuSdUfVQLsPdckhEM"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_vrtx_01Jfdbhe8rUYGtwGNchV2qqs","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + a59365c7c20376a34c63\", :score=>108}, {:title=>\"Topic da52b02474d3256cb00b\", + :score=>242}, {:title=>\"Topic fe6f3ddf55de24dfb35c\", :score=>497}], :next_page=>\"t3_abc123_441\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01Jfdbhe8rUYGtwGNchV2qqs"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -96,7 +96,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:18 GMT + - Thu, 12 Jun 2025 12:36:41 GMT Content-Type: - application/json Transfer-Encoding: @@ -121,9 +121,10 @@ http_interactions: body: encoding: ASCII-8BIT string: "\n \n\n \n\n \n\n \n\n \n\n - \ \n\n \n{\"id\":\"gen-1749726855-3HAS4ly156xQABjDIefn\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726855,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll - continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":677,\"completion_tokens\":48,\"total_tokens\":725}}" - recorded_at: Thu, 12 Jun 2025 11:14:18 GMT + \ \n\n \n{\"id\":\"gen-1749731798-92dUd9fqFoizwuChLh74\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749731798,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I + see there are more posts available. I'll continue fetching using the next_page + token:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01J94F23FsWQbc9M8nzm7ok4\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":678,\"completion_tokens\":59,\"total_tokens\":737}}" + recorded_at: Thu, 12 Jun 2025 12:36:41 GMT - request: method: post uri: https://openrouter.ai/api/v1/chat/completions @@ -134,15 +135,16 @@ http_interactions: until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll - help you fetch all the posts from r/RandomNames using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_0183VSDfuSdUfVQLsPdckhEM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 8bd6955f661aa073152c\", :score=>681}, {:title=>\"Topic 599fec120d59157f57e3\", - :score=>647}, {:title=>\"Topic bbabdf73c02727e4a0b1\", :score=>584}], :next_page=>\"t3_abc123_198\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_0183VSDfuSdUfVQLsPdckhEM"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - a44a1d12f9bbb415be2a\", :score=>248}, {:title=>\"Topic 76ee52b58ec4350d6971\", - :score=>268}, {:title=>\"Topic fe016eb349423e666836\", :score=>26}], :next_page=>\"t3_abc123_855\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_vrtx_01Jfdbhe8rUYGtwGNchV2qqs","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + a59365c7c20376a34c63\", :score=>108}, {:title=>\"Topic da52b02474d3256cb00b\", + :score=>242}, {:title=>\"Topic fe6f3ddf55de24dfb35c\", :score=>497}], :next_page=>\"t3_abc123_441\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01Jfdbhe8rUYGtwGNchV2qqs"},{"role":"assistant","content":"I + see there are more posts available. I''ll continue fetching using the next_page + token:","tool_calls":[{"id":"toolu_vrtx_01J94F23FsWQbc9M8nzm7ok4","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 182ee75c179e4748b2dc\", :score=>321}, {:title=>\"Topic 035b4ab5156380ed97bd\", + :score=>158}, {:title=>\"Topic 33bd4a8bb04f7025cde4\", :score=>381}], :next_page=>\"t3_abc123_612\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01J94F23FsWQbc9M8nzm7ok4"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -164,7 +166,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:21 GMT + - Thu, 12 Jun 2025 12:36:44 GMT Content-Type: - application/json Transfer-Encoding: @@ -189,9 +191,9 @@ http_interactions: body: encoding: ASCII-8BIT string: "\n \n\n \n\n \n\n \n\n \n\n - \ \n{\"id\":\"gen-1749726858-z60WI5mpsFOkJTGmqx9K\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726858,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll - continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":838,\"completion_tokens\":48,\"total_tokens\":886}}" - recorded_at: Thu, 12 Jun 2025 11:14:21 GMT + \ \n\n \n{\"id\":\"gen-1749731802-JToparbYf61sGdPPF5XD\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749731802,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"Continuing + to fetch more posts:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01FbL9bfEyqWHev8Tu6cm77W\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":853,\"completion_tokens\":46,\"total_tokens\":899}}" + recorded_at: Thu, 12 Jun 2025 12:36:45 GMT - request: method: post uri: https://openrouter.ai/api/v1/chat/completions @@ -202,95 +204,20 @@ http_interactions: until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll - help you fetch all the posts from r/RandomNames using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_0183VSDfuSdUfVQLsPdckhEM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 8bd6955f661aa073152c\", :score=>681}, {:title=>\"Topic 599fec120d59157f57e3\", - :score=>647}, {:title=>\"Topic bbabdf73c02727e4a0b1\", :score=>584}], :next_page=>\"t3_abc123_198\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_0183VSDfuSdUfVQLsPdckhEM"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - a44a1d12f9bbb415be2a\", :score=>248}, {:title=>\"Topic 76ee52b58ec4350d6971\", - :score=>268}, {:title=>\"Topic fe016eb349423e666836\", :score=>26}], :next_page=>\"t3_abc123_855\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - e789ecb0c8321582994d\", :score=>896}, {:title=>\"Topic 42dacca3b4c9c1f48ba9\", - :score=>370}, {:title=>\"Topic 101b5f348c0657d48f46\", :score=>612}], :next_page=>\"t3_abc123_549\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches - posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets - current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude - (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., - 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' - headers: - User-Agent: - - Faraday v2.12.2 - Authorization: - - Bearer - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 12 Jun 2025 11:14:24 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Access-Control-Allow-Origin: - - "*" - X-Clerk-Auth-Message: - - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, - token-carrier=header) - X-Clerk-Auth-Reason: - - token-invalid - X-Clerk-Auth-Status: - - signed-out - Vary: - - Accept-Encoding - Server: - - cloudflare - Cf-Ray: - - "" - body: - encoding: ASCII-8BIT - string: "\n \n\n \n\n \n\n \n\n \n\n - \ \n\n \n{\"id\":\"gen-1749726861-T8Q9CGf40rDORwBDZ2K4\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726861,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll - continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_011XhcWpFadGvHzF2f56HdiL\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":1004,\"completion_tokens\":48,\"total_tokens\":1052}}" - recorded_at: Thu, 12 Jun 2025 11:14:24 GMT -- request: - method: post - uri: https://openrouter.ai/api/v1/chat/completions - body: - encoding: UTF-8 - string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch - all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array do not ask to continue fetching the - subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll - help you fetch all the posts from r/RandomNames using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_0183VSDfuSdUfVQLsPdckhEM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 8bd6955f661aa073152c\", :score=>681}, {:title=>\"Topic 599fec120d59157f57e3\", - :score=>647}, {:title=>\"Topic bbabdf73c02727e4a0b1\", :score=>584}], :next_page=>\"t3_abc123_198\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_0183VSDfuSdUfVQLsPdckhEM"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - a44a1d12f9bbb415be2a\", :score=>248}, {:title=>\"Topic 76ee52b58ec4350d6971\", - :score=>268}, {:title=>\"Topic fe016eb349423e666836\", :score=>26}], :next_page=>\"t3_abc123_855\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - e789ecb0c8321582994d\", :score=>896}, {:title=>\"Topic 42dacca3b4c9c1f48ba9\", - :score=>370}, {:title=>\"Topic 101b5f348c0657d48f46\", :score=>612}], :next_page=>\"t3_abc123_549\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_011XhcWpFadGvHzF2f56HdiL","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - d9a1fe19e58042916f25\", :score=>975}, {:title=>\"Topic 06e1bacd0b4d3767c6a8\", - :score=>600}, {:title=>\"Topic a375207cc38fa80db3a8\", :score=>816}], :next_page=>\"t3_abc123_187\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_011XhcWpFadGvHzF2f56HdiL"},{"role":"user","content":"What''s + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_vrtx_01Jfdbhe8rUYGtwGNchV2qqs","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + a59365c7c20376a34c63\", :score=>108}, {:title=>\"Topic da52b02474d3256cb00b\", + :score=>242}, {:title=>\"Topic fe6f3ddf55de24dfb35c\", :score=>497}], :next_page=>\"t3_abc123_441\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01Jfdbhe8rUYGtwGNchV2qqs"},{"role":"assistant","content":"I + see there are more posts available. I''ll continue fetching using the next_page + token:","tool_calls":[{"id":"toolu_vrtx_01J94F23FsWQbc9M8nzm7ok4","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 182ee75c179e4748b2dc\", :score=>321}, {:title=>\"Topic 035b4ab5156380ed97bd\", + :score=>158}, {:title=>\"Topic 33bd4a8bb04f7025cde4\", :score=>381}], :next_page=>\"t3_abc123_612\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01J94F23FsWQbc9M8nzm7ok4"},{"role":"assistant","content":"Continuing + to fetch more posts:","tool_calls":[{"id":"toolu_vrtx_01FbL9bfEyqWHev8Tu6cm77W","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 6bec4acb08c866fd49e1\", :score=>225}, {:title=>\"Topic 2daf0134afca111947dc\", + :score=>805}, {:title=>\"Topic 29be257458390fc2b52d\", :score=>565}], :next_page=>\"t3_abc123_947\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01FbL9bfEyqWHev8Tu6cm77W"},{"role":"user","content":"What''s the weather in Berlin? (52.5200, 13.4050)"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude @@ -313,7 +240,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:26 GMT + - Thu, 12 Jun 2025 12:36:48 GMT Content-Type: - application/json Transfer-Encoding: @@ -338,10 +265,10 @@ http_interactions: body: encoding: ASCII-8BIT string: "\n \n\n \n\n \n\n \n\n \n\n - \ \n\n \n{\"id\":\"gen-1749726864-vyQBuScXOtcu0QcmJAod\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726864,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll - fetch the current weather for Berlin using the provided coordinates:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_01NND4KWpnVoGtGJY4qMqoR1\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"weather\",\"arguments\":\"{\\\"latitude\\\": - \\\"52.5200\\\", \\\"longitude\\\": \\\"13.4050\\\"}\"}}]}}],\"usage\":{\"prompt_tokens\":1195,\"completion_tokens\":88,\"total_tokens\":1283}}" - recorded_at: Thu, 12 Jun 2025 11:14:27 GMT + \ \n\n \n\n \n\n \n{\"id\":\"gen-1749731805-HrQMtQwQYrwkwh4ofejy\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749731805,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + fetch the current weather for Berlin using the coordinates you provided.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01W7yKSwJMGL1ZjBwnMDJ3e9\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"weather\",\"arguments\":\"{\\\"latitude\\\": + \\\"52.5200\\\", \\\"longitude\\\": \\\"13.4050\\\"}\"}}]}}],\"usage\":{\"prompt_tokens\":1039,\"completion_tokens\":89,\"total_tokens\":1128}}" + recorded_at: Thu, 12 Jun 2025 12:36:49 GMT - request: method: post uri: https://openrouter.ai/api/v1/chat/completions @@ -352,26 +279,23 @@ http_interactions: until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll - help you fetch all the posts from r/RandomNames using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_0183VSDfuSdUfVQLsPdckhEM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 8bd6955f661aa073152c\", :score=>681}, {:title=>\"Topic 599fec120d59157f57e3\", - :score=>647}, {:title=>\"Topic bbabdf73c02727e4a0b1\", :score=>584}], :next_page=>\"t3_abc123_198\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_0183VSDfuSdUfVQLsPdckhEM"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - a44a1d12f9bbb415be2a\", :score=>248}, {:title=>\"Topic 76ee52b58ec4350d6971\", - :score=>268}, {:title=>\"Topic fe016eb349423e666836\", :score=>26}], :next_page=>\"t3_abc123_855\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01TnwKoy5JTzFcPyBeSm3PuQ"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - e789ecb0c8321582994d\", :score=>896}, {:title=>\"Topic 42dacca3b4c9c1f48ba9\", - :score=>370}, {:title=>\"Topic 101b5f348c0657d48f46\", :score=>612}], :next_page=>\"t3_abc123_549\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01EcuvRNNmmuMnJfaWEsN7YV"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_011XhcWpFadGvHzF2f56HdiL","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - d9a1fe19e58042916f25\", :score=>975}, {:title=>\"Topic 06e1bacd0b4d3767c6a8\", - :score=>600}, {:title=>\"Topic a375207cc38fa80db3a8\", :score=>816}], :next_page=>\"t3_abc123_187\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_011XhcWpFadGvHzF2f56HdiL"},{"role":"user","content":"What''s + help you fetch all the posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_vrtx_01Jfdbhe8rUYGtwGNchV2qqs","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + a59365c7c20376a34c63\", :score=>108}, {:title=>\"Topic da52b02474d3256cb00b\", + :score=>242}, {:title=>\"Topic fe6f3ddf55de24dfb35c\", :score=>497}], :next_page=>\"t3_abc123_441\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01Jfdbhe8rUYGtwGNchV2qqs"},{"role":"assistant","content":"I + see there are more posts available. I''ll continue fetching using the next_page + token:","tool_calls":[{"id":"toolu_vrtx_01J94F23FsWQbc9M8nzm7ok4","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 182ee75c179e4748b2dc\", :score=>321}, {:title=>\"Topic 035b4ab5156380ed97bd\", + :score=>158}, {:title=>\"Topic 33bd4a8bb04f7025cde4\", :score=>381}], :next_page=>\"t3_abc123_612\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01J94F23FsWQbc9M8nzm7ok4"},{"role":"assistant","content":"Continuing + to fetch more posts:","tool_calls":[{"id":"toolu_vrtx_01FbL9bfEyqWHev8Tu6cm77W","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 6bec4acb08c866fd49e1\", :score=>225}, {:title=>\"Topic 2daf0134afca111947dc\", + :score=>805}, {:title=>\"Topic 29be257458390fc2b52d\", :score=>565}], :next_page=>\"t3_abc123_947\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01FbL9bfEyqWHev8Tu6cm77W"},{"role":"user","content":"What''s the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","content":"I''ll - fetch the current weather for Berlin using the provided coordinates:","tool_calls":[{"id":"toolu_01NND4KWpnVoGtGJY4qMqoR1","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current - weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"toolu_01NND4KWpnVoGtGJY4qMqoR1"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + fetch the current weather for Berlin using the coordinates you provided.","tool_calls":[{"id":"toolu_vrtx_01W7yKSwJMGL1ZjBwnMDJ3e9","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"toolu_vrtx_01W7yKSwJMGL1ZjBwnMDJ3e9"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -393,7 +317,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:30 GMT + - Thu, 12 Jun 2025 12:36:51 GMT Content-Type: - application/json Transfer-Encoding: @@ -418,6 +342,6 @@ http_interactions: body: encoding: ASCII-8BIT string: !binary |- - CiAgICAgICAgIAoKICAgICAgICAgCgogICAgICAgICAKCiAgICAgICAgIAoKICAgICAgICAgCnsiaWQiOiJnZW4tMTc0OTcyNjg2OC13b3llRUJPeEJ3YjhSSVlvbDlBaiIsInByb3ZpZGVyIjoiQW50aHJvcGljIiwibW9kZWwiOiJhbnRocm9waWMvY2xhdWRlLTMuNS1oYWlrdSIsIm9iamVjdCI6ImNoYXQuY29tcGxldGlvbiIsImNyZWF0ZWQiOjE3NDk3MjY4NjgsImNob2ljZXMiOlt7ImxvZ3Byb2JzIjpudWxsLCJmaW5pc2hfcmVhc29uIjoic3RvcCIsIm5hdGl2ZV9maW5pc2hfcmVhc29uIjoic3RvcCIsImluZGV4IjowLCJtZXNzYWdlIjp7InJvbGUiOiJhc3Npc3RhbnQiLCJjb250ZW50IjoiVGhlIGN1cnJlbnQgd2VhdGhlciBpbiBCZXJsaW4gaXMgMTXCsEMgd2l0aCBhIHdpbmQgc3BlZWQgb2YgMTAga20vaC4iLCJyZWZ1c2FsIjpudWxsLCJyZWFzb25pbmciOm51bGx9fV0sInVzYWdlIjp7InByb21wdF90b2tlbnMiOjEzMjIsImNvbXBsZXRpb25fdG9rZW5zIjoyNiwidG90YWxfdG9rZW5zIjoxMzQ4fX0= - recorded_at: Thu, 12 Jun 2025 11:14:30 GMT + CiAgICAgICAgIAoKICAgICAgICAgCgogICAgICAgICAKCiAgICAgICAgIAp7ImlkIjoiZ2VuLTE3NDk3MzE4MDktT2Z0MFJVcGJaa3ZIT0ZTbUl0T3MiLCJwcm92aWRlciI6IkFudGhyb3BpYyIsIm1vZGVsIjoiYW50aHJvcGljL2NsYXVkZS0zLjUtaGFpa3UiLCJvYmplY3QiOiJjaGF0LmNvbXBsZXRpb24iLCJjcmVhdGVkIjoxNzQ5NzMxODA5LCJjaG9pY2VzIjpbeyJsb2dwcm9icyI6bnVsbCwiZmluaXNoX3JlYXNvbiI6InN0b3AiLCJuYXRpdmVfZmluaXNoX3JlYXNvbiI6InN0b3AiLCJpbmRleCI6MCwibWVzc2FnZSI6eyJyb2xlIjoiYXNzaXN0YW50IiwiY29udGVudCI6IlRoZSBjdXJyZW50IHdlYXRoZXIgaW4gQmVybGluIGlzIDE1wrBDIHdpdGggYSB3aW5kIHNwZWVkIG9mIDEwIGttL2guIiwicmVmdXNhbCI6bnVsbCwicmVhc29uaW5nIjpudWxsfX1dLCJ1c2FnZSI6eyJwcm9tcHRfdG9rZW5zIjoxMTY3LCJjb21wbGV0aW9uX3Rva2VucyI6MjYsInRvdGFsX3Rva2VucyI6MTE5M319 + recorded_at: Thu, 12 Jun 2025 12:36:51 GMT recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_tool_completions_limit_using_context.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_tool_completions_limit_using_context.yml deleted file mode 100644 index 906a2800..00000000 --- a/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_tool_completions_limit_using_context.yml +++ /dev/null @@ -1,420 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://openrouter.ai/api/v1/chat/completions - body: - encoding: UTF-8 - string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch - all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array do not ask to continue fetching the - subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches - posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets - current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude - (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., - 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' - headers: - User-Agent: - - Faraday v2.12.2 - Authorization: - - Bearer - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 12 Jun 2025 11:14:50 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Access-Control-Allow-Origin: - - "*" - X-Clerk-Auth-Message: - - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, - token-carrier=header) - X-Clerk-Auth-Reason: - - token-invalid - X-Clerk-Auth-Status: - - signed-out - Vary: - - Accept-Encoding - Server: - - cloudflare - Cf-Ray: - - "" - body: - encoding: ASCII-8BIT - string: "\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1749726889-2rWkRNf6vkvwi3jpjDB3\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726889,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I'll continue fetching pages until an empty array is returned.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_011Mur6e3VbEniFyXz6fprsz\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":488,\"completion_tokens\":75,\"total_tokens\":563}}" - recorded_at: Thu, 12 Jun 2025 11:14:51 GMT -- request: - method: post - uri: https://openrouter.ai/api/v1/chat/completions - body: - encoding: UTF-8 - string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch - all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array do not ask to continue fetching the - subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_011Mur6e3VbEniFyXz6fprsz","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 2ebc05d89e84827594f3\", :score=>744}, {:title=>\"Topic b5dbc6e4380e912018cd\", - :score=>233}, {:title=>\"Topic 560b1e7c32d0ba09a99b\", :score=>735}], :next_page=>\"t3_abc123_326\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_011Mur6e3VbEniFyXz6fprsz"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches - posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets - current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude - (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., - 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' - headers: - User-Agent: - - Faraday v2.12.2 - Authorization: - - Bearer - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 12 Jun 2025 11:14:55 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Access-Control-Allow-Origin: - - "*" - X-Clerk-Auth-Message: - - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, - token-carrier=header) - X-Clerk-Auth-Reason: - - token-invalid - X-Clerk-Auth-Status: - - signed-out - Vary: - - Accept-Encoding - Server: - - cloudflare - Cf-Ray: - - "" - body: - encoding: ASCII-8BIT - string: "\n \n\n \n\n \n\n \n\n \n\n - \ \n\n \n\n \n{\"id\":\"gen-1749726891-SOMFZNuoKMb1ep0WA674\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726891,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll - continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":682,\"completion_tokens\":48,\"total_tokens\":730}}" - recorded_at: Thu, 12 Jun 2025 11:14:55 GMT -- request: - method: post - uri: https://openrouter.ai/api/v1/chat/completions - body: - encoding: UTF-8 - string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch - all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array do not ask to continue fetching the - subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_011Mur6e3VbEniFyXz6fprsz","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 2ebc05d89e84827594f3\", :score=>744}, {:title=>\"Topic b5dbc6e4380e912018cd\", - :score=>233}, {:title=>\"Topic 560b1e7c32d0ba09a99b\", :score=>735}], :next_page=>\"t3_abc123_326\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_011Mur6e3VbEniFyXz6fprsz"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - ec0c62550f6b8b03bc0a\", :score=>978}, {:title=>\"Topic 41256b0e667243743f77\", - :score=>817}, {:title=>\"Topic 9326037e334a6e25e168\", :score=>669}], :next_page=>\"t3_abc123_247\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches - posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets - current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude - (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., - 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' - headers: - User-Agent: - - Faraday v2.12.2 - Authorization: - - Bearer - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 12 Jun 2025 11:14:56 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Access-Control-Allow-Origin: - - "*" - X-Clerk-Auth-Message: - - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, - token-carrier=header) - X-Clerk-Auth-Reason: - - token-invalid - X-Clerk-Auth-Status: - - signed-out - Vary: - - Accept-Encoding - Server: - - cloudflare - Cf-Ray: - - "" - body: - encoding: ASCII-8BIT - string: "\n \n\n \n\n \n{\"id\":\"gen-1749726895-v7DW3RIk39BA8BNqJZR5\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726895,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll - continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":846,\"completion_tokens\":48,\"total_tokens\":894}}" - recorded_at: Thu, 12 Jun 2025 11:14:57 GMT -- request: - method: post - uri: https://openrouter.ai/api/v1/chat/completions - body: - encoding: UTF-8 - string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch - all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array do not ask to continue fetching the - subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_011Mur6e3VbEniFyXz6fprsz","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 2ebc05d89e84827594f3\", :score=>744}, {:title=>\"Topic b5dbc6e4380e912018cd\", - :score=>233}, {:title=>\"Topic 560b1e7c32d0ba09a99b\", :score=>735}], :next_page=>\"t3_abc123_326\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_011Mur6e3VbEniFyXz6fprsz"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - ec0c62550f6b8b03bc0a\", :score=>978}, {:title=>\"Topic 41256b0e667243743f77\", - :score=>817}, {:title=>\"Topic 9326037e334a6e25e168\", :score=>669}], :next_page=>\"t3_abc123_247\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 437c1483ca20e842af6f\", :score=>360}, {:title=>\"Topic 1e71b95fdef7589639bc\", - :score=>747}, {:title=>\"Topic 8a1e2006a8ee01e8a0ea\", :score=>394}], :next_page=>\"t3_abc123_363\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches - posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets - current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude - (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., - 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' - headers: - User-Agent: - - Faraday v2.12.2 - Authorization: - - Bearer - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 12 Jun 2025 11:14:58 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Access-Control-Allow-Origin: - - "*" - X-Clerk-Auth-Message: - - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, - token-carrier=header) - X-Clerk-Auth-Reason: - - token-invalid - X-Clerk-Auth-Status: - - signed-out - Vary: - - Accept-Encoding - Server: - - cloudflare - Cf-Ray: - - "" - body: - encoding: ASCII-8BIT - string: "\n \n\n \n\n \n\n \n{\"id\":\"gen-1749726897-mUhcSDeT7XP2VK2Egn1M\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726897,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll - continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_01VWPy77vMnWRB3qKkvZMao6\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":1013,\"completion_tokens\":48,\"total_tokens\":1061}}" - recorded_at: Thu, 12 Jun 2025 11:14:59 GMT -- request: - method: post - uri: https://openrouter.ai/api/v1/chat/completions - body: - encoding: UTF-8 - string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch - all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array do not ask to continue fetching the - subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_011Mur6e3VbEniFyXz6fprsz","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 2ebc05d89e84827594f3\", :score=>744}, {:title=>\"Topic b5dbc6e4380e912018cd\", - :score=>233}, {:title=>\"Topic 560b1e7c32d0ba09a99b\", :score=>735}], :next_page=>\"t3_abc123_326\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_011Mur6e3VbEniFyXz6fprsz"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - ec0c62550f6b8b03bc0a\", :score=>978}, {:title=>\"Topic 41256b0e667243743f77\", - :score=>817}, {:title=>\"Topic 9326037e334a6e25e168\", :score=>669}], :next_page=>\"t3_abc123_247\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 437c1483ca20e842af6f\", :score=>360}, {:title=>\"Topic 1e71b95fdef7589639bc\", - :score=>747}, {:title=>\"Topic 8a1e2006a8ee01e8a0ea\", :score=>394}], :next_page=>\"t3_abc123_363\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_01VWPy77vMnWRB3qKkvZMao6","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 74b28b7c2f101aefe2e3\", :score=>754}, {:title=>\"Topic a548e747af75cd7387b0\", - :score=>627}, {:title=>\"Topic 7496349bff6d13f001c2\", :score=>759}], :next_page=>\"t3_abc123_374\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_01VWPy77vMnWRB3qKkvZMao6"},{"role":"user","content":"What''s - the weather in Berlin? (52.5200, 13.4050)"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches - posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets - current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude - (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., - 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' - headers: - User-Agent: - - Faraday v2.12.2 - Authorization: - - Bearer - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 12 Jun 2025 11:15:02 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Access-Control-Allow-Origin: - - "*" - X-Clerk-Auth-Message: - - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, - token-carrier=header) - X-Clerk-Auth-Reason: - - token-invalid - X-Clerk-Auth-Status: - - signed-out - Vary: - - Accept-Encoding - Server: - - cloudflare - Cf-Ray: - - "" - body: - encoding: ASCII-8BIT - string: "\n \n\n \n\n \n\n \n\n \n\n - \ \n\n \n\n \n\n \n{\"id\":\"gen-1749726899-Uny9RIdcwKUY6vExhOnu\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749726899,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll - fetch the current weather for Berlin using the provided coordinates.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01CfkEJkDdVdEHbSPqM1biwV\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"weather\",\"arguments\":\"{\\\"latitude\\\": - \\\"52.5200\\\", \\\"longitude\\\": \\\"13.4050\\\"}\"}}]}}],\"usage\":{\"prompt_tokens\":1204,\"completion_tokens\":88,\"total_tokens\":1292}}" - recorded_at: Thu, 12 Jun 2025 11:15:03 GMT -- request: - method: post - uri: https://openrouter.ai/api/v1/chat/completions - body: - encoding: UTF-8 - string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch - all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array do not ask to continue fetching the - subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_011Mur6e3VbEniFyXz6fprsz","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 2ebc05d89e84827594f3\", :score=>744}, {:title=>\"Topic b5dbc6e4380e912018cd\", - :score=>233}, {:title=>\"Topic 560b1e7c32d0ba09a99b\", :score=>735}], :next_page=>\"t3_abc123_326\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_011Mur6e3VbEniFyXz6fprsz"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - ec0c62550f6b8b03bc0a\", :score=>978}, {:title=>\"Topic 41256b0e667243743f77\", - :score=>817}, {:title=>\"Topic 9326037e334a6e25e168\", :score=>669}], :next_page=>\"t3_abc123_247\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01Sk4dEmDc4W632T2JPknd4U"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 437c1483ca20e842af6f\", :score=>360}, {:title=>\"Topic 1e71b95fdef7589639bc\", - :score=>747}, {:title=>\"Topic 8a1e2006a8ee01e8a0ea\", :score=>394}], :next_page=>\"t3_abc123_363\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_01L5Pcw8uF2mjfAjVaR1Pnjk"},{"role":"assistant","content":"I''ll - continue fetching the next page:","tool_calls":[{"id":"toolu_01VWPy77vMnWRB3qKkvZMao6","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 74b28b7c2f101aefe2e3\", :score=>754}, {:title=>\"Topic a548e747af75cd7387b0\", - :score=>627}, {:title=>\"Topic 7496349bff6d13f001c2\", :score=>759}], :next_page=>\"t3_abc123_374\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_01VWPy77vMnWRB3qKkvZMao6"},{"role":"user","content":"What''s - the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","content":"I''ll - fetch the current weather for Berlin using the provided coordinates.","tool_calls":[{"id":"toolu_vrtx_01CfkEJkDdVdEHbSPqM1biwV","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current - weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"toolu_vrtx_01CfkEJkDdVdEHbSPqM1biwV"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches - posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets - current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude - (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., - 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' - headers: - User-Agent: - - Faraday v2.12.2 - Authorization: - - Bearer - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 12 Jun 2025 11:15:04 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Access-Control-Allow-Origin: - - "*" - X-Clerk-Auth-Message: - - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, - token-carrier=header) - X-Clerk-Auth-Reason: - - token-invalid - X-Clerk-Auth-Status: - - signed-out - Vary: - - Accept-Encoding - Server: - - cloudflare - Cf-Ray: - - "" - body: - encoding: ASCII-8BIT - string: !binary |- - CiAgICAgICAgIAoKICAgICAgICAgCnsiaWQiOiJnZW4tMTc0OTcyNjkwMy1NbEk0NUR6aHF3OUV6MHhGWUZ1NCIsInByb3ZpZGVyIjoiQW50aHJvcGljIiwibW9kZWwiOiJhbnRocm9waWMvY2xhdWRlLTMuNS1oYWlrdSIsIm9iamVjdCI6ImNoYXQuY29tcGxldGlvbiIsImNyZWF0ZWQiOjE3NDk3MjY5MDMsImNob2ljZXMiOlt7ImxvZ3Byb2JzIjpudWxsLCJmaW5pc2hfcmVhc29uIjoic3RvcCIsIm5hdGl2ZV9maW5pc2hfcmVhc29uIjoic3RvcCIsImluZGV4IjowLCJtZXNzYWdlIjp7InJvbGUiOiJhc3Npc3RhbnQiLCJjb250ZW50IjoiVGhlIGN1cnJlbnQgd2VhdGhlciBpbiBCZXJsaW4gaXMgMTXCsEMgd2l0aCBhIHdpbmQgc3BlZWQgb2YgMTAga20vaC4iLCJyZWZ1c2FsIjpudWxsLCJyZWFzb25pbmciOm51bGx9fV0sInVzYWdlIjp7InByb21wdF90b2tlbnMiOjEzMzEsImNvbXBsZXRpb25fdG9rZW5zIjoyNiwidG90YWxfdG9rZW5zIjoxMzU3fX0= - recorded_at: Thu, 12 Jun 2025 11:15:04 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml new file mode 100644 index 00000000..adb7556e --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_anthropic_claude-3_5-haiku_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml @@ -0,0 +1,346 @@ +--- +http_interactions: +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 12:35:28 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n{\"id\":\"gen-1749731719-3jFIWY26phzFIoS2jnem\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749731724,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + help you fetch all posts from r/RandomNames by using the `looping_answer` + function. I'll continue fetching pages until an empty array is returned.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01VDMHGAJJQgbW7Y1pY7r6DL\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":488,\"completion_tokens\":74,\"total_tokens\":562}}" + recorded_at: Thu, 12 Jun 2025 12:35:29 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_vrtx_01VDMHGAJJQgbW7Y1pY7r6DL","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + ad9e4998521895aa6704\", :score=>245}, {:title=>\"Topic b1f375cd6031c90b8f4e\", + :score=>902}, {:title=>\"Topic 3d852719c447b9b6bee7\", :score=>638}], :next_page=>\"t3_abc123_835\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01VDMHGAJJQgbW7Y1pY7r6DL"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 12:35:33 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n\n \n\n \n{\"id\":\"gen-1749731730-dSGEZ1pbY2TUlWCc9tx0\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749731730,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + continue fetching the next page using the provided next_page token:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01BKfvGiVENmpZSYC1HbiBot\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":678,\"completion_tokens\":55,\"total_tokens\":733}}" + recorded_at: Thu, 12 Jun 2025 12:35:33 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_vrtx_01VDMHGAJJQgbW7Y1pY7r6DL","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + ad9e4998521895aa6704\", :score=>245}, {:title=>\"Topic b1f375cd6031c90b8f4e\", + :score=>902}, {:title=>\"Topic 3d852719c447b9b6bee7\", :score=>638}], :next_page=>\"t3_abc123_835\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01VDMHGAJJQgbW7Y1pY7r6DL"},{"role":"assistant","content":"I''ll + continue fetching the next page using the provided next_page token:","tool_calls":[{"id":"toolu_vrtx_01BKfvGiVENmpZSYC1HbiBot","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 446d6df8eaa61a7068e2\", :score=>447}, {:title=>\"Topic 0759c98d1a0151ebb8e8\", + :score=>970}, {:title=>\"Topic 07c2b51ebfd20c2e3de7\", :score=>775}], :next_page=>\"t3_abc123_268\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01BKfvGiVENmpZSYC1HbiBot"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 12:35:36 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n{\"id\":\"gen-1749731733-VRs3ZFPKQoofv7pK0ICF\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749731733,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + continue fetching the next page:\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01ULqeUknCM2zLSvoaczEipC\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"looping_answer\",\"arguments\":\"\"}}]}}],\"usage\":{\"prompt_tokens\":856,\"completion_tokens\":48,\"total_tokens\":904}}" + recorded_at: Thu, 12 Jun 2025 12:35:36 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_vrtx_01VDMHGAJJQgbW7Y1pY7r6DL","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + ad9e4998521895aa6704\", :score=>245}, {:title=>\"Topic b1f375cd6031c90b8f4e\", + :score=>902}, {:title=>\"Topic 3d852719c447b9b6bee7\", :score=>638}], :next_page=>\"t3_abc123_835\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01VDMHGAJJQgbW7Y1pY7r6DL"},{"role":"assistant","content":"I''ll + continue fetching the next page using the provided next_page token:","tool_calls":[{"id":"toolu_vrtx_01BKfvGiVENmpZSYC1HbiBot","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 446d6df8eaa61a7068e2\", :score=>447}, {:title=>\"Topic 0759c98d1a0151ebb8e8\", + :score=>970}, {:title=>\"Topic 07c2b51ebfd20c2e3de7\", :score=>775}], :next_page=>\"t3_abc123_268\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01BKfvGiVENmpZSYC1HbiBot"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01ULqeUknCM2zLSvoaczEipC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 4bf6bbbd073aa82ed093\", :score=>626}, {:title=>\"Topic 9d3f60351b9c62296713\", + :score=>844}, {:title=>\"Topic 1edd27a6f1ea183ddf32\", :score=>894}], :next_page=>\"t3_abc123_630\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01ULqeUknCM2zLSvoaczEipC"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 12:35:39 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: "\n \n\n \n\n \n\n \n\n \n\n + \ \n\n \n{\"id\":\"gen-1749731737-zaVie8DsnUDNFsGivfhh\",\"provider\":\"Google\",\"model\":\"anthropic/claude-3.5-haiku\",\"object\":\"chat.completion\",\"created\":1749731737,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll + fetch the current weather for Berlin using the provided coordinates.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_013G3fxUHM3abP1VKL44yxfM\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"weather\",\"arguments\":\"{\\\"latitude\\\": + \\\"52.5200\\\", \\\"longitude\\\": \\\"13.4050\\\"}\"}}]}}],\"usage\":{\"prompt_tokens\":1046,\"completion_tokens\":88,\"total_tokens\":1134}}" + recorded_at: Thu, 12 Jun 2025 12:35:40 GMT +- request: + method: post + uri: https://openrouter.ai/api/v1/chat/completions + body: + encoding: UTF-8 + string: '{"model":"anthropic/claude-3.5-haiku","messages":[{"role":"user","content":"Fetch + all of the posts from r/RandomNames. Fetch the next_page listed in the response + until it responds with an empty array do not ask to continue fetching the + subsequent pages until the last page is reached.If you are going to ask to + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","content":"I''ll + help you fetch all posts from r/RandomNames by using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned.","tool_calls":[{"id":"toolu_vrtx_01VDMHGAJJQgbW7Y1pY7r6DL","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + ad9e4998521895aa6704\", :score=>245}, {:title=>\"Topic b1f375cd6031c90b8f4e\", + :score=>902}, {:title=>\"Topic 3d852719c447b9b6bee7\", :score=>638}], :next_page=>\"t3_abc123_835\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01VDMHGAJJQgbW7Y1pY7r6DL"},{"role":"assistant","content":"I''ll + continue fetching the next page using the provided next_page token:","tool_calls":[{"id":"toolu_vrtx_01BKfvGiVENmpZSYC1HbiBot","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 446d6df8eaa61a7068e2\", :score=>447}, {:title=>\"Topic 0759c98d1a0151ebb8e8\", + :score=>970}, {:title=>\"Topic 07c2b51ebfd20c2e3de7\", :score=>775}], :next_page=>\"t3_abc123_268\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01BKfvGiVENmpZSYC1HbiBot"},{"role":"assistant","content":"I''ll + continue fetching the next page:","tool_calls":[{"id":"toolu_vrtx_01ULqeUknCM2zLSvoaczEipC","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 4bf6bbbd073aa82ed093\", :score=>626}, {:title=>\"Topic 9d3f60351b9c62296713\", + :score=>844}, {:title=>\"Topic 1edd27a6f1ea183ddf32\", :score=>894}], :next_page=>\"t3_abc123_630\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"toolu_vrtx_01ULqeUknCM2zLSvoaczEipC"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","content":"I''ll + fetch the current weather for Berlin using the provided coordinates.","tool_calls":[{"id":"toolu_vrtx_013G3fxUHM3abP1VKL44yxfM","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"toolu_vrtx_013G3fxUHM3abP1VKL44yxfM"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets + current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude + (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., + 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' + headers: + User-Agent: + - Faraday v2.12.2 + Authorization: + - Bearer + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 12 Jun 2025 12:35:42 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Allow-Origin: + - "*" + X-Clerk-Auth-Message: + - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, + token-carrier=header) + X-Clerk-Auth-Reason: + - token-invalid + X-Clerk-Auth-Status: + - signed-out + Vary: + - Accept-Encoding + Server: + - cloudflare + Cf-Ray: + - "" + body: + encoding: ASCII-8BIT + string: !binary |- + CiAgICAgICAgIAoKICAgICAgICAgCgogICAgICAgICAKCiAgICAgICAgIAoKICAgICAgICAgCnsiaWQiOiJnZW4tMTc0OTczMTc0MC13YWJFaFNIZ0ZYbkp5R05mSGNpOSIsInByb3ZpZGVyIjoiQW50aHJvcGljIiwibW9kZWwiOiJhbnRocm9waWMvY2xhdWRlLTMuNS1oYWlrdSIsIm9iamVjdCI6ImNoYXQuY29tcGxldGlvbiIsImNyZWF0ZWQiOjE3NDk3MzE3NDAsImNob2ljZXMiOlt7ImxvZ3Byb2JzIjpudWxsLCJmaW5pc2hfcmVhc29uIjoic3RvcCIsIm5hdGl2ZV9maW5pc2hfcmVhc29uIjoic3RvcCIsImluZGV4IjowLCJtZXNzYWdlIjp7InJvbGUiOiJhc3Npc3RhbnQiLCJjb250ZW50IjoiVGhlIGN1cnJlbnQgd2VhdGhlciBpbiBCZXJsaW4gaXMgMTXCsEMgd2l0aCBhIHdpbmQgc3BlZWQgb2YgMTAga20vaC4iLCJyZWZ1c2FsIjpudWxsLCJyZWFzb25pbmciOm51bGx9fV0sInVzYWdlIjp7InByb21wdF90b2tlbnMiOjExNzMsImNvbXBsZXRpb25fdG9rZW5zIjoyNiwidG90YWxfdG9rZW5zIjoxMTk5fX0= + recorded_at: Thu, 12 Jun 2025 12:35:42 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_configured_tool_llm_calls_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_configured_tool_llm_calls_limit.yml index 52e3a6ad..3315a0fd 100644 --- a/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_configured_tool_llm_calls_limit.yml +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_configured_tool_llm_calls_limit.yml @@ -33,7 +33,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:13:40 GMT + - Thu, 12 Jun 2025 12:36:23 GMT Content-Type: - application/json Transfer-Encoding: @@ -45,25 +45,25 @@ http_interactions: Anthropic-Ratelimit-Input-Tokens-Remaining: - '50000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-06-12T11:13:39Z' + - '2025-06-12T12:36:22Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-06-12T11:13:40Z' + - '2025-06-12T12:36:23Z' Anthropic-Ratelimit-Requests-Limit: - '50' Anthropic-Ratelimit-Requests-Remaining: - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-06-12T11:13:33Z' + - '2025-06-12T12:36:21Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - '60000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-06-12T11:13:39Z' + - '2025-06-12T12:36:22Z' Request-Id: - "" Strict-Transport-Security: @@ -82,10 +82,10 @@ http_interactions: - "" body: encoding: ASCII-8BIT - string: '{"id":"msg_01Ef527sBZsrhfDDQad7EBwQ","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_019U4fskwwsQjyrufocMMqKi","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":488,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":75,"service_tier":"standard"}}' - recorded_at: Thu, 12 Jun 2025 11:13:40 GMT + string: '{"id":"msg_015yVW7fX9FYCWcqdCSwjqtZ","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01E6KJHVLCyWdhgRHkST5psb","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":488,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":74,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 12:36:23 GMT - request: method: post uri: https://api.anthropic.com/v1/messages @@ -96,10 +96,10 @@ http_interactions: until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_019U4fskwwsQjyrufocMMqKi","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019U4fskwwsQjyrufocMMqKi","content":"{:posts=>[{:title=>\"Topic - 63d35d87ed04f0e9104b\", :score=>482}, {:title=>\"Topic 66ce249eee030c444048\", - :score=>534}, {:title=>\"Topic 311eb7b85e576ed7a627\", :score=>737}], :next_page=>\"t3_abc123_192\", + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01E6KJHVLCyWdhgRHkST5psb","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01E6KJHVLCyWdhgRHkST5psb","content":"{:posts=>[{:title=>\"Topic + e6ec0be71e18d4c93c7e\", :score=>208}, {:title=>\"Topic 1e0ee1a984764bc4ad61\", + :score=>136}, {:title=>\"Topic 02dfd4b5d5145947c20d\", :score=>961}], :next_page=>\"t3_abc123_863\", :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude @@ -124,7 +124,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:13:47 GMT + - Thu, 12 Jun 2025 12:36:25 GMT Content-Type: - application/json Transfer-Encoding: @@ -136,25 +136,25 @@ http_interactions: Anthropic-Ratelimit-Input-Tokens-Remaining: - '50000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-06-12T11:13:46Z' + - '2025-06-12T12:36:25Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-06-12T11:13:47Z' + - '2025-06-12T12:36:25Z' Anthropic-Ratelimit-Requests-Limit: - '50' Anthropic-Ratelimit-Requests-Remaining: - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-06-12T11:13:41Z' + - '2025-06-12T12:36:24Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - '60000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-06-12T11:13:46Z' + - '2025-06-12T12:36:25Z' Request-Id: - "" Strict-Transport-Security: @@ -173,10 +173,9 @@ http_interactions: - "" body: encoding: ASCII-8BIT - string: '{"id":"msg_01DpNhpUNNdB2yYFWuktvqen","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I - see there are more pages available. I''ll continue fetching with the next_page - token:"},{"type":"tool_use","id":"toolu_01MPYHpnu7FcTNn7GJKApmam","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":678,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":59,"service_tier":"standard"}}' - recorded_at: Thu, 12 Jun 2025 11:13:47 GMT + string: '{"id":"msg_016dNCNBu5kiJ8QndVuzbvQt","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_013UQDSPRQNWXowSxC2mTmHb","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":683,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":48,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 12:36:25 GMT - request: method: post uri: https://api.anthropic.com/v1/messages @@ -187,15 +186,14 @@ http_interactions: until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_019U4fskwwsQjyrufocMMqKi","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019U4fskwwsQjyrufocMMqKi","content":"{:posts=>[{:title=>\"Topic - 63d35d87ed04f0e9104b\", :score=>482}, {:title=>\"Topic 66ce249eee030c444048\", - :score=>534}, {:title=>\"Topic 311eb7b85e576ed7a627\", :score=>737}], :next_page=>\"t3_abc123_192\", - :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I - see there are more pages available. I''ll continue fetching with the next_page - token:"},{"type":"tool_use","id":"toolu_01MPYHpnu7FcTNn7GJKApmam","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01MPYHpnu7FcTNn7GJKApmam","content":"{:posts=>[{:title=>\"Topic - ea33769c3c6e44935763\", :score=>542}, {:title=>\"Topic 34ef51f7dd8594f5f24c\", - :score=>599}, {:title=>\"Topic f6203297d81fab22efa2\", :score=>161}], :next_page=>\"t3_abc123_303\", + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01E6KJHVLCyWdhgRHkST5psb","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01E6KJHVLCyWdhgRHkST5psb","content":"{:posts=>[{:title=>\"Topic + e6ec0be71e18d4c93c7e\", :score=>208}, {:title=>\"Topic 1e0ee1a984764bc4ad61\", + :score=>136}, {:title=>\"Topic 02dfd4b5d5145947c20d\", :score=>961}], :next_page=>\"t3_abc123_863\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_013UQDSPRQNWXowSxC2mTmHb","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_013UQDSPRQNWXowSxC2mTmHb","content":"{:posts=>[{:title=>\"Topic + 6ac5368eb7868450fa0a\", :score=>965}, {:title=>\"Topic cbdd9602545de765eb29\", + :score=>54}, {:title=>\"Topic eef34c1e528e09af9c45\", :score=>173}], :next_page=>\"t3_abc123_481\", :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude @@ -220,7 +218,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:13:54 GMT + - Thu, 12 Jun 2025 12:36:28 GMT Content-Type: - application/json Transfer-Encoding: @@ -232,25 +230,25 @@ http_interactions: Anthropic-Ratelimit-Input-Tokens-Remaining: - '50000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-06-12T11:13:53Z' + - '2025-06-12T12:36:28Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-06-12T11:13:54Z' + - '2025-06-12T12:36:28Z' Anthropic-Ratelimit-Requests-Limit: - '50' Anthropic-Ratelimit-Requests-Remaining: - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-06-12T11:13:49Z' + - '2025-06-12T12:36:27Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - '60000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-06-12T11:13:53Z' + - '2025-06-12T12:36:28Z' Request-Id: - "" Strict-Transport-Security: @@ -269,9 +267,9 @@ http_interactions: - "" body: encoding: ASCII-8BIT - string: '{"id":"msg_01XFENm2cBzPn2qDU8UAsUtT","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"Continuing - to fetch more pages:"},{"type":"tool_use","id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":852,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":46,"service_tier":"standard"}}' - recorded_at: Thu, 12 Jun 2025 11:13:54 GMT + string: '{"id":"msg_01Ldk9sDLFnqbRqQ9o2T7LvN","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"Continuing + to fetch:"},{"type":"tool_use","id":"toolu_01F5gWJdcgKnAxn7Ft4C1exp","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":844,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":44,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 12:36:28 GMT - request: method: post uri: https://api.anthropic.com/v1/messages @@ -282,20 +280,20 @@ http_interactions: until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_019U4fskwwsQjyrufocMMqKi","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019U4fskwwsQjyrufocMMqKi","content":"{:posts=>[{:title=>\"Topic - 63d35d87ed04f0e9104b\", :score=>482}, {:title=>\"Topic 66ce249eee030c444048\", - :score=>534}, {:title=>\"Topic 311eb7b85e576ed7a627\", :score=>737}], :next_page=>\"t3_abc123_192\", - :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I - see there are more pages available. I''ll continue fetching with the next_page - token:"},{"type":"tool_use","id":"toolu_01MPYHpnu7FcTNn7GJKApmam","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01MPYHpnu7FcTNn7GJKApmam","content":"{:posts=>[{:title=>\"Topic - ea33769c3c6e44935763\", :score=>542}, {:title=>\"Topic 34ef51f7dd8594f5f24c\", - :score=>599}, {:title=>\"Topic f6203297d81fab22efa2\", :score=>161}], :next_page=>\"t3_abc123_303\", + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01E6KJHVLCyWdhgRHkST5psb","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01E6KJHVLCyWdhgRHkST5psb","content":"{:posts=>[{:title=>\"Topic + e6ec0be71e18d4c93c7e\", :score=>208}, {:title=>\"Topic 1e0ee1a984764bc4ad61\", + :score=>136}, {:title=>\"Topic 02dfd4b5d5145947c20d\", :score=>961}], :next_page=>\"t3_abc123_863\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_013UQDSPRQNWXowSxC2mTmHb","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_013UQDSPRQNWXowSxC2mTmHb","content":"{:posts=>[{:title=>\"Topic + 6ac5368eb7868450fa0a\", :score=>965}, {:title=>\"Topic cbdd9602545de765eb29\", + :score=>54}, {:title=>\"Topic eef34c1e528e09af9c45\", :score=>173}], :next_page=>\"t3_abc123_481\", :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"Continuing - to fetch more pages:"},{"type":"tool_use","id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","content":"{:posts=>[{:title=>\"Topic - 0c3c2159d659b637c8ed\", :score=>362}, {:title=>\"Topic c273b6f59cfc9ec17853\", - :score=>187}, {:title=>\"Topic 5645c9c6ca9275a71641\", :score=>302}], :next_page=>\"t3_abc123_536\", - :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches + to fetch:"},{"type":"tool_use","id":"toolu_01F5gWJdcgKnAxn7Ft4C1exp","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01F5gWJdcgKnAxn7Ft4C1exp","content":"{:posts=>[{:title=>\"Topic + 19bc5e789b2465950f15\", :score=>591}, {:title=>\"Topic 8b5175f54f8b452149a4\", + :score=>932}, {:title=>\"Topic 92db62a5e36036c59fbf\", :score=>249}], :next_page=>\"t3_abc123_189\", + :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"user","content":[{"type":"text","text":"What''s + the weather in Berlin? (52.5200, 13.4050)"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -319,7 +317,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:13:56 GMT + - Thu, 12 Jun 2025 12:36:31 GMT Content-Type: - application/json Transfer-Encoding: @@ -331,25 +329,25 @@ http_interactions: Anthropic-Ratelimit-Input-Tokens-Remaining: - '50000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-06-12T11:13:56Z' + - '2025-06-12T12:36:30Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-06-12T11:13:56Z' + - '2025-06-12T12:36:31Z' Anthropic-Ratelimit-Requests-Limit: - '50' Anthropic-Ratelimit-Requests-Remaining: - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-06-12T11:13:55Z' + - '2025-06-12T12:36:29Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - '60000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-06-12T11:13:56Z' + - '2025-06-12T12:36:30Z' Request-Id: - "" Strict-Transport-Security: @@ -368,9 +366,9 @@ http_interactions: - "" body: encoding: ASCII-8BIT - string: '{"id":"msg_01LNaSrJpLhE69F1ugSoFCEP","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll - continue fetching:"},{"type":"tool_use","id":"toolu_01UzgebX95P15VVLuRrxVwPv","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1016,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":45,"service_tier":"standard"}}' - recorded_at: Thu, 12 Jun 2025 11:13:56 GMT + string: '{"id":"msg_01C1gZR5SFnqtxtjhPjga2ag","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + fetch the current weather for Berlin using the coordinates you provided:"},{"type":"tool_use","id":"toolu_0181WdzNfrmbabaceFbs5ZKc","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1031,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":89,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 12:36:31 GMT - request: method: post uri: https://api.anthropic.com/v1/messages @@ -381,130 +379,21 @@ http_interactions: until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_019U4fskwwsQjyrufocMMqKi","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019U4fskwwsQjyrufocMMqKi","content":"{:posts=>[{:title=>\"Topic - 63d35d87ed04f0e9104b\", :score=>482}, {:title=>\"Topic 66ce249eee030c444048\", - :score=>534}, {:title=>\"Topic 311eb7b85e576ed7a627\", :score=>737}], :next_page=>\"t3_abc123_192\", - :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I - see there are more pages available. I''ll continue fetching with the next_page - token:"},{"type":"tool_use","id":"toolu_01MPYHpnu7FcTNn7GJKApmam","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01MPYHpnu7FcTNn7GJKApmam","content":"{:posts=>[{:title=>\"Topic - ea33769c3c6e44935763\", :score=>542}, {:title=>\"Topic 34ef51f7dd8594f5f24c\", - :score=>599}, {:title=>\"Topic f6203297d81fab22efa2\", :score=>161}], :next_page=>\"t3_abc123_303\", - :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"Continuing - to fetch more pages:"},{"type":"tool_use","id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","content":"{:posts=>[{:title=>\"Topic - 0c3c2159d659b637c8ed\", :score=>362}, {:title=>\"Topic c273b6f59cfc9ec17853\", - :score=>187}, {:title=>\"Topic 5645c9c6ca9275a71641\", :score=>302}], :next_page=>\"t3_abc123_536\", + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01E6KJHVLCyWdhgRHkST5psb","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01E6KJHVLCyWdhgRHkST5psb","content":"{:posts=>[{:title=>\"Topic + e6ec0be71e18d4c93c7e\", :score=>208}, {:title=>\"Topic 1e0ee1a984764bc4ad61\", + :score=>136}, {:title=>\"Topic 02dfd4b5d5145947c20d\", :score=>961}], :next_page=>\"t3_abc123_863\", :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - continue fetching:"},{"type":"tool_use","id":"toolu_01UzgebX95P15VVLuRrxVwPv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01UzgebX95P15VVLuRrxVwPv","content":"{:posts=>[{:title=>\"Topic - c9f5b715b4d6084e2ee8\", :score=>582}, {:title=>\"Topic 7e57110ce7e58704deb9\", - :score=>594}, {:title=>\"Topic eb7911dedf86d6b6d445\", :score=>438}], :next_page=>\"t3_abc123_643\", - :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"user","content":[{"type":"text","text":"What''s - the weather in Berlin? (52.5200, 13.4050)"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches - posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets - current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude - (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., - 13.4050)"}},"required":["latitude","longitude"]}}]}' - headers: - User-Agent: - - Faraday v2.12.2 - X-Api-Key: - - "" - Anthropic-Version: - - '2023-06-01' - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 12 Jun 2025 11:14:00 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Anthropic-Ratelimit-Input-Tokens-Limit: - - '50000' - Anthropic-Ratelimit-Input-Tokens-Remaining: - - '49000' - Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-06-12T11:13:59Z' - Anthropic-Ratelimit-Output-Tokens-Limit: - - '10000' - Anthropic-Ratelimit-Output-Tokens-Remaining: - - '10000' - Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-06-12T11:14:00Z' - Anthropic-Ratelimit-Requests-Limit: - - '50' - Anthropic-Ratelimit-Requests-Remaining: - - '49' - Anthropic-Ratelimit-Requests-Reset: - - '2025-06-12T11:13:58Z' - Anthropic-Ratelimit-Tokens-Limit: - - '60000' - Anthropic-Ratelimit-Tokens-Remaining: - - '59000' - Anthropic-Ratelimit-Tokens-Reset: - - '2025-06-12T11:13:59Z' - Request-Id: - - "" - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Anthropic-Organization-Id: - - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a - Via: - - 1.1 google - Cf-Cache-Status: - - DYNAMIC - X-Robots-Tag: - - none - Server: - - cloudflare - Cf-Ray: - - "" - body: - encoding: ASCII-8BIT - string: '{"id":"msg_01Lm8cM4cSZRzPyjBXzSUnw1","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll - fetch the current weather for Berlin using its coordinates."},{"type":"tool_use","id":"toolu_01Msb1TvF5w72yFgXa1ADtvC","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1205,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":87,"service_tier":"standard"}}' - recorded_at: Thu, 12 Jun 2025 11:14:00 GMT -- request: - method: post - uri: https://api.anthropic.com/v1/messages - body: - encoding: UTF-8 - string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch - all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array do not ask to continue fetching the - subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_019U4fskwwsQjyrufocMMqKi","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_019U4fskwwsQjyrufocMMqKi","content":"{:posts=>[{:title=>\"Topic - 63d35d87ed04f0e9104b\", :score=>482}, {:title=>\"Topic 66ce249eee030c444048\", - :score=>534}, {:title=>\"Topic 311eb7b85e576ed7a627\", :score=>737}], :next_page=>\"t3_abc123_192\", - :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I - see there are more pages available. I''ll continue fetching with the next_page - token:"},{"type":"tool_use","id":"toolu_01MPYHpnu7FcTNn7GJKApmam","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01MPYHpnu7FcTNn7GJKApmam","content":"{:posts=>[{:title=>\"Topic - ea33769c3c6e44935763\", :score=>542}, {:title=>\"Topic 34ef51f7dd8594f5f24c\", - :score=>599}, {:title=>\"Topic f6203297d81fab22efa2\", :score=>161}], :next_page=>\"t3_abc123_303\", + continue fetching the next page:"},{"type":"tool_use","id":"toolu_013UQDSPRQNWXowSxC2mTmHb","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_013UQDSPRQNWXowSxC2mTmHb","content":"{:posts=>[{:title=>\"Topic + 6ac5368eb7868450fa0a\", :score=>965}, {:title=>\"Topic cbdd9602545de765eb29\", + :score=>54}, {:title=>\"Topic eef34c1e528e09af9c45\", :score=>173}], :next_page=>\"t3_abc123_481\", :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"Continuing - to fetch more pages:"},{"type":"tool_use","id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Taxu1WPPxt4YkKioqFmtPu","content":"{:posts=>[{:title=>\"Topic - 0c3c2159d659b637c8ed\", :score=>362}, {:title=>\"Topic c273b6f59cfc9ec17853\", - :score=>187}, {:title=>\"Topic 5645c9c6ca9275a71641\", :score=>302}], :next_page=>\"t3_abc123_536\", - :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - continue fetching:"},{"type":"tool_use","id":"toolu_01UzgebX95P15VVLuRrxVwPv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01UzgebX95P15VVLuRrxVwPv","content":"{:posts=>[{:title=>\"Topic - c9f5b715b4d6084e2ee8\", :score=>582}, {:title=>\"Topic 7e57110ce7e58704deb9\", - :score=>594}, {:title=>\"Topic eb7911dedf86d6b6d445\", :score=>438}], :next_page=>\"t3_abc123_643\", + to fetch:"},{"type":"tool_use","id":"toolu_01F5gWJdcgKnAxn7Ft4C1exp","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01F5gWJdcgKnAxn7Ft4C1exp","content":"{:posts=>[{:title=>\"Topic + 19bc5e789b2465950f15\", :score=>591}, {:title=>\"Topic 8b5175f54f8b452149a4\", + :score=>932}, {:title=>\"Topic 92db62a5e36036c59fbf\", :score=>249}], :next_page=>\"t3_abc123_189\", :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"user","content":[{"type":"text","text":"What''s the weather in Berlin? (52.5200, 13.4050)"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - fetch the current weather for Berlin using its coordinates."},{"type":"tool_use","id":"toolu_01Msb1TvF5w72yFgXa1ADtvC","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Msb1TvF5w72yFgXa1ADtvC","content":"Current + fetch the current weather for Berlin using the coordinates you provided:"},{"type":"tool_use","id":"toolu_0181WdzNfrmbabaceFbs5ZKc","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_0181WdzNfrmbabaceFbs5ZKc","content":"Current weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude @@ -529,7 +418,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:06 GMT + - Thu, 12 Jun 2025 12:36:33 GMT Content-Type: - application/json Transfer-Encoding: @@ -541,25 +430,25 @@ http_interactions: Anthropic-Ratelimit-Input-Tokens-Remaining: - '49000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-06-12T11:14:06Z' + - '2025-06-12T12:36:33Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-06-12T11:14:06Z' + - '2025-06-12T12:36:33Z' Anthropic-Ratelimit-Requests-Limit: - '50' Anthropic-Ratelimit-Requests-Remaining: - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-06-12T11:14:01Z' + - '2025-06-12T12:36:32Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - '59000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-06-12T11:14:06Z' + - '2025-06-12T12:36:33Z' Request-Id: - "" Strict-Transport-Security: @@ -579,6 +468,6 @@ http_interactions: body: encoding: ASCII-8BIT string: !binary |- - eyJpZCI6Im1zZ18wMUN4YzlyclRFb2g2YTJGRG50QlN4RmYiLCJ0eXBlIjoibWVzc2FnZSIsInJvbGUiOiJhc3Npc3RhbnQiLCJtb2RlbCI6ImNsYXVkZS0zLTUtaGFpa3UtMjAyNDEwMjIiLCJjb250ZW50IjpbeyJ0eXBlIjoidGV4dCIsInRleHQiOiJUaGUgY3VycmVudCB3ZWF0aGVyIGluIEJlcmxpbiBpcyAxNcKwQyB3aXRoIGEgd2luZCBzcGVlZCBvZiAxMCBrbS9oLiJ9XSwic3RvcF9yZWFzb24iOiJlbmRfdHVybiIsInN0b3Bfc2VxdWVuY2UiOm51bGwsInVzYWdlIjp7ImlucHV0X3Rva2VucyI6MTMzMSwiY2FjaGVfY3JlYXRpb25faW5wdXRfdG9rZW5zIjowLCJjYWNoZV9yZWFkX2lucHV0X3Rva2VucyI6MCwib3V0cHV0X3Rva2VucyI6MjYsInNlcnZpY2VfdGllciI6InN0YW5kYXJkIn19 - recorded_at: Thu, 12 Jun 2025 11:14:06 GMT + eyJpZCI6Im1zZ18wMTR3SkRnNVJ2NFRNWjlzdGFtVFVvZUQiLCJ0eXBlIjoibWVzc2FnZSIsInJvbGUiOiJhc3Npc3RhbnQiLCJtb2RlbCI6ImNsYXVkZS0zLTUtaGFpa3UtMjAyNDEwMjIiLCJjb250ZW50IjpbeyJ0eXBlIjoidGV4dCIsInRleHQiOiJUaGUgY3VycmVudCB3ZWF0aGVyIGluIEJlcmxpbiBpcyAxNcKwQyB3aXRoIGEgd2luZCBzcGVlZCBvZiAxMCBrbS9oLiJ9XSwic3RvcF9yZWFzb24iOiJlbmRfdHVybiIsInN0b3Bfc2VxdWVuY2UiOm51bGwsInVzYWdlIjp7ImlucHV0X3Rva2VucyI6MTE1OSwiY2FjaGVfY3JlYXRpb25faW5wdXRfdG9rZW5zIjowLCJjYWNoZV9yZWFkX2lucHV0X3Rva2VucyI6MCwib3V0cHV0X3Rva2VucyI6MjYsInNlcnZpY2VfdGllciI6InN0YW5kYXJkIn19 + recorded_at: Thu, 12 Jun 2025 12:36:33 GMT recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit_using_context.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml similarity index 57% rename from spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit_using_context.yml rename to spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml index 4f199151..61c86542 100644 --- a/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_completions_limit_using_context.yml +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml @@ -33,7 +33,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:40 GMT + - Thu, 12 Jun 2025 12:36:05 GMT Content-Type: - application/json Transfer-Encoding: @@ -45,25 +45,25 @@ http_interactions: Anthropic-Ratelimit-Input-Tokens-Remaining: - '50000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-06-12T11:14:39Z' + - '2025-06-12T12:36:04Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-06-12T11:14:40Z' + - '2025-06-12T12:36:05Z' Anthropic-Ratelimit-Requests-Limit: - '50' Anthropic-Ratelimit-Requests-Remaining: - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-06-12T11:14:39Z' + - '2025-06-12T12:36:03Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - '60000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-06-12T11:14:39Z' + - '2025-06-12T12:36:04Z' Request-Id: - "" Strict-Transport-Security: @@ -82,10 +82,10 @@ http_interactions: - "" body: encoding: ASCII-8BIT - string: '{"id":"msg_01NYtKzFXruFqkFTjxSBfi74","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":488,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":75,"service_tier":"standard"}}' - recorded_at: Thu, 12 Jun 2025 11:14:40 GMT + string: '{"id":"msg_01F82mdLxMB275g5yNtZLEdp","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01DQnbqVUFFNa7JvCVNc7d2v","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":488,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":74,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 12:36:05 GMT - request: method: post uri: https://api.anthropic.com/v1/messages @@ -96,10 +96,10 @@ http_interactions: until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","content":"{:posts=>[{:title=>\"Topic - 4464d333d3798ae8205c\", :score=>964}, {:title=>\"Topic c734949aeb5cabe9c98b\", - :score=>880}, {:title=>\"Topic 06f1be4809602ec05a16\", :score=>604}], :next_page=>\"t3_abc123_757\", + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01DQnbqVUFFNa7JvCVNc7d2v","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01DQnbqVUFFNa7JvCVNc7d2v","content":"{:posts=>[{:title=>\"Topic + 4d23e48c43bf4852dc59\", :score=>215}, {:title=>\"Topic 2c36035b0d266458ef36\", + :score=>128}, {:title=>\"Topic 9c0c9d5afe14166c0940\", :score=>330}], :next_page=>\"t3_abc123_655\", :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude @@ -124,7 +124,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:41 GMT + - Thu, 12 Jun 2025 12:36:08 GMT Content-Type: - application/json Transfer-Encoding: @@ -134,121 +134,27 @@ http_interactions: Anthropic-Ratelimit-Input-Tokens-Limit: - '50000' Anthropic-Ratelimit-Input-Tokens-Remaining: - - '49000' - Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-06-12T11:14:41Z' - Anthropic-Ratelimit-Output-Tokens-Limit: - - '10000' - Anthropic-Ratelimit-Output-Tokens-Remaining: - - '10000' - Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-06-12T11:14:41Z' - Anthropic-Ratelimit-Requests-Limit: - - '50' - Anthropic-Ratelimit-Requests-Remaining: - - '48' - Anthropic-Ratelimit-Requests-Reset: - - '2025-06-12T11:14:42Z' - Anthropic-Ratelimit-Tokens-Limit: - - '60000' - Anthropic-Ratelimit-Tokens-Remaining: - - '59000' - Anthropic-Ratelimit-Tokens-Reset: - - '2025-06-12T11:14:41Z' - Request-Id: - - "" - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Anthropic-Organization-Id: - - a2bc4b1c-6bf0-4b62-b1f6-a1d9821a5e3a - Via: - - 1.1 google - Cf-Cache-Status: - - DYNAMIC - X-Robots-Tag: - - none - Server: - - cloudflare - Cf-Ray: - - "" - body: - encoding: ASCII-8BIT - string: '{"id":"msg_01JKiidkTvjkzPnQ5R4t6gm6","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll - continue fetching the next page:"},{"type":"tool_use","id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":678,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":48,"service_tier":"standard"}}' - recorded_at: Thu, 12 Jun 2025 11:14:41 GMT -- request: - method: post - uri: https://api.anthropic.com/v1/messages - body: - encoding: UTF-8 - string: '{"model":"claude-3-5-haiku-20241022","messages":[{"role":"user","content":[{"type":"text","text":"Fetch - all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array do not ask to continue fetching the - subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","content":"{:posts=>[{:title=>\"Topic - 4464d333d3798ae8205c\", :score=>964}, {:title=>\"Topic c734949aeb5cabe9c98b\", - :score=>880}, {:title=>\"Topic 06f1be4809602ec05a16\", :score=>604}], :next_page=>\"t3_abc123_757\", - :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - continue fetching the next page:"},{"type":"tool_use","id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","content":"{:posts=>[{:title=>\"Topic - f8c72ebbf6b6d3c4499b\", :score=>105}, {:title=>\"Topic 29ceffecc53ae81b8a6c\", - :score=>165}, {:title=>\"Topic 95fbb12a4bccfdfc9d77\", :score=>572}], :next_page=>\"t3_abc123_391\", - :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches - posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets - current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude - (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., - 13.4050)"}},"required":["latitude","longitude"]}}]}' - headers: - User-Agent: - - Faraday v2.12.2 - X-Api-Key: - - "" - Anthropic-Version: - - '2023-06-01' - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 12 Jun 2025 11:14:43 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Anthropic-Ratelimit-Input-Tokens-Limit: - '50000' - Anthropic-Ratelimit-Input-Tokens-Remaining: - - '49000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-06-12T11:14:44Z' + - '2025-06-12T12:36:07Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-06-12T11:14:43Z' + - '2025-06-12T12:36:08Z' Anthropic-Ratelimit-Requests-Limit: - '50' Anthropic-Ratelimit-Requests-Remaining: - - '47' + - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-06-12T11:14:44Z' + - '2025-06-12T12:36:06Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - - '59000' + - '60000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-06-12T11:14:43Z' + - '2025-06-12T12:36:07Z' Request-Id: - "" Strict-Transport-Security: @@ -267,9 +173,9 @@ http_interactions: - "" body: encoding: ASCII-8BIT - string: '{"id":"msg_01MM5teEjQJC5TD8gEjEFHY6","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll - continue fetching the next page:"},{"type":"tool_use","id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":849,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":48,"service_tier":"standard"}}' - recorded_at: Thu, 12 Jun 2025 11:14:43 GMT + string: '{"id":"msg_01E7EzroojQ16bpLNNsWUvsX","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01JW2np5J6WASy5NKWexb6hr","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":681,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":48,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 12:36:07 GMT - request: method: post uri: https://api.anthropic.com/v1/messages @@ -280,18 +186,14 @@ http_interactions: until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","content":"{:posts=>[{:title=>\"Topic - 4464d333d3798ae8205c\", :score=>964}, {:title=>\"Topic c734949aeb5cabe9c98b\", - :score=>880}, {:title=>\"Topic 06f1be4809602ec05a16\", :score=>604}], :next_page=>\"t3_abc123_757\", - :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - continue fetching the next page:"},{"type":"tool_use","id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","content":"{:posts=>[{:title=>\"Topic - f8c72ebbf6b6d3c4499b\", :score=>105}, {:title=>\"Topic 29ceffecc53ae81b8a6c\", - :score=>165}, {:title=>\"Topic 95fbb12a4bccfdfc9d77\", :score=>572}], :next_page=>\"t3_abc123_391\", + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01DQnbqVUFFNa7JvCVNc7d2v","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01DQnbqVUFFNa7JvCVNc7d2v","content":"{:posts=>[{:title=>\"Topic + 4d23e48c43bf4852dc59\", :score=>215}, {:title=>\"Topic 2c36035b0d266458ef36\", + :score=>128}, {:title=>\"Topic 9c0c9d5afe14166c0940\", :score=>330}], :next_page=>\"t3_abc123_655\", :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - continue fetching the next page:"},{"type":"tool_use","id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","content":"{:posts=>[{:title=>\"Topic - bdadfc5f2e1988226d05\", :score=>968}, {:title=>\"Topic 4db858b16007708bbda2\", - :score=>744}, {:title=>\"Topic 797dac1157f42ccf1e95\", :score=>774}], :next_page=>\"t3_abc123_352\", + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01JW2np5J6WASy5NKWexb6hr","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01JW2np5J6WASy5NKWexb6hr","content":"{:posts=>[{:title=>\"Topic + c75a50ed9a664712ca01\", :score=>150}, {:title=>\"Topic 980b370274c3a34de6a5\", + :score=>784}, {:title=>\"Topic 73e3e352dbb957676ec6\", :score=>378}], :next_page=>\"t3_abc123_181\", :message=>\"More posts are available using the next_page token.\"}"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude @@ -316,7 +218,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:44 GMT + - Thu, 12 Jun 2025 12:36:10 GMT Content-Type: - application/json Transfer-Encoding: @@ -326,27 +228,27 @@ http_interactions: Anthropic-Ratelimit-Input-Tokens-Limit: - '50000' Anthropic-Ratelimit-Input-Tokens-Remaining: - - '48000' + - '50000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-06-12T11:14:47Z' + - '2025-06-12T12:36:09Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-06-12T11:14:44Z' + - '2025-06-12T12:36:10Z' Anthropic-Ratelimit-Requests-Limit: - '50' Anthropic-Ratelimit-Requests-Remaining: - - '47' + - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-06-12T11:14:47Z' + - '2025-06-12T12:36:09Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - - '58000' + - '60000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-06-12T11:14:44Z' + - '2025-06-12T12:36:09Z' Request-Id: - "" Strict-Transport-Security: @@ -365,9 +267,9 @@ http_interactions: - "" body: encoding: ASCII-8BIT - string: '{"id":"msg_011rUMzEw7nTjdiDyJwHmC1U","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll - continue fetching the next page:"},{"type":"tool_use","id":"toolu_01XYvbjjjRT2M3W1QkxXRx6W","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1012,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":48,"service_tier":"standard"}}' - recorded_at: Thu, 12 Jun 2025 11:14:44 GMT + string: '{"id":"msg_01VYZLboxxYk1KwDwUMm3v6R","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01Tt8XgaCiYe8o9XJeVS6wCv","name":"looping_answer","input":{}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":844,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":48,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 12:36:10 GMT - request: method: post uri: https://api.anthropic.com/v1/messages @@ -378,22 +280,18 @@ http_interactions: until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","content":"{:posts=>[{:title=>\"Topic - 4464d333d3798ae8205c\", :score=>964}, {:title=>\"Topic c734949aeb5cabe9c98b\", - :score=>880}, {:title=>\"Topic 06f1be4809602ec05a16\", :score=>604}], :next_page=>\"t3_abc123_757\", - :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - continue fetching the next page:"},{"type":"tool_use","id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","content":"{:posts=>[{:title=>\"Topic - f8c72ebbf6b6d3c4499b\", :score=>105}, {:title=>\"Topic 29ceffecc53ae81b8a6c\", - :score=>165}, {:title=>\"Topic 95fbb12a4bccfdfc9d77\", :score=>572}], :next_page=>\"t3_abc123_391\", + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01DQnbqVUFFNa7JvCVNc7d2v","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01DQnbqVUFFNa7JvCVNc7d2v","content":"{:posts=>[{:title=>\"Topic + 4d23e48c43bf4852dc59\", :score=>215}, {:title=>\"Topic 2c36035b0d266458ef36\", + :score=>128}, {:title=>\"Topic 9c0c9d5afe14166c0940\", :score=>330}], :next_page=>\"t3_abc123_655\", :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - continue fetching the next page:"},{"type":"tool_use","id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","content":"{:posts=>[{:title=>\"Topic - bdadfc5f2e1988226d05\", :score=>968}, {:title=>\"Topic 4db858b16007708bbda2\", - :score=>744}, {:title=>\"Topic 797dac1157f42ccf1e95\", :score=>774}], :next_page=>\"t3_abc123_352\", + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01JW2np5J6WASy5NKWexb6hr","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01JW2np5J6WASy5NKWexb6hr","content":"{:posts=>[{:title=>\"Topic + c75a50ed9a664712ca01\", :score=>150}, {:title=>\"Topic 980b370274c3a34de6a5\", + :score=>784}, {:title=>\"Topic 73e3e352dbb957676ec6\", :score=>378}], :next_page=>\"t3_abc123_181\", :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - continue fetching the next page:"},{"type":"tool_use","id":"toolu_01XYvbjjjRT2M3W1QkxXRx6W","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01XYvbjjjRT2M3W1QkxXRx6W","content":"{:posts=>[{:title=>\"Topic - 20d949e06c308dfd6a25\", :score=>935}, {:title=>\"Topic 0efe44ae9e7ee2e9b45c\", - :score=>413}, {:title=>\"Topic aa91410aa242c760c0e9\", :score=>652}], :next_page=>\"t3_abc123_76\", + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01Tt8XgaCiYe8o9XJeVS6wCv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Tt8XgaCiYe8o9XJeVS6wCv","content":"{:posts=>[{:title=>\"Topic + 8808d806e4641530a99e\", :score=>2}, {:title=>\"Topic 61a3d26705a880110c71\", + :score=>503}, {:title=>\"Topic 5cacbd3c8e21d61ef81b\", :score=>133}], :next_page=>\"t3_abc123_172\", :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"user","content":[{"type":"text","text":"What''s the weather in Berlin? (52.5200, 13.4050)"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets @@ -419,7 +317,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:47 GMT + - Thu, 12 Jun 2025 12:36:13 GMT Content-Type: - application/json Transfer-Encoding: @@ -429,27 +327,27 @@ http_interactions: Anthropic-Ratelimit-Input-Tokens-Limit: - '50000' Anthropic-Ratelimit-Input-Tokens-Remaining: - - '48000' + - '50000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-06-12T11:14:48Z' + - '2025-06-12T12:36:12Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-06-12T11:14:48Z' + - '2025-06-12T12:36:13Z' Anthropic-Ratelimit-Requests-Limit: - '50' Anthropic-Ratelimit-Requests-Remaining: - - '47' + - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-06-12T11:14:48Z' + - '2025-06-12T12:36:11Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - - '58000' + - '60000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-06-12T11:14:48Z' + - '2025-06-12T12:36:12Z' Request-Id: - "" Strict-Transport-Security: @@ -468,9 +366,9 @@ http_interactions: - "" body: encoding: ASCII-8BIT - string: '{"id":"msg_01Qz7dMSeWr9t4Vebh2qCMSL","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll - fetch the current weather for Berlin using its coordinates."},{"type":"tool_use","id":"toolu_01MmpDBvLhN67FWbQ8ThFEFT","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1204,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":87,"service_tier":"standard"}}' - recorded_at: Thu, 12 Jun 2025 11:14:47 GMT + string: '{"id":"msg_015Ygb59FQPDPapuzL4zrz2h","type":"message","role":"assistant","model":"claude-3-5-haiku-20241022","content":[{"type":"text","text":"I''ll + fetch the current weather for Berlin using the coordinates you provided."},{"type":"tool_use","id":"toolu_01WjcsHWikcumUYH1tKCPhrU","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1034,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":89,"service_tier":"standard"}}' + recorded_at: Thu, 12 Jun 2025 12:36:13 GMT - request: method: post uri: https://api.anthropic.com/v1/messages @@ -481,25 +379,21 @@ http_interactions: until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to continue fetching, the answer is yes. Continue Indefinitely."}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - help you fetch all the posts from r/RandomNames by using the `looping_answer` - function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01BGucBS8R9f6NRdHW1vaHgv","content":"{:posts=>[{:title=>\"Topic - 4464d333d3798ae8205c\", :score=>964}, {:title=>\"Topic c734949aeb5cabe9c98b\", - :score=>880}, {:title=>\"Topic 06f1be4809602ec05a16\", :score=>604}], :next_page=>\"t3_abc123_757\", + help you fetch all the posts from r/RandomNames using the `looping_answer` + function. I''ll continue fetching pages until an empty array is returned."},{"type":"tool_use","id":"toolu_01DQnbqVUFFNa7JvCVNc7d2v","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01DQnbqVUFFNa7JvCVNc7d2v","content":"{:posts=>[{:title=>\"Topic + 4d23e48c43bf4852dc59\", :score=>215}, {:title=>\"Topic 2c36035b0d266458ef36\", + :score=>128}, {:title=>\"Topic 9c0c9d5afe14166c0940\", :score=>330}], :next_page=>\"t3_abc123_655\", :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - continue fetching the next page:"},{"type":"tool_use","id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01CqmaEq5F9KY4Loa84ZFjZE","content":"{:posts=>[{:title=>\"Topic - f8c72ebbf6b6d3c4499b\", :score=>105}, {:title=>\"Topic 29ceffecc53ae81b8a6c\", - :score=>165}, {:title=>\"Topic 95fbb12a4bccfdfc9d77\", :score=>572}], :next_page=>\"t3_abc123_391\", + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01JW2np5J6WASy5NKWexb6hr","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01JW2np5J6WASy5NKWexb6hr","content":"{:posts=>[{:title=>\"Topic + c75a50ed9a664712ca01\", :score=>150}, {:title=>\"Topic 980b370274c3a34de6a5\", + :score=>784}, {:title=>\"Topic 73e3e352dbb957676ec6\", :score=>378}], :next_page=>\"t3_abc123_181\", :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - continue fetching the next page:"},{"type":"tool_use","id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Cn5UDrKeoREAwBxLZQ9Lo3","content":"{:posts=>[{:title=>\"Topic - bdadfc5f2e1988226d05\", :score=>968}, {:title=>\"Topic 4db858b16007708bbda2\", - :score=>744}, {:title=>\"Topic 797dac1157f42ccf1e95\", :score=>774}], :next_page=>\"t3_abc123_352\", - :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - continue fetching the next page:"},{"type":"tool_use","id":"toolu_01XYvbjjjRT2M3W1QkxXRx6W","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01XYvbjjjRT2M3W1QkxXRx6W","content":"{:posts=>[{:title=>\"Topic - 20d949e06c308dfd6a25\", :score=>935}, {:title=>\"Topic 0efe44ae9e7ee2e9b45c\", - :score=>413}, {:title=>\"Topic aa91410aa242c760c0e9\", :score=>652}], :next_page=>\"t3_abc123_76\", + continue fetching the next page:"},{"type":"tool_use","id":"toolu_01Tt8XgaCiYe8o9XJeVS6wCv","name":"looping_answer","input":{}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01Tt8XgaCiYe8o9XJeVS6wCv","content":"{:posts=>[{:title=>\"Topic + 8808d806e4641530a99e\", :score=>2}, {:title=>\"Topic 61a3d26705a880110c71\", + :score=>503}, {:title=>\"Topic 5cacbd3c8e21d61ef81b\", :score=>133}], :next_page=>\"t3_abc123_172\", :message=>\"More posts are available using the next_page token.\"}"}]},{"role":"user","content":[{"type":"text","text":"What''s the weather in Berlin? (52.5200, 13.4050)"}]},{"role":"assistant","content":[{"type":"text","text":"I''ll - fetch the current weather for Berlin using its coordinates."},{"type":"tool_use","id":"toolu_01MmpDBvLhN67FWbQ8ThFEFT","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01MmpDBvLhN67FWbQ8ThFEFT","content":"Current + fetch the current weather for Berlin using the coordinates you provided."},{"type":"tool_use","id":"toolu_01WjcsHWikcumUYH1tKCPhrU","name":"weather","input":{"latitude":"52.5200","longitude":"13.4050"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01WjcsHWikcumUYH1tKCPhrU","content":"Current weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h"}]}],"temperature":0.7,"stream":false,"max_tokens":8192,"tools":[{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","input_schema":{"type":"object","properties":{},"required":[]}},{"name":"weather","description":"Gets current weather for a location","input_schema":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude @@ -524,7 +418,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:49 GMT + - Thu, 12 Jun 2025 12:36:15 GMT Content-Type: - application/json Transfer-Encoding: @@ -536,25 +430,25 @@ http_interactions: Anthropic-Ratelimit-Input-Tokens-Remaining: - '49000' Anthropic-Ratelimit-Input-Tokens-Reset: - - '2025-06-12T11:14:50Z' + - '2025-06-12T12:36:15Z' Anthropic-Ratelimit-Output-Tokens-Limit: - '10000' Anthropic-Ratelimit-Output-Tokens-Remaining: - '10000' Anthropic-Ratelimit-Output-Tokens-Reset: - - '2025-06-12T11:14:49Z' + - '2025-06-12T12:36:15Z' Anthropic-Ratelimit-Requests-Limit: - '50' Anthropic-Ratelimit-Requests-Remaining: - - '48' + - '49' Anthropic-Ratelimit-Requests-Reset: - - '2025-06-12T11:14:49Z' + - '2025-06-12T12:36:14Z' Anthropic-Ratelimit-Tokens-Limit: - '60000' Anthropic-Ratelimit-Tokens-Remaining: - '59000' Anthropic-Ratelimit-Tokens-Reset: - - '2025-06-12T11:14:49Z' + - '2025-06-12T12:36:15Z' Request-Id: - "" Strict-Transport-Security: @@ -574,6 +468,6 @@ http_interactions: body: encoding: ASCII-8BIT string: !binary |- - eyJpZCI6Im1zZ18wMVVUU1c4Ylc3TWhEMndtOFIyOWhidWUiLCJ0eXBlIjoibWVzc2FnZSIsInJvbGUiOiJhc3Npc3RhbnQiLCJtb2RlbCI6ImNsYXVkZS0zLTUtaGFpa3UtMjAyNDEwMjIiLCJjb250ZW50IjpbeyJ0eXBlIjoidGV4dCIsInRleHQiOiJUaGUgY3VycmVudCB3ZWF0aGVyIGluIEJlcmxpbiBpcyAxNcKwQyB3aXRoIGEgd2luZCBzcGVlZCBvZiAxMCBrbS9oLiJ9XSwic3RvcF9yZWFzb24iOiJlbmRfdHVybiIsInN0b3Bfc2VxdWVuY2UiOm51bGwsInVzYWdlIjp7ImlucHV0X3Rva2VucyI6MTMzMCwiY2FjaGVfY3JlYXRpb25faW5wdXRfdG9rZW5zIjowLCJjYWNoZV9yZWFkX2lucHV0X3Rva2VucyI6MCwib3V0cHV0X3Rva2VucyI6MjYsInNlcnZpY2VfdGllciI6InN0YW5kYXJkIn19 - recorded_at: Thu, 12 Jun 2025 11:14:49 GMT + eyJpZCI6Im1zZ18wMUF6WmVuU0F5Q1Z4UW8xaTZMRHNKZ2MiLCJ0eXBlIjoibWVzc2FnZSIsInJvbGUiOiJhc3Npc3RhbnQiLCJtb2RlbCI6ImNsYXVkZS0zLTUtaGFpa3UtMjAyNDEwMjIiLCJjb250ZW50IjpbeyJ0eXBlIjoidGV4dCIsInRleHQiOiJUaGUgY3VycmVudCB3ZWF0aGVyIGluIEJlcmxpbiBpcyAxNcKwQyB3aXRoIGEgd2luZCBzcGVlZCBvZiAxMCBrbS9oLiJ9XSwic3RvcF9yZWFzb24iOiJlbmRfdHVybiIsInN0b3Bfc2VxdWVuY2UiOm51bGwsInVzYWdlIjp7ImlucHV0X3Rva2VucyI6MTE2MiwiY2FjaGVfY3JlYXRpb25faW5wdXRfdG9rZW5zIjowLCJjYWNoZV9yZWFkX2lucHV0X3Rva2VucyI6MCwib3V0cHV0X3Rva2VucyI6MjYsInNlcnZpY2VfdGllciI6InN0YW5kYXJkIn19 + recorded_at: Thu, 12 Jun 2025 12:36:15 GMT recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_tool_llm_calls_limit.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_tool_llm_calls_limit.yml index 37b7a587..693b5e46 100644 --- a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_tool_llm_calls_limit.yml +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_tool_llm_calls_limit.yml @@ -31,7 +31,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:07 GMT + - Thu, 12 Jun 2025 12:38:19 GMT Content-Type: - application/json Transfer-Encoding: @@ -43,11 +43,11 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '325' + - '178' Openai-Version: - '2020-10-01' X-Envoy-Upstream-Service-Time: - - '331' + - '182' X-Ratelimit-Limit-Requests: - '500' X-Ratelimit-Limit-Tokens: @@ -81,9 +81,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BhaAguGQIrLgMNzx13mbihjUe4tNy", + "id": "chatcmpl-BhbUAuSjKv2sgEhvdN9lM53MIt0SZ", "object": "chat.completion", - "created": 1749726846, + "created": 1749731898, "model": "gpt-4.1-nano-2025-04-14", "choices": [ { @@ -93,7 +93,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_ecTjk8XOMKWrWjU1JU38TYDU", + "id": "call_rAwws28MoEmbC7oWgAHxJo30", "type": "function", "function": { "name": "looping_answer", @@ -126,7 +126,7 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_38343a2f8f" } - recorded_at: Thu, 12 Jun 2025 11:14:07 GMT + recorded_at: Thu, 12 Jun 2025 12:38:19 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions @@ -136,10 +136,10 @@ http_interactions: all of the posts from r/RandomNames. Fetch the next_page listed in the response until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_ecTjk8XOMKWrWjU1JU38TYDU","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 261c4ef44a20238a01ae\", :score=>486}, {:title=>\"Topic 8d600fdd8e8b401cfb34\", - :score=>980}, {:title=>\"Topic c445b59484add1a7b72d\", :score=>426}], :next_page=>\"t3_abc123_547\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ecTjk8XOMKWrWjU1JU38TYDU"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_rAwws28MoEmbC7oWgAHxJo30","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 11a156ace9f3f923bf06\", :score=>943}, {:title=>\"Topic 4ba41a5abb3dafdeae8b\", + :score=>539}, {:title=>\"Topic 043013419aac79178d8e\", :score=>57}], :next_page=>\"t3_abc123_464\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_rAwws28MoEmbC7oWgAHxJo30"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -161,7 +161,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:07 GMT + - Thu, 12 Jun 2025 12:38:19 GMT Content-Type: - application/json Transfer-Encoding: @@ -173,11 +173,11 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '446' + - '352' Openai-Version: - '2020-10-01' X-Envoy-Upstream-Service-Time: - - '455' + - '356' X-Ratelimit-Limit-Requests: - '500' X-Ratelimit-Limit-Tokens: @@ -211,9 +211,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BhaAhrvOpgt8OO7zPVI6ZRxynpoBb", + "id": "chatcmpl-BhbUBQ30rQV7Wv52qZ0JkJxhPUPcD", "object": "chat.completion", - "created": 1749726847, + "created": 1749731899, "model": "gpt-4.1-nano-2025-04-14", "choices": [ { @@ -223,7 +223,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_ZyrNsChAtbkXx4LU91SCFFau", + "id": "call_Goyg8rljfkkQpcUKzikzHyz9", "type": "function", "function": { "name": "looping_answer", @@ -239,9 +239,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 269, + "prompt_tokens": 266, "completion_tokens": 11, - "total_tokens": 280, + "total_tokens": 277, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -256,7 +256,7 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_38343a2f8f" } - recorded_at: Thu, 12 Jun 2025 11:14:07 GMT + recorded_at: Thu, 12 Jun 2025 12:38:19 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions @@ -266,13 +266,13 @@ http_interactions: all of the posts from r/RandomNames. Fetch the next_page listed in the response until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_ecTjk8XOMKWrWjU1JU38TYDU","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 261c4ef44a20238a01ae\", :score=>486}, {:title=>\"Topic 8d600fdd8e8b401cfb34\", - :score=>980}, {:title=>\"Topic c445b59484add1a7b72d\", :score=>426}], :next_page=>\"t3_abc123_547\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ecTjk8XOMKWrWjU1JU38TYDU"},{"role":"assistant","tool_calls":[{"id":"call_ZyrNsChAtbkXx4LU91SCFFau","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 8fe8a19a3500808df733\", :score=>338}, {:title=>\"Topic 3df3366498cef55fbefa\", - :score=>704}, {:title=>\"Topic ba46229f94f578b50f16\", :score=>224}], :next_page=>\"t3_abc123_717\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ZyrNsChAtbkXx4LU91SCFFau"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_rAwws28MoEmbC7oWgAHxJo30","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 11a156ace9f3f923bf06\", :score=>943}, {:title=>\"Topic 4ba41a5abb3dafdeae8b\", + :score=>539}, {:title=>\"Topic 043013419aac79178d8e\", :score=>57}], :next_page=>\"t3_abc123_464\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_rAwws28MoEmbC7oWgAHxJo30"},{"role":"assistant","tool_calls":[{"id":"call_Goyg8rljfkkQpcUKzikzHyz9","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 2547f5415f1fb619a09d\", :score=>333}, {:title=>\"Topic 4db71b6bb077d7fdaa30\", + :score=>622}, {:title=>\"Topic bd22d142298ad2497ca0\", :score=>916}], :next_page=>\"t3_abc123_691\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_Goyg8rljfkkQpcUKzikzHyz9"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -294,7 +294,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:08 GMT + - Thu, 12 Jun 2025 12:38:20 GMT Content-Type: - application/json Transfer-Encoding: @@ -306,11 +306,11 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '194' + - '262' Openai-Version: - '2020-10-01' X-Envoy-Upstream-Service-Time: - - '199' + - '267' X-Ratelimit-Limit-Requests: - '500' X-Ratelimit-Limit-Tokens: @@ -318,7 +318,7 @@ http_interactions: X-Ratelimit-Remaining-Requests: - '499' X-Ratelimit-Remaining-Tokens: - - '199787' + - '199788' X-Ratelimit-Reset-Requests: - 120ms X-Ratelimit-Reset-Tokens: @@ -344,9 +344,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BhaAiT04r1UUdck9SqWN4im4kdGdP", + "id": "chatcmpl-BhbUC1uxwd8IPC1ELAcYl2bECokpj", "object": "chat.completion", - "created": 1749726848, + "created": 1749731900, "model": "gpt-4.1-nano-2025-04-14", "choices": [ { @@ -356,7 +356,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_nZBn760g3YG8RkGVmSkGZCHQ", + "id": "call_FdzUE0ZItsQI2L0qZXzw23dK", "type": "function", "function": { "name": "looping_answer", @@ -389,7 +389,7 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_38343a2f8f" } - recorded_at: Thu, 12 Jun 2025 11:14:08 GMT + recorded_at: Thu, 12 Jun 2025 12:38:20 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions @@ -399,155 +399,16 @@ http_interactions: all of the posts from r/RandomNames. Fetch the next_page listed in the response until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_ecTjk8XOMKWrWjU1JU38TYDU","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 261c4ef44a20238a01ae\", :score=>486}, {:title=>\"Topic 8d600fdd8e8b401cfb34\", - :score=>980}, {:title=>\"Topic c445b59484add1a7b72d\", :score=>426}], :next_page=>\"t3_abc123_547\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ecTjk8XOMKWrWjU1JU38TYDU"},{"role":"assistant","tool_calls":[{"id":"call_ZyrNsChAtbkXx4LU91SCFFau","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 8fe8a19a3500808df733\", :score=>338}, {:title=>\"Topic 3df3366498cef55fbefa\", - :score=>704}, {:title=>\"Topic ba46229f94f578b50f16\", :score=>224}], :next_page=>\"t3_abc123_717\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ZyrNsChAtbkXx4LU91SCFFau"},{"role":"assistant","tool_calls":[{"id":"call_nZBn760g3YG8RkGVmSkGZCHQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 63b8a6a18bacf684f6f8\", :score=>805}, {:title=>\"Topic e69bbce55230161ed037\", - :score=>849}, {:title=>\"Topic 44a20d5624875bac9bb0\", :score=>836}], :next_page=>\"t3_abc123_518\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nZBn760g3YG8RkGVmSkGZCHQ"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches - posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets - current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude - (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., - 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' - headers: - User-Agent: - - Faraday v2.12.2 - Authorization: - - Bearer - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 12 Jun 2025 11:14:09 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Access-Control-Expose-Headers: - - X-Request-ID - Openai-Organization: - - "" - Openai-Processing-Ms: - - '405' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '411' - X-Ratelimit-Limit-Requests: - - '500' - X-Ratelimit-Limit-Tokens: - - '200000' - X-Ratelimit-Remaining-Requests: - - '499' - X-Ratelimit-Remaining-Tokens: - - '199721' - X-Ratelimit-Reset-Requests: - - 120ms - X-Ratelimit-Reset-Tokens: - - 83ms - X-Request-Id: - - "" - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Cf-Cache-Status: - - DYNAMIC - Set-Cookie: - - "" - - "" - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - "" - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: ASCII-8BIT - string: | - { - "id": "chatcmpl-BhaAiD5LyQ3JHhahsg6fGQBaE1PxO", - "object": "chat.completion", - "created": 1749726848, - "model": "gpt-4.1-nano-2025-04-14", - "choices": [ - { - "index": 0, - "message": { - "role": "assistant", - "content": null, - "tool_calls": [ - { - "id": "call_71eF3qGUyI6hSQPEW8rCZEi4", - "type": "function", - "function": { - "name": "looping_answer", - "arguments": "{}" - } - } - ], - "refusal": null, - "annotations": [] - }, - "logprobs": null, - "finish_reason": "tool_calls" - } - ], - "usage": { - "prompt_tokens": 498, - "completion_tokens": 11, - "total_tokens": 509, - "prompt_tokens_details": { - "cached_tokens": 0, - "audio_tokens": 0 - }, - "completion_tokens_details": { - "reasoning_tokens": 0, - "audio_tokens": 0, - "accepted_prediction_tokens": 0, - "rejected_prediction_tokens": 0 - } - }, - "service_tier": "default", - "system_fingerprint": "fp_38343a2f8f" - } - recorded_at: Thu, 12 Jun 2025 11:14:09 GMT -- request: - method: post - uri: https://api.openai.com/v1/chat/completions - body: - encoding: UTF-8 - string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch - all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array do not ask to continue fetching the - subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_ecTjk8XOMKWrWjU1JU38TYDU","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 261c4ef44a20238a01ae\", :score=>486}, {:title=>\"Topic 8d600fdd8e8b401cfb34\", - :score=>980}, {:title=>\"Topic c445b59484add1a7b72d\", :score=>426}], :next_page=>\"t3_abc123_547\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ecTjk8XOMKWrWjU1JU38TYDU"},{"role":"assistant","tool_calls":[{"id":"call_ZyrNsChAtbkXx4LU91SCFFau","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 8fe8a19a3500808df733\", :score=>338}, {:title=>\"Topic 3df3366498cef55fbefa\", - :score=>704}, {:title=>\"Topic ba46229f94f578b50f16\", :score=>224}], :next_page=>\"t3_abc123_717\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ZyrNsChAtbkXx4LU91SCFFau"},{"role":"assistant","tool_calls":[{"id":"call_nZBn760g3YG8RkGVmSkGZCHQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 63b8a6a18bacf684f6f8\", :score=>805}, {:title=>\"Topic e69bbce55230161ed037\", - :score=>849}, {:title=>\"Topic 44a20d5624875bac9bb0\", :score=>836}], :next_page=>\"t3_abc123_518\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nZBn760g3YG8RkGVmSkGZCHQ"},{"role":"assistant","tool_calls":[{"id":"call_71eF3qGUyI6hSQPEW8rCZEi4","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - e2ef7f0122f81e4cd152\", :score=>591}, {:title=>\"Topic 62916ca9a4dfb0bc2321\", - :score=>479}, {:title=>\"Topic 476e4ca8d25846d79dd8\", :score=>222}], :next_page=>\"t3_abc123_872\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_71eF3qGUyI6hSQPEW8rCZEi4"},{"role":"user","content":"What''s + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_rAwws28MoEmbC7oWgAHxJo30","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 11a156ace9f3f923bf06\", :score=>943}, {:title=>\"Topic 4ba41a5abb3dafdeae8b\", + :score=>539}, {:title=>\"Topic 043013419aac79178d8e\", :score=>57}], :next_page=>\"t3_abc123_464\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_rAwws28MoEmbC7oWgAHxJo30"},{"role":"assistant","tool_calls":[{"id":"call_Goyg8rljfkkQpcUKzikzHyz9","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 2547f5415f1fb619a09d\", :score=>333}, {:title=>\"Topic 4db71b6bb077d7fdaa30\", + :score=>622}, {:title=>\"Topic bd22d142298ad2497ca0\", :score=>916}], :next_page=>\"t3_abc123_691\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_Goyg8rljfkkQpcUKzikzHyz9"},{"role":"assistant","tool_calls":[{"id":"call_FdzUE0ZItsQI2L0qZXzw23dK","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 10e0d02dd7c89dda681f\", :score=>803}, {:title=>\"Topic f8135998d10ee20c7ef1\", + :score=>489}, {:title=>\"Topic c263db9044801bda57aa\", :score=>25}], :next_page=>\"t3_abc123_831\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_FdzUE0ZItsQI2L0qZXzw23dK"},{"role":"user","content":"What''s the weather in Berlin? (52.5200, 13.4050)"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude @@ -570,7 +431,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:10 GMT + - Thu, 12 Jun 2025 12:38:21 GMT Content-Type: - application/json Transfer-Encoding: @@ -582,11 +443,11 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '364' + - '404' Openai-Version: - '2020-10-01' X-Envoy-Upstream-Service-Time: - - '368' + - '407' X-Ratelimit-Limit-Requests: - '500' X-Ratelimit-Limit-Tokens: @@ -594,11 +455,11 @@ http_interactions: X-Ratelimit-Remaining-Requests: - '499' X-Ratelimit-Remaining-Tokens: - - '199640' + - '199707' X-Ratelimit-Reset-Requests: - 120ms X-Ratelimit-Reset-Tokens: - - 108ms + - 87ms X-Request-Id: - "" Strict-Transport-Security: @@ -620,9 +481,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BhaAjAlUkjq0oLlYU4tRFfwal6Q9r", + "id": "chatcmpl-BhbUD7zAwTbSHLedE5PdWXPUdcHhW", "object": "chat.completion", - "created": 1749726849, + "created": 1749731901, "model": "gpt-4.1-nano-2025-04-14", "choices": [ { @@ -632,7 +493,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_J7PR4gEK6SKWx7cecLAXyyjQ", + "id": "call_yYV51yJ3dDZLY3LeoRzRNus2", "type": "function", "function": { "name": "weather", @@ -648,9 +509,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 639, + "prompt_tokens": 519, "completion_tokens": 23, - "total_tokens": 662, + "total_tokens": 542, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -665,7 +526,7 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_38343a2f8f" } - recorded_at: Thu, 12 Jun 2025 11:14:10 GMT + recorded_at: Thu, 12 Jun 2025 12:38:21 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions @@ -675,21 +536,18 @@ http_interactions: all of the posts from r/RandomNames. Fetch the next_page listed in the response until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_ecTjk8XOMKWrWjU1JU38TYDU","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 261c4ef44a20238a01ae\", :score=>486}, {:title=>\"Topic 8d600fdd8e8b401cfb34\", - :score=>980}, {:title=>\"Topic c445b59484add1a7b72d\", :score=>426}], :next_page=>\"t3_abc123_547\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ecTjk8XOMKWrWjU1JU38TYDU"},{"role":"assistant","tool_calls":[{"id":"call_ZyrNsChAtbkXx4LU91SCFFau","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 8fe8a19a3500808df733\", :score=>338}, {:title=>\"Topic 3df3366498cef55fbefa\", - :score=>704}, {:title=>\"Topic ba46229f94f578b50f16\", :score=>224}], :next_page=>\"t3_abc123_717\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_ZyrNsChAtbkXx4LU91SCFFau"},{"role":"assistant","tool_calls":[{"id":"call_nZBn760g3YG8RkGVmSkGZCHQ","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 63b8a6a18bacf684f6f8\", :score=>805}, {:title=>\"Topic e69bbce55230161ed037\", - :score=>849}, {:title=>\"Topic 44a20d5624875bac9bb0\", :score=>836}], :next_page=>\"t3_abc123_518\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_nZBn760g3YG8RkGVmSkGZCHQ"},{"role":"assistant","tool_calls":[{"id":"call_71eF3qGUyI6hSQPEW8rCZEi4","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - e2ef7f0122f81e4cd152\", :score=>591}, {:title=>\"Topic 62916ca9a4dfb0bc2321\", - :score=>479}, {:title=>\"Topic 476e4ca8d25846d79dd8\", :score=>222}], :next_page=>\"t3_abc123_872\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_71eF3qGUyI6hSQPEW8rCZEi4"},{"role":"user","content":"What''s - the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","tool_calls":[{"id":"call_J7PR4gEK6SKWx7cecLAXyyjQ","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current - weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"call_J7PR4gEK6SKWx7cecLAXyyjQ"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_rAwws28MoEmbC7oWgAHxJo30","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 11a156ace9f3f923bf06\", :score=>943}, {:title=>\"Topic 4ba41a5abb3dafdeae8b\", + :score=>539}, {:title=>\"Topic 043013419aac79178d8e\", :score=>57}], :next_page=>\"t3_abc123_464\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_rAwws28MoEmbC7oWgAHxJo30"},{"role":"assistant","tool_calls":[{"id":"call_Goyg8rljfkkQpcUKzikzHyz9","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 2547f5415f1fb619a09d\", :score=>333}, {:title=>\"Topic 4db71b6bb077d7fdaa30\", + :score=>622}, {:title=>\"Topic bd22d142298ad2497ca0\", :score=>916}], :next_page=>\"t3_abc123_691\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_Goyg8rljfkkQpcUKzikzHyz9"},{"role":"assistant","tool_calls":[{"id":"call_FdzUE0ZItsQI2L0qZXzw23dK","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 10e0d02dd7c89dda681f\", :score=>803}, {:title=>\"Topic f8135998d10ee20c7ef1\", + :score=>489}, {:title=>\"Topic c263db9044801bda57aa\", :score=>25}], :next_page=>\"t3_abc123_831\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_FdzUE0ZItsQI2L0qZXzw23dK"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","tool_calls":[{"id":"call_yYV51yJ3dDZLY3LeoRzRNus2","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"call_yYV51yJ3dDZLY3LeoRzRNus2"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -711,7 +569,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:14:11 GMT + - Thu, 12 Jun 2025 12:38:23 GMT Content-Type: - application/json Transfer-Encoding: @@ -723,11 +581,11 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '369' + - '775' Openai-Version: - '2020-10-01' X-Envoy-Upstream-Service-Time: - - '372' + - '784' X-Ratelimit-Limit-Requests: - '500' X-Ratelimit-Limit-Tokens: @@ -735,11 +593,11 @@ http_interactions: X-Ratelimit-Remaining-Requests: - '499' X-Ratelimit-Remaining-Tokens: - - '199623' + - '199692' X-Ratelimit-Reset-Requests: - 120ms X-Ratelimit-Reset-Tokens: - - 112ms + - 92ms X-Request-Id: - "" Strict-Transport-Security: @@ -760,6 +618,6 @@ http_interactions: body: encoding: ASCII-8BIT string: !binary |- - ewogICJpZCI6ICJjaGF0Y21wbC1CaGFBbEFsOTFnRERZSWVXUjVPdENlQjI1Z3o2bCIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0OTcyNjg1MSwKICAibW9kZWwiOiAiZ3B0LTQuMS1uYW5vLTIwMjUtMDQtMTQiLAogICJjaG9pY2VzIjogWwogICAgewogICAgICAiaW5kZXgiOiAwLAogICAgICAibWVzc2FnZSI6IHsKICAgICAgICAicm9sZSI6ICJhc3Npc3RhbnQiLAogICAgICAgICJjb250ZW50IjogIlRoZSBjdXJyZW50IHdlYXRoZXIgaW4gQmVybGluIGlzIDE1wrBDIHdpdGggYSB3aW5kIHNwZWVkIG9mIDEwIGttL2guIiwKICAgICAgICAicmVmdXNhbCI6IG51bGwsCiAgICAgICAgImFubm90YXRpb25zIjogW10KICAgICAgfSwKICAgICAgImxvZ3Byb2JzIjogbnVsbCwKICAgICAgImZpbmlzaF9yZWFzb24iOiAic3RvcCIKICAgIH0KICBdLAogICJ1c2FnZSI6IHsKICAgICJwcm9tcHRfdG9rZW5zIjogNjk0LAogICAgImNvbXBsZXRpb25fdG9rZW5zIjogMjAsCiAgICAidG90YWxfdG9rZW5zIjogNzE0LAogICAgInByb21wdF90b2tlbnNfZGV0YWlscyI6IHsKICAgICAgImNhY2hlZF90b2tlbnMiOiAwLAogICAgICAiYXVkaW9fdG9rZW5zIjogMAogICAgfSwKICAgICJjb21wbGV0aW9uX3Rva2Vuc19kZXRhaWxzIjogewogICAgICAicmVhc29uaW5nX3Rva2VucyI6IDAsCiAgICAgICJhdWRpb190b2tlbnMiOiAwLAogICAgICAiYWNjZXB0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwLAogICAgICAicmVqZWN0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwCiAgICB9CiAgfSwKICAic2VydmljZV90aWVyIjogImRlZmF1bHQiLAogICJzeXN0ZW1fZmluZ2VycHJpbnQiOiAiZnBfMzgzNDNhMmY4ZiIKfQo= - recorded_at: Thu, 12 Jun 2025 11:14:11 GMT + ewogICJpZCI6ICJjaGF0Y21wbC1CaGJVRXU4MGI1UmNVVFk3RWhBZHdFTkR2V0FGcSIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0OTczMTkwMiwKICAibW9kZWwiOiAiZ3B0LTQuMS1uYW5vLTIwMjUtMDQtMTQiLAogICJjaG9pY2VzIjogWwogICAgewogICAgICAiaW5kZXgiOiAwLAogICAgICAibWVzc2FnZSI6IHsKICAgICAgICAicm9sZSI6ICJhc3Npc3RhbnQiLAogICAgICAgICJjb250ZW50IjogIlRoZSBjdXJyZW50IHdlYXRoZXIgaW4gQmVybGluIGlzIDE1wrBDIHdpdGggYSB3aW5kIHNwZWVkIG9mIDEwIGttL2guIiwKICAgICAgICAicmVmdXNhbCI6IG51bGwsCiAgICAgICAgImFubm90YXRpb25zIjogW10KICAgICAgfSwKICAgICAgImxvZ3Byb2JzIjogbnVsbCwKICAgICAgImZpbmlzaF9yZWFzb24iOiAic3RvcCIKICAgIH0KICBdLAogICJ1c2FnZSI6IHsKICAgICJwcm9tcHRfdG9rZW5zIjogNTc0LAogICAgImNvbXBsZXRpb25fdG9rZW5zIjogMjAsCiAgICAidG90YWxfdG9rZW5zIjogNTk0LAogICAgInByb21wdF90b2tlbnNfZGV0YWlscyI6IHsKICAgICAgImNhY2hlZF90b2tlbnMiOiAwLAogICAgICAiYXVkaW9fdG9rZW5zIjogMAogICAgfSwKICAgICJjb21wbGV0aW9uX3Rva2Vuc19kZXRhaWxzIjogewogICAgICAicmVhc29uaW5nX3Rva2VucyI6IDAsCiAgICAgICJhdWRpb190b2tlbnMiOiAwLAogICAgICAiYWNjZXB0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwLAogICAgICAicmVqZWN0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwCiAgICB9CiAgfSwKICAic2VydmljZV90aWVyIjogImRlZmF1bHQiLAogICJzeXN0ZW1fZmluZ2VycHJpbnQiOiAiZnBfMzgzNDNhMmY4ZiIKfQo= + recorded_at: Thu, 12 Jun 2025 12:38:23 GMT recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_completions_limit_using_context.yml b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml similarity index 62% rename from spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_completions_limit_using_context.yml rename to spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml index e25d8b4d..da2acab3 100644 --- a/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_completions_limit_using_context.yml +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml @@ -31,7 +31,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:16:15 GMT + - Thu, 12 Jun 2025 12:35:15 GMT Content-Type: - application/json Transfer-Encoding: @@ -43,11 +43,11 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '333' + - '371' Openai-Version: - '2020-10-01' X-Envoy-Upstream-Service-Time: - - '338' + - '377' X-Ratelimit-Limit-Requests: - '500' X-Ratelimit-Limit-Tokens: @@ -81,9 +81,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BhaClWCiivT9dD2l06ye92txJH3AD", + "id": "chatcmpl-BhbRCpcHQSBFX4QgIPtWWLcRlYjB2", "object": "chat.completion", - "created": 1749726975, + "created": 1749731714, "model": "gpt-4.1-nano-2025-04-14", "choices": [ { @@ -93,7 +93,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_LrJSdlzzVbnltmHnllLZTZ2r", + "id": "call_WutV7KZn9gIYJjtIUFz8f0Dg", "type": "function", "function": { "name": "looping_answer", @@ -126,7 +126,7 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_38343a2f8f" } - recorded_at: Thu, 12 Jun 2025 11:16:15 GMT + recorded_at: Thu, 12 Jun 2025 12:35:14 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions @@ -136,10 +136,10 @@ http_interactions: all of the posts from r/RandomNames. Fetch the next_page listed in the response until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_LrJSdlzzVbnltmHnllLZTZ2r","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 891adfe5f027228357af\", :score=>437}, {:title=>\"Topic 4cbb882b7224b9d73728\", - :score=>428}, {:title=>\"Topic 119eb548956d5dfb8a50\", :score=>93}], :next_page=>\"t3_abc123_552\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_LrJSdlzzVbnltmHnllLZTZ2r"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_WutV7KZn9gIYJjtIUFz8f0Dg","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 73b69113bd3669aa2644\", :score=>138}, {:title=>\"Topic 87825e54d3c37e294eb4\", + :score=>76}, {:title=>\"Topic 37608294857a5253617c\", :score=>596}], :next_page=>\"t3_abc123_488\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_WutV7KZn9gIYJjtIUFz8f0Dg"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -161,7 +161,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:16:16 GMT + - Thu, 12 Jun 2025 12:35:15 GMT Content-Type: - application/json Transfer-Encoding: @@ -173,11 +173,11 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '409' + - '321' Openai-Version: - '2020-10-01' X-Envoy-Upstream-Service-Time: - - '415' + - '329' X-Ratelimit-Limit-Requests: - '500' X-Ratelimit-Limit-Tokens: @@ -211,9 +211,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BhaCmICBmUJdKfxyKYXXUMJGgv1Fu", + "id": "chatcmpl-BhbRDDE3PFp8R0lqPoX5WRB60z3ZR", "object": "chat.completion", - "created": 1749726976, + "created": 1749731715, "model": "gpt-4.1-nano-2025-04-14", "choices": [ { @@ -223,7 +223,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_rHAK0L9HRNil78q9s2SKmffl", + "id": "call_JoFtAO1bD9bbrJjW6rRVcuLF", "type": "function", "function": { "name": "looping_answer", @@ -239,9 +239,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 266, + "prompt_tokens": 265, "completion_tokens": 11, - "total_tokens": 277, + "total_tokens": 276, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -256,7 +256,7 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_38343a2f8f" } - recorded_at: Thu, 12 Jun 2025 11:16:16 GMT + recorded_at: Thu, 12 Jun 2025 12:35:15 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions @@ -266,13 +266,13 @@ http_interactions: all of the posts from r/RandomNames. Fetch the next_page listed in the response until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_LrJSdlzzVbnltmHnllLZTZ2r","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 891adfe5f027228357af\", :score=>437}, {:title=>\"Topic 4cbb882b7224b9d73728\", - :score=>428}, {:title=>\"Topic 119eb548956d5dfb8a50\", :score=>93}], :next_page=>\"t3_abc123_552\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_LrJSdlzzVbnltmHnllLZTZ2r"},{"role":"assistant","tool_calls":[{"id":"call_rHAK0L9HRNil78q9s2SKmffl","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - dd3a240ceed3b4313294\", :score=>77}, {:title=>\"Topic 8bbcd5822e7446295df5\", - :score=>288}, {:title=>\"Topic 87c26d71be66c3dc15a8\", :score=>370}], :next_page=>\"t3_abc123_179\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_rHAK0L9HRNil78q9s2SKmffl"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_WutV7KZn9gIYJjtIUFz8f0Dg","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 73b69113bd3669aa2644\", :score=>138}, {:title=>\"Topic 87825e54d3c37e294eb4\", + :score=>76}, {:title=>\"Topic 37608294857a5253617c\", :score=>596}], :next_page=>\"t3_abc123_488\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_WutV7KZn9gIYJjtIUFz8f0Dg"},{"role":"assistant","tool_calls":[{"id":"call_JoFtAO1bD9bbrJjW6rRVcuLF","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + b72dd34488760cbe5ff3\", :score=>358}, {:title=>\"Topic effc6ab3fcc955c1fc71\", + :score=>332}, {:title=>\"Topic fcc377c7b820b2246485\", :score=>660}], :next_page=>\"t3_abc123_51\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_JoFtAO1bD9bbrJjW6rRVcuLF"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -294,7 +294,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:16:17 GMT + - Thu, 12 Jun 2025 12:35:16 GMT Content-Type: - application/json Transfer-Encoding: @@ -306,11 +306,11 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '445' + - '324' Openai-Version: - '2020-10-01' X-Envoy-Upstream-Service-Time: - - '458' + - '327' X-Ratelimit-Limit-Requests: - '500' X-Ratelimit-Limit-Tokens: @@ -344,9 +344,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BhaCnrGrqKbqB9snE37dAvvxPs1X1", + "id": "chatcmpl-BhbREQIg4LyjkUzxxelpVoNItDlDf", "object": "chat.completion", - "created": 1749726977, + "created": 1749731716, "model": "gpt-4.1-nano-2025-04-14", "choices": [ { @@ -356,7 +356,7 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_yTg7WzETrynxLmzdOpONIN6N", + "id": "call_VMnDdKxjV4jS9SBfM1VyiXuM", "type": "function", "function": { "name": "looping_answer", @@ -372,9 +372,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 382, + "prompt_tokens": 378, "completion_tokens": 11, - "total_tokens": 393, + "total_tokens": 389, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -389,7 +389,7 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_38343a2f8f" } - recorded_at: Thu, 12 Jun 2025 11:16:17 GMT + recorded_at: Thu, 12 Jun 2025 12:35:16 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions @@ -399,155 +399,16 @@ http_interactions: all of the posts from r/RandomNames. Fetch the next_page listed in the response until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_LrJSdlzzVbnltmHnllLZTZ2r","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 891adfe5f027228357af\", :score=>437}, {:title=>\"Topic 4cbb882b7224b9d73728\", - :score=>428}, {:title=>\"Topic 119eb548956d5dfb8a50\", :score=>93}], :next_page=>\"t3_abc123_552\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_LrJSdlzzVbnltmHnllLZTZ2r"},{"role":"assistant","tool_calls":[{"id":"call_rHAK0L9HRNil78q9s2SKmffl","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - dd3a240ceed3b4313294\", :score=>77}, {:title=>\"Topic 8bbcd5822e7446295df5\", - :score=>288}, {:title=>\"Topic 87c26d71be66c3dc15a8\", :score=>370}], :next_page=>\"t3_abc123_179\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_rHAK0L9HRNil78q9s2SKmffl"},{"role":"assistant","tool_calls":[{"id":"call_yTg7WzETrynxLmzdOpONIN6N","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 9c2a8743bb56050c8fad\", :score=>225}, {:title=>\"Topic 2258bbc0dde2d1224eb4\", - :score=>843}, {:title=>\"Topic 7dfeede2513675bff3ef\", :score=>120}], :next_page=>\"t3_abc123_999\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_yTg7WzETrynxLmzdOpONIN6N"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches - posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets - current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude - (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., - 13.4050)"}},"required":["latitude","longitude"]}}}],"tool_choice":"auto"}' - headers: - User-Agent: - - Faraday v2.12.2 - Authorization: - - Bearer - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 12 Jun 2025 11:16:18 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Access-Control-Expose-Headers: - - X-Request-ID - Openai-Organization: - - "" - Openai-Processing-Ms: - - '811' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '815' - X-Ratelimit-Limit-Requests: - - '500' - X-Ratelimit-Limit-Tokens: - - '200000' - X-Ratelimit-Remaining-Requests: - - '499' - X-Ratelimit-Remaining-Tokens: - - '199721' - X-Ratelimit-Reset-Requests: - - 120ms - X-Ratelimit-Reset-Tokens: - - 83ms - X-Request-Id: - - "" - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Cf-Cache-Status: - - DYNAMIC - Set-Cookie: - - "" - - "" - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - "" - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: ASCII-8BIT - string: | - { - "id": "chatcmpl-BhaCosGM8E1v1Sifcm7MuS277qxyY", - "object": "chat.completion", - "created": 1749726978, - "model": "gpt-4.1-nano-2025-04-14", - "choices": [ - { - "index": 0, - "message": { - "role": "assistant", - "content": null, - "tool_calls": [ - { - "id": "call_y7zNG6Alwvbt9GqqVTcJBArI", - "type": "function", - "function": { - "name": "looping_answer", - "arguments": "{}" - } - } - ], - "refusal": null, - "annotations": [] - }, - "logprobs": null, - "finish_reason": "tool_calls" - } - ], - "usage": { - "prompt_tokens": 499, - "completion_tokens": 11, - "total_tokens": 510, - "prompt_tokens_details": { - "cached_tokens": 0, - "audio_tokens": 0 - }, - "completion_tokens_details": { - "reasoning_tokens": 0, - "audio_tokens": 0, - "accepted_prediction_tokens": 0, - "rejected_prediction_tokens": 0 - } - }, - "service_tier": "default", - "system_fingerprint": "fp_38343a2f8f" - } - recorded_at: Thu, 12 Jun 2025 11:16:18 GMT -- request: - method: post - uri: https://api.openai.com/v1/chat/completions - body: - encoding: UTF-8 - string: '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Fetch - all of the posts from r/RandomNames. Fetch the next_page listed in the response - until it responds with an empty array do not ask to continue fetching the - subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_LrJSdlzzVbnltmHnllLZTZ2r","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 891adfe5f027228357af\", :score=>437}, {:title=>\"Topic 4cbb882b7224b9d73728\", - :score=>428}, {:title=>\"Topic 119eb548956d5dfb8a50\", :score=>93}], :next_page=>\"t3_abc123_552\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_LrJSdlzzVbnltmHnllLZTZ2r"},{"role":"assistant","tool_calls":[{"id":"call_rHAK0L9HRNil78q9s2SKmffl","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - dd3a240ceed3b4313294\", :score=>77}, {:title=>\"Topic 8bbcd5822e7446295df5\", - :score=>288}, {:title=>\"Topic 87c26d71be66c3dc15a8\", :score=>370}], :next_page=>\"t3_abc123_179\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_rHAK0L9HRNil78q9s2SKmffl"},{"role":"assistant","tool_calls":[{"id":"call_yTg7WzETrynxLmzdOpONIN6N","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 9c2a8743bb56050c8fad\", :score=>225}, {:title=>\"Topic 2258bbc0dde2d1224eb4\", - :score=>843}, {:title=>\"Topic 7dfeede2513675bff3ef\", :score=>120}], :next_page=>\"t3_abc123_999\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_yTg7WzETrynxLmzdOpONIN6N"},{"role":"assistant","tool_calls":[{"id":"call_y7zNG6Alwvbt9GqqVTcJBArI","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - aa4bebabf923fd00f446\", :score=>574}, {:title=>\"Topic 05bb3f0e5085a195cff4\", - :score=>438}, {:title=>\"Topic fc7cca6fbd7bcaa35deb\", :score=>823}], :next_page=>\"t3_abc123_281\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_y7zNG6Alwvbt9GqqVTcJBArI"},{"role":"user","content":"What''s + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_WutV7KZn9gIYJjtIUFz8f0Dg","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 73b69113bd3669aa2644\", :score=>138}, {:title=>\"Topic 87825e54d3c37e294eb4\", + :score=>76}, {:title=>\"Topic 37608294857a5253617c\", :score=>596}], :next_page=>\"t3_abc123_488\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_WutV7KZn9gIYJjtIUFz8f0Dg"},{"role":"assistant","tool_calls":[{"id":"call_JoFtAO1bD9bbrJjW6rRVcuLF","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + b72dd34488760cbe5ff3\", :score=>358}, {:title=>\"Topic effc6ab3fcc955c1fc71\", + :score=>332}, {:title=>\"Topic fcc377c7b820b2246485\", :score=>660}], :next_page=>\"t3_abc123_51\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_JoFtAO1bD9bbrJjW6rRVcuLF"},{"role":"assistant","tool_calls":[{"id":"call_VMnDdKxjV4jS9SBfM1VyiXuM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 14ca912a4f5e61cc3ddf\", :score=>916}, {:title=>\"Topic b91a955601e76b5aacc1\", + :score=>54}, {:title=>\"Topic 6e1576a652c7fcb65a5e\", :score=>794}], :next_page=>\"t3_abc123_213\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_VMnDdKxjV4jS9SBfM1VyiXuM"},{"role":"user","content":"What''s the weather in Berlin? (52.5200, 13.4050)"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude @@ -570,7 +431,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:16:19 GMT + - Thu, 12 Jun 2025 12:35:18 GMT Content-Type: - application/json Transfer-Encoding: @@ -582,11 +443,11 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '376' + - '1152' Openai-Version: - '2020-10-01' X-Envoy-Upstream-Service-Time: - - '381' + - '1184' X-Ratelimit-Limit-Requests: - '500' X-Ratelimit-Limit-Tokens: @@ -594,11 +455,11 @@ http_interactions: X-Ratelimit-Remaining-Requests: - '499' X-Ratelimit-Remaining-Tokens: - - '199640' + - '199707' X-Ratelimit-Reset-Requests: - 120ms X-Ratelimit-Reset-Tokens: - - 108ms + - 87ms X-Request-Id: - "" Strict-Transport-Security: @@ -620,9 +481,9 @@ http_interactions: encoding: ASCII-8BIT string: | { - "id": "chatcmpl-BhaCpUtoqEX80IuepfwcEjbE7cwoc", + "id": "chatcmpl-BhbREhrSdGzLaDCeSudhn33WT0bFP", "object": "chat.completion", - "created": 1749726979, + "created": 1749731716, "model": "gpt-4.1-nano-2025-04-14", "choices": [ { @@ -632,11 +493,11 @@ http_interactions: "content": null, "tool_calls": [ { - "id": "call_l2sQv7QaVvAHRE5gYbDxtlsD", + "id": "call_linuJjfFN5DDwwz12omaKEZd", "type": "function", "function": { "name": "weather", - "arguments": "{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}" + "arguments": "{\"latitude\": \"52.5200\", \"longitude\": \"13.4050\"}" } } ], @@ -648,9 +509,9 @@ http_interactions: } ], "usage": { - "prompt_tokens": 635, - "completion_tokens": 23, - "total_tokens": 658, + "prompt_tokens": 521, + "completion_tokens": 40, + "total_tokens": 561, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -665,7 +526,7 @@ http_interactions: "service_tier": "default", "system_fingerprint": "fp_38343a2f8f" } - recorded_at: Thu, 12 Jun 2025 11:16:19 GMT + recorded_at: Thu, 12 Jun 2025 12:35:17 GMT - request: method: post uri: https://api.openai.com/v1/chat/completions @@ -675,21 +536,18 @@ http_interactions: all of the posts from r/RandomNames. Fetch the next_page listed in the response until it responds with an empty array do not ask to continue fetching the subsequent pages until the last page is reached.If you are going to ask to - continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_LrJSdlzzVbnltmHnllLZTZ2r","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 891adfe5f027228357af\", :score=>437}, {:title=>\"Topic 4cbb882b7224b9d73728\", - :score=>428}, {:title=>\"Topic 119eb548956d5dfb8a50\", :score=>93}], :next_page=>\"t3_abc123_552\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_LrJSdlzzVbnltmHnllLZTZ2r"},{"role":"assistant","tool_calls":[{"id":"call_rHAK0L9HRNil78q9s2SKmffl","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - dd3a240ceed3b4313294\", :score=>77}, {:title=>\"Topic 8bbcd5822e7446295df5\", - :score=>288}, {:title=>\"Topic 87c26d71be66c3dc15a8\", :score=>370}], :next_page=>\"t3_abc123_179\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_rHAK0L9HRNil78q9s2SKmffl"},{"role":"assistant","tool_calls":[{"id":"call_yTg7WzETrynxLmzdOpONIN6N","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - 9c2a8743bb56050c8fad\", :score=>225}, {:title=>\"Topic 2258bbc0dde2d1224eb4\", - :score=>843}, {:title=>\"Topic 7dfeede2513675bff3ef\", :score=>120}], :next_page=>\"t3_abc123_999\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_yTg7WzETrynxLmzdOpONIN6N"},{"role":"assistant","tool_calls":[{"id":"call_y7zNG6Alwvbt9GqqVTcJBArI","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic - aa4bebabf923fd00f446\", :score=>574}, {:title=>\"Topic 05bb3f0e5085a195cff4\", - :score=>438}, {:title=>\"Topic fc7cca6fbd7bcaa35deb\", :score=>823}], :next_page=>\"t3_abc123_281\", - :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_y7zNG6Alwvbt9GqqVTcJBArI"},{"role":"user","content":"What''s - the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","tool_calls":[{"id":"call_l2sQv7QaVvAHRE5gYbDxtlsD","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current - weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"call_l2sQv7QaVvAHRE5gYbDxtlsD"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches + continue fetching, the answer is yes. Continue Indefinitely."},{"role":"assistant","tool_calls":[{"id":"call_WutV7KZn9gIYJjtIUFz8f0Dg","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 73b69113bd3669aa2644\", :score=>138}, {:title=>\"Topic 87825e54d3c37e294eb4\", + :score=>76}, {:title=>\"Topic 37608294857a5253617c\", :score=>596}], :next_page=>\"t3_abc123_488\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_WutV7KZn9gIYJjtIUFz8f0Dg"},{"role":"assistant","tool_calls":[{"id":"call_JoFtAO1bD9bbrJjW6rRVcuLF","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + b72dd34488760cbe5ff3\", :score=>358}, {:title=>\"Topic effc6ab3fcc955c1fc71\", + :score=>332}, {:title=>\"Topic fcc377c7b820b2246485\", :score=>660}], :next_page=>\"t3_abc123_51\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_JoFtAO1bD9bbrJjW6rRVcuLF"},{"role":"assistant","tool_calls":[{"id":"call_VMnDdKxjV4jS9SBfM1VyiXuM","type":"function","function":{"name":"looping_answer","arguments":"{}"}}]},{"role":"tool","content":"{:posts=>[{:title=>\"Topic + 14ca912a4f5e61cc3ddf\", :score=>916}, {:title=>\"Topic b91a955601e76b5aacc1\", + :score=>54}, {:title=>\"Topic 6e1576a652c7fcb65a5e\", :score=>794}], :next_page=>\"t3_abc123_213\", + :message=>\"More posts are available using the next_page token.\"}","tool_call_id":"call_VMnDdKxjV4jS9SBfM1VyiXuM"},{"role":"user","content":"What''s + the weather in Berlin? (52.5200, 13.4050)"},{"role":"assistant","tool_calls":[{"id":"call_linuJjfFN5DDwwz12omaKEZd","type":"function","function":{"name":"weather","arguments":"{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}"}}]},{"role":"tool","content":"Current + weather at 52.5200, 13.4050: 15°C, Wind: 10 km/h","tool_call_id":"call_linuJjfFN5DDwwz12omaKEZd"}],"stream":false,"temperature":0.7,"tools":[{"type":"function","function":{"name":"looping_answer","description":"Fetches posts from the r/RandomNames Reddit community.","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"weather","description":"Gets current weather for a location","parameters":{"type":"object","properties":{"latitude":{"type":"string","description":"Latitude (e.g., 52.5200)"},"longitude":{"type":"string","description":"Longitude (e.g., @@ -711,7 +569,7 @@ http_interactions: message: OK headers: Date: - - Thu, 12 Jun 2025 11:16:21 GMT + - Thu, 12 Jun 2025 12:35:18 GMT Content-Type: - application/json Transfer-Encoding: @@ -723,11 +581,11 @@ http_interactions: Openai-Organization: - "" Openai-Processing-Ms: - - '780' + - '381' Openai-Version: - '2020-10-01' X-Envoy-Upstream-Service-Time: - - '801' + - '385' X-Ratelimit-Limit-Requests: - '500' X-Ratelimit-Limit-Tokens: @@ -735,11 +593,11 @@ http_interactions: X-Ratelimit-Remaining-Requests: - '499' X-Ratelimit-Remaining-Tokens: - - '199623' + - '199691' X-Ratelimit-Reset-Requests: - 120ms X-Ratelimit-Reset-Tokens: - - 112ms + - 92ms X-Request-Id: - "" Strict-Transport-Security: @@ -760,6 +618,6 @@ http_interactions: body: encoding: ASCII-8BIT string: !binary |- - ewogICJpZCI6ICJjaGF0Y21wbC1CaGFDcWpDTHI1eFpjNjVrQ3AzcXcyRXF5em5TNSIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0OTcyNjk4MCwKICAibW9kZWwiOiAiZ3B0LTQuMS1uYW5vLTIwMjUtMDQtMTQiLAogICJjaG9pY2VzIjogWwogICAgewogICAgICAiaW5kZXgiOiAwLAogICAgICAibWVzc2FnZSI6IHsKICAgICAgICAicm9sZSI6ICJhc3Npc3RhbnQiLAogICAgICAgICJjb250ZW50IjogIlRoZSBjdXJyZW50IHdlYXRoZXIgaW4gQmVybGluIGlzIDE1wrBDIHdpdGggYSB3aW5kIHNwZWVkIG9mIDEwIGttL2guIiwKICAgICAgICAicmVmdXNhbCI6IG51bGwsCiAgICAgICAgImFubm90YXRpb25zIjogW10KICAgICAgfSwKICAgICAgImxvZ3Byb2JzIjogbnVsbCwKICAgICAgImZpbmlzaF9yZWFzb24iOiAic3RvcCIKICAgIH0KICBdLAogICJ1c2FnZSI6IHsKICAgICJwcm9tcHRfdG9rZW5zIjogNjkwLAogICAgImNvbXBsZXRpb25fdG9rZW5zIjogMjAsCiAgICAidG90YWxfdG9rZW5zIjogNzEwLAogICAgInByb21wdF90b2tlbnNfZGV0YWlscyI6IHsKICAgICAgImNhY2hlZF90b2tlbnMiOiAwLAogICAgICAiYXVkaW9fdG9rZW5zIjogMAogICAgfSwKICAgICJjb21wbGV0aW9uX3Rva2Vuc19kZXRhaWxzIjogewogICAgICAicmVhc29uaW5nX3Rva2VucyI6IDAsCiAgICAgICJhdWRpb190b2tlbnMiOiAwLAogICAgICAiYWNjZXB0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwLAogICAgICAicmVqZWN0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwCiAgICB9CiAgfSwKICAic2VydmljZV90aWVyIjogImRlZmF1bHQiLAogICJzeXN0ZW1fZmluZ2VycHJpbnQiOiAiZnBfZjEyMTY3YjM3MCIKfQo= - recorded_at: Thu, 12 Jun 2025 11:16:21 GMT + ewogICJpZCI6ICJjaGF0Y21wbC1CaGJSR1VnUmdzZ1RVTVB3MXI0TzdENVNOVmlXYyIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0OTczMTcxOCwKICAibW9kZWwiOiAiZ3B0LTQuMS1uYW5vLTIwMjUtMDQtMTQiLAogICJjaG9pY2VzIjogWwogICAgewogICAgICAiaW5kZXgiOiAwLAogICAgICAibWVzc2FnZSI6IHsKICAgICAgICAicm9sZSI6ICJhc3Npc3RhbnQiLAogICAgICAgICJjb250ZW50IjogIlRoZSBjdXJyZW50IHdlYXRoZXIgaW4gQmVybGluIGlzIDE1wrBDIHdpdGggYSB3aW5kIHNwZWVkIG9mIDEwIGttL2guIiwKICAgICAgICAicmVmdXNhbCI6IG51bGwsCiAgICAgICAgImFubm90YXRpb25zIjogW10KICAgICAgfSwKICAgICAgImxvZ3Byb2JzIjogbnVsbCwKICAgICAgImZpbmlzaF9yZWFzb24iOiAic3RvcCIKICAgIH0KICBdLAogICJ1c2FnZSI6IHsKICAgICJwcm9tcHRfdG9rZW5zIjogNTc2LAogICAgImNvbXBsZXRpb25fdG9rZW5zIjogMjAsCiAgICAidG90YWxfdG9rZW5zIjogNTk2LAogICAgInByb21wdF90b2tlbnNfZGV0YWlscyI6IHsKICAgICAgImNhY2hlZF90b2tlbnMiOiAwLAogICAgICAiYXVkaW9fdG9rZW5zIjogMAogICAgfSwKICAgICJjb21wbGV0aW9uX3Rva2Vuc19kZXRhaWxzIjogewogICAgICAicmVhc29uaW5nX3Rva2VucyI6IDAsCiAgICAgICJhdWRpb190b2tlbnMiOiAwLAogICAgICAiYWNjZXB0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwLAogICAgICAicmVqZWN0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwCiAgICB9CiAgfSwKICAic2VydmljZV90aWVyIjogImRlZmF1bHQiLAogICJzeXN0ZW1fZmluZ2VycHJpbnQiOiAiZnBfMzgzNDNhMmY4ZiIKfQo= + recorded_at: Thu, 12 Jun 2025 12:35:18 GMT recorded_with: VCR 6.3.1 From 397438e096358bbca8ad28c3a3fb9aa31b4ec5e7 Mon Sep 17 00:00:00 2001 From: Rhys Murray Date: Thu, 12 Jun 2025 22:46:20 +1000 Subject: [PATCH 26/26] docs: improve tool docs for max tool llm calls --- docs/guides/tools.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/guides/tools.md b/docs/guides/tools.md index b0600835..b473fd4a 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -210,16 +210,19 @@ becoming invalid if you wish to continue the conversation after the error. This can be performed on a per chat basis using `RubyLLM.context` (see configuration documentation) or provided in the global configuration. ```ruby -# Set a maximum number of tool completions per instantiated chat object -context = RubyLLM.context do { |ctx| ctx.max_tool_llm_calls = 5 } -chat = RubyLLM.chat.with_context(context) +RubyLLM.configure do |config| + config.max_tool_llm_calls = 5 +end chat.ask "Question that triggers tools loop" -# => `execute_tool': Tool completions limit reached: 5 (RubyLLM::ToolCallCompletionsReachedError) +# => `execute_tool': Tool LLM calls limit reached: (RubyLLM::ToolCallLimitReachedError) ``` If you wish to remove this safe-guard you can set the max_tool_llm_calls to `nil`. ```ruby -chat = RubyLLM.chat.with_max_tool_llm_calls(nil) +RubyLLM.configure do |config| + config.max_tool_llm_calls = nil # No limit +end +chat = RubyLLM.chat chat.ask "Question that triggers tools loop" # Loops until you've used all your credit... ``` @@ -239,7 +242,8 @@ This setting can still be overridden per-chat when needed: ```ruby # Override the global setting for this specific chat -chat = RubyLLM.chat.with_max_tool_llm_calls(5) +context = RubyLLM.context { |ctx| ctx.max_tool_llm_calls = 5 } +chat = RubyLLM.chat.with_context(context) ``` ## Security Considerations