-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep11
executable file
·48 lines (38 loc) · 886 Bytes
/
step11
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env ruby
require "bundler"
Bundler.require(:default)
Dotenv.load
require_relative "lib/render"
renderer = Render.new
prompt = "Who won the Detroit Lions game on Nov 3, 2024? Use the web."
request = <<~JSON
{
"model": "claude-3-5-sonnet",
"messages": [
{
"role": "user",
"content": "#{prompt}"
}
],
"tools": [
{
"type": "heroku_tool",
"function": "search_web"
}
],
"tool_choice": "auto"
}
JSON
renderer.heroku_print("Here is the request we are sending to Heroku for inferencing...")
renderer.print_markdown(
<<~MARKDOWN
```json
#{request}
```
MARKDOWN
)
answer = renderer.confirm("Ready to send the inference request?")
exit(0) unless answer
response = renderer.inference_request(request:, print_last_message: false)
renderer.print_large_box(response.dig("choices", 0, "message", "content"))
renderer.hr