-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep5
executable file
·82 lines (71 loc) · 1.66 KB
/
step5
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env ruby
require "bundler"
Bundler.require(:default)
Dotenv.load
require_relative "lib/render"
renderer = Render.new
puts "\n"
sample_todos = [
"Buy more avocados",
"Finish the series Dark Matter",
"Call mom",
"Go for a run",
"Schedule dentist appointment",
"Paint the living room",
"Practice this recent piano sheet music"
]
answer = renderer.select(
question: "Select a TODO you want to create from the list below:",
opts: sample_todos
)
prompt = "Create a Trello card with the content `#{answer}` in the TODO list."
request = <<~JSON
{
"model": "claude-3-5-sonnet",
"messages": [
{
"role": "user",
"content": "#{prompt}"
}
],
"tools": [
{
"type": "heroku_tool",
"function": "dyno_run_command",
"runtime_params": {
"target_app_name": "heroku-df24-trello",
"dyno_size": "Standard-2X",
"ttl_seconds": 300,
"max_retries": 2,
"tool_params": {
"cmd": "create_card"
}
},
"description": "This tool is able to create Trello cards in the TODO list.",
"parameters": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "The content for the Trello card"
}
},
"required": ["content"]
}
}
],
"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
renderer.inference_request(request:)
renderer.hr