diff --git a/docs/guides/tools.md b/docs/guides/tools.md index c9fb9a0c..b473fd4a 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -200,6 +200,52 @@ 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 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. + +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 +RubyLLM.configure do |config| + config.max_tool_llm_calls = 5 +end +chat.ask "Question that triggers tools loop" +# => `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 +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... +``` + +### Global Configuration + +You can set a default maximum tool completion limit for all chats through the global configuration: + +```ruby +RubyLLM.configure do |config| + # Default is 25 calls per conversation + config.max_tool_llm_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 +context = RubyLLM.context { |ctx| ctx.max_tool_llm_calls = 5 } +chat = RubyLLM.chat.with_context(context) +``` + ## Security Considerations {: .warning } @@ -208,6 +254,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 calls if you remove the default limit. ## Next Steps diff --git a/lib/ruby_llm/chat.rb b/lib/ruby_llm/chat.rb index 3b5bfa83..6c69ee91 100644 --- a/lib/ruby_llm/chat.rb +++ b/lib/ruby_llm/chat.rb @@ -29,9 +29,13 @@ def initialize(model: nil, provider: nil, assume_model_exists: false, context: n new_message: nil, end_message: nil } + @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_llm_calls = 0 + add_message role: :user, content: Content.new(message, with) complete(&) end @@ -73,7 +77,10 @@ def with_temperature(temperature) def with_context(context) @context = context - @config = context.config + if context.config + @config = context.config + @max_tool_llm_calls = @config.max_tool_llm_calls + end with_model(@model.id, provider: @provider.slug, assume_exists: true) self end @@ -125,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 @@ -132,6 +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 + complete(&) end @@ -148,5 +162,11 @@ def add_tool_result(tool_use_id, result) tool_call_id: tool_use_id ) end + + def max_tool_llm_calls_reached? + return false unless @max_tool_llm_calls + + @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 0fd3bf23..952f7553 100644 --- a/lib/ruby_llm/configuration.rb +++ b/lib/ruby_llm/configuration.rb @@ -24,6 +24,8 @@ class Configuration :bedrock_session_token, :openrouter_api_key, :ollama_api_base, + # Default tool configuration + :max_tool_llm_calls, # Default models :default_model, :default_embedding_model, @@ -54,6 +56,9 @@ def initialize @default_embedding_model = 'text-embedding-3-small' @default_image_model = 'dall-e-3' + # Default restrictions + @max_tool_llm_calls = 25 + # Logging configuration @log_file = $stdout @log_level = ENV['RUBYLLM_DEBUG'] ? Logger::DEBUG : Logger::INFO diff --git a/lib/ruby_llm/error.rb b/lib/ruby_llm/error.rb index 228053a5..33651777 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 ToolCallLimitReachedError < StandardError; end class UnsupportedAttachmentError < StandardError; end # Error classes for different HTTP status codes 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..4120a365 --- /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,347 @@ +--- +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:36:37 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-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 + 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_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., + 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:36:41 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-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 + 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_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., + 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:36:44 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-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 + 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_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 + (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:36:48 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-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 + 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_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 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., + 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:36:51 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 |- + 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_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_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_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..3315a0fd --- /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,473 @@ +--- +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 12:36:23 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-12T12:36:22Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T12:36:23Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T12:36:21Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T12:36:22Z' + 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_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 + 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 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 + (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 12:36:25 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-12T12:36:25Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T12:36:25Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T12:36:24Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T12:36:25Z' + 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_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 + 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 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 + (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 12:36:28 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-12T12:36:28Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T12:36:28Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T12:36:27Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T12:36:28Z' + 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_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 + 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 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:"},{"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., + 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 12:36:31 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-12T12:36:30Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T12:36:31Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T12:36:29Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T12:36:30Z' + 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_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 + 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 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:"},{"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 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 + (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 12:36:33 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-12T12:36:33Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T12:36:33Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T12:36:32Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '59000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T12:36:33Z' + 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 |- + 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.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..ece0c6df --- /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,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: + - Mon, 07 Apr 2025 11:50:04 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:03Z' + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-07T11:50:03Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-07T11:50:04Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-07T11:50:03Z' + 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_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":"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"]}}]}' + 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:07 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:06Z' + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-07T11:50:06Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-07T11:50:07Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-07T11:50:06Z' + 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_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":"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"]}}]}' + 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:08 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:08Z' + Anthropic-Ratelimit-Input-Tokens-Limit: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Remaining: + - '50000' + Anthropic-Ratelimit-Input-Tokens-Reset: + - '2025-04-07T11:50:08Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-04-07T11:50:08Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-04-07T11:50:08Z' + 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_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":"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"]}}]}' + 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:09 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: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-07T11:50:11Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '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-07T11:50: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: !binary |- + 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_claude-3-5-haiku-20241022_can_use_tools_with_a_tool_llm_calls_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 new file mode 100644 index 00000000..61c86542 --- /dev/null +++ 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 @@ -0,0 +1,473 @@ +--- +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 12:36:05 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-12T12:36:04Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T12:36:05Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T12:36:03Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T12:36:04Z' + 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_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 + 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 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 + (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 12:36:08 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-12T12:36:07Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T12:36:08Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T12:36:06Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T12:36:07Z' + 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_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 + 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 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_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 + (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 12:36:10 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-12T12:36:09Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T12:36:10Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T12:36:09Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T12:36:09Z' + 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_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 + 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 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_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_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 + 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 12:36:13 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-12T12:36:12Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T12:36:13Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T12:36:11Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '60000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T12:36:12Z' + 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_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 + 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 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_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_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 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 + (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 12:36:15 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-12T12:36:15Z' + Anthropic-Ratelimit-Output-Tokens-Limit: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Remaining: + - '10000' + Anthropic-Ratelimit-Output-Tokens-Reset: + - '2025-06-12T12:36:15Z' + Anthropic-Ratelimit-Requests-Limit: + - '50' + Anthropic-Ratelimit-Requests-Remaining: + - '49' + Anthropic-Ratelimit-Requests-Reset: + - '2025-06-12T12:36:14Z' + Anthropic-Ratelimit-Tokens-Limit: + - '60000' + Anthropic-Ratelimit-Tokens-Remaining: + - '59000' + Anthropic-Ratelimit-Tokens-Reset: + - '2025-06-12T12:36:15Z' + 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 |- + 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_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 new file mode 100644 index 00000000..fa8f2af8 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_configured_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 12:10:06 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '473' + 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-BPpgzCYjBgXUbsZXET0lKeFenvjLG", + "object": "chat.completion", + "created": 1745496605, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_iARhGzusOhmEcNQugV7JTGSB", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_oXlLzIpxHahjlnNrxGcC1I3p", + "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 12:10:06 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_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., + 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 12:10:07 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '899' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199851' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 44ms + 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-BPph0v9BBQHFF7YMKMx7ykWazGEN2", + "object": "chat.completion", + "created": 1745496606, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_LAO3pFk25C7hl69JlTCRGPhi", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_mb2F7VaGnluAWBqYRrkpyvFQ", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 317, + "completion_tokens": 42, + "total_tokens": 359, + "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 12:10: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"},{"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., + 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 12:10:09 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '1309' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199733' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 80ms + 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-BPph2m5rdp0ywjqtaaSoAKl92BSkh", + "object": "chat.completion", + "created": 1745496608, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_khi5QnW0YeTby4CvDmpQIB8P", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_Ec7bc3HczHltwTN6L2g292U0", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 523, + "completion_tokens": 42, + "total_tokens": 565, + "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 12:10: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"},{"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., + 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 12:10:10 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '432' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199620' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 114ms + 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-BPph3UoK72hHmTwzQCRQr98GClRKJ", + "object": "chat.completion", + "created": 1745496609, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_PicL6zj98mGQJefPtyw4yUwy", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_1IfRSvwuy5WwD3a4k0BP8tNQ", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 725, + "completion_tokens": 42, + "total_tokens": 767, + "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 12:10: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"},{"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., + 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 12:10:10 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '493' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199503' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 148ms + 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-BPph4pBgaIQ6GNWAMZZrAFd8osA98", + "object": "chat.completion", + "created": 1745496610, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_0rnA4WJVpv8uddjL5VUvF4PV", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_kxD1dJUdlGedwrDPUjRiUcdj", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 931, + "completion_tokens": 42, + "total_tokens": 973, + "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 12:10:11 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_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., + 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 12:10:11 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '512' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199388' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 183ms + 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-BPph5pIgT4QLsDkatOWsmg0MLcUKy", + "object": "chat.completion", + "created": 1745496611, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_iZkAio8U8tRHZomLAFFDuNIV", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + }, + { + "id": "call_Tmf0sooEevILL1QzITsxmmqd", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 1133, + "completion_tokens": 42, + "total_tokens": 1175, + "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 12:10:11 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_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 + (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 12:10:12 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '603' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199258' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 222ms + 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-BPph6G7SnVyXbBbREGM0CiT9ysYue", + "object": "chat.completion", + "created": 1745496612, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_vQVi7SowdPFzXp5HCPhNbKvO", + "type": "function", + "function": { + "name": "weather", + "arguments": "{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 1355, + "completion_tokens": 24, + "total_tokens": 1379, + "prompt_tokens_details": { + "cached_tokens": 1024, + "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 12:10:12 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_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., + 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 12:10:13 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '480' + Openai-Version: + - '2020-10-01' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199242' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 227ms + 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 |- + 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_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..693b5e46 --- /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,623 @@ +--- +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 12:38:19 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '178' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '182' + 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-BhbUAuSjKv2sgEhvdN9lM53MIt0SZ", + "object": "chat.completion", + "created": 1749731898, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_rAwws28MoEmbC7oWgAHxJo30", + "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 12:38: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_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., + 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:38:19 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '352' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '356' + 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-BhbUBQ30rQV7Wv52qZ0JkJxhPUPcD", + "object": "chat.completion", + "created": 1749731899, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_Goyg8rljfkkQpcUKzikzHyz9", + "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 12:38: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_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., + 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:38:20 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '262' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '267' + 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-BhbUC1uxwd8IPC1ELAcYl2bECokpj", + "object": "chat.completion", + "created": 1749731900, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_FdzUE0ZItsQI2L0qZXzw23dK", + "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 12:38:20 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_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 + (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:38:21 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '404' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '407' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199707' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 87ms + 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-BhbUD7zAwTbSHLedE5PdWXPUdcHhW", + "object": "chat.completion", + "created": 1749731901, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_yYV51yJ3dDZLY3LeoRzRNus2", + "type": "function", + "function": { + "name": "weather", + "arguments": "{\"latitude\":\"52.5200\",\"longitude\":\"13.4050\"}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 519, + "completion_tokens": 23, + "total_tokens": 542, + "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 12:38:21 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_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., + 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:38:23 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '775' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '784' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199692' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 92ms + 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 |- + 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.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/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_llm_calls_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 new file mode 100644 index 00000000..da2acab3 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/chat_function_calling_gpt-4_1-nano_can_use_tools_with_a_tool_llm_calls_limit_using_context.yml @@ -0,0 +1,623 @@ +--- +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 12:35:15 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '371' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '377' + 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-BhbRCpcHQSBFX4QgIPtWWLcRlYjB2", + "object": "chat.completion", + "created": 1749731714, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_WutV7KZn9gIYJjtIUFz8f0Dg", + "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 12:35:14 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_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., + 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:15 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '321' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '329' + 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-BhbRDDE3PFp8R0lqPoX5WRB60z3ZR", + "object": "chat.completion", + "created": 1749731715, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_JoFtAO1bD9bbrJjW6rRVcuLF", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 265, + "completion_tokens": 11, + "total_tokens": 276, + "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 12:35: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_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., + 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:16 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '324' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '327' + 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-BhbREQIg4LyjkUzxxelpVoNItDlDf", + "object": "chat.completion", + "created": 1749731716, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_VMnDdKxjV4jS9SBfM1VyiXuM", + "type": "function", + "function": { + "name": "looping_answer", + "arguments": "{}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 378, + "completion_tokens": 11, + "total_tokens": 389, + "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 12:35: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_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 + (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:18 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '1152' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '1184' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199707' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 87ms + 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-BhbREhrSdGzLaDCeSudhn33WT0bFP", + "object": "chat.completion", + "created": 1749731716, + "model": "gpt-4.1-nano-2025-04-14", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_linuJjfFN5DDwwz12omaKEZd", + "type": "function", + "function": { + "name": "weather", + "arguments": "{\"latitude\": \"52.5200\", \"longitude\": \"13.4050\"}" + } + } + ], + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 521, + "completion_tokens": 40, + "total_tokens": 561, + "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 12:35: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_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., + 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:18 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Access-Control-Expose-Headers: + - X-Request-ID + Openai-Organization: + - "" + Openai-Processing-Ms: + - '381' + Openai-Version: + - '2020-10-01' + X-Envoy-Upstream-Service-Time: + - '385' + X-Ratelimit-Limit-Requests: + - '500' + X-Ratelimit-Limit-Tokens: + - '200000' + X-Ratelimit-Remaining-Requests: + - '499' + X-Ratelimit-Remaining-Tokens: + - '199691' + X-Ratelimit-Reset-Requests: + - 120ms + X-Ratelimit-Reset-Tokens: + - 92ms + 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 |- + ewogICJpZCI6ICJjaGF0Y21wbC1CaGJSR1VnUmdzZ1RVTVB3MXI0TzdENVNOVmlXYyIsCiAgIm9iamVjdCI6ICJjaGF0LmNvbXBsZXRpb24iLAogICJjcmVhdGVkIjogMTc0OTczMTcxOCwKICAibW9kZWwiOiAiZ3B0LTQuMS1uYW5vLTIwMjUtMDQtMTQiLAogICJjaG9pY2VzIjogWwogICAgewogICAgICAiaW5kZXgiOiAwLAogICAgICAibWVzc2FnZSI6IHsKICAgICAgICAicm9sZSI6ICJhc3Npc3RhbnQiLAogICAgICAgICJjb250ZW50IjogIlRoZSBjdXJyZW50IHdlYXRoZXIgaW4gQmVybGluIGlzIDE1wrBDIHdpdGggYSB3aW5kIHNwZWVkIG9mIDEwIGttL2guIiwKICAgICAgICAicmVmdXNhbCI6IG51bGwsCiAgICAgICAgImFubm90YXRpb25zIjogW10KICAgICAgfSwKICAgICAgImxvZ3Byb2JzIjogbnVsbCwKICAgICAgImZpbmlzaF9yZWFzb24iOiAic3RvcCIKICAgIH0KICBdLAogICJ1c2FnZSI6IHsKICAgICJwcm9tcHRfdG9rZW5zIjogNTc2LAogICAgImNvbXBsZXRpb25fdG9rZW5zIjogMjAsCiAgICAidG90YWxfdG9rZW5zIjogNTk2LAogICAgInByb21wdF90b2tlbnNfZGV0YWlscyI6IHsKICAgICAgImNhY2hlZF90b2tlbnMiOiAwLAogICAgICAiYXVkaW9fdG9rZW5zIjogMAogICAgfSwKICAgICJjb21wbGV0aW9uX3Rva2Vuc19kZXRhaWxzIjogewogICAgICAicmVhc29uaW5nX3Rva2VucyI6IDAsCiAgICAgICJhdWRpb190b2tlbnMiOiAwLAogICAgICAiYWNjZXB0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwLAogICAgICAicmVqZWN0ZWRfcHJlZGljdGlvbl90b2tlbnMiOiAwCiAgICB9CiAgfSwKICAic2VydmljZV90aWVyIjogImRlZmF1bHQiLAogICJzeXN0ZW1fZmluZ2VycHJpbnQiOiAiZnBfMzgzNDNhMmY4ZiIKfQo= + recorded_at: Thu, 12 Jun 2025 12:35:18 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 1d4c0aed..fecaa17c 100644 --- a/spec/ruby_llm/chat_tools_spec.rb +++ b/spec/ruby_llm/chat_tools_spec.rb @@ -23,6 +23,27 @@ def execute end end + 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: 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.' + } + end + end + class BrokenTool < RubyLLM::Tool # rubocop:disable Lint/ConstantDefinitionInBlock,RSpec/LeakyConstantDeclaration description 'Gets current weather' @@ -128,6 +149,52 @@ def execute expect(response.content).to include('15') expect(response.content).to include('10') end + + 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 = 3 + 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 ' \ + '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) + + # 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 llm calls limit using context" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations + context = RubyLLM.context do |ctx| + ctx.max_tool_llm_calls = 3 + end + chat = RubyLLM.chat(model: model) + .with_context(context) + .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 ' \ + '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) + + # 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