-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhttp_client.rb
More file actions
executable file
·30 lines (22 loc) · 857 Bytes
/
Copy pathhttp_client.rb
File metadata and controls
executable file
·30 lines (22 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env ruby
# frozen_string_literal: true
require_relative "../lib/recurgent"
MODEL = Agent::DEFAULT_MODEL
puts "=== HTTP Client ==="
puts "Model: #{MODEL}"
puts
puts "No HTTP gem. No curl wrapper. No REST client."
puts "Just a name and a URL. The LLM figures out the rest."
puts
http = Agent.for("HTTP client", model: MODEL)
puts "-> http.get('https://httpbin.org/get')"
puts http.get("https://httpbin.org/get")
puts
puts "-> http.status('https://httpbin.org/status/418')"
puts http.status("https://httpbin.org/status/418")
puts
puts "-> http.headers('https://httpbin.org/response-headers?X-Custom=hello')"
puts http.headers("https://httpbin.org/response-headers?X-Custom=hello").inspect
puts
puts "-> http.post('https://httpbin.org/post', body: '{\"key\": \"value\"}')"
puts http.post("https://httpbin.org/post", body: '{"key": "value"}')