helicone-rb 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/helicone/client.rb +6 -6
- data/lib/helicone/version.rb +1 -1
- data/sample.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 22d855f83be3572fa91710cb1a63483ac70e07717b9a77103ca752d71931ad09
|
|
4
|
+
data.tar.gz: 26a6eca90b9d1c9ff1cee79ae8a774da5a65fec8088c30bae1956c493242e336
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de7718c83e259ded888212a02c63f2cac6f02eb457ded45361efa1d903a2490a0774425dccab4861da8dd40d48888ab3a156ab769dac1c8f64d42e59b427aa41
|
|
7
|
+
data.tar.gz: 60bc8baed47ae2599f8a7f7f5ecfeca1e791b9b1ddf1123a61e99d7e2f1368254dfeef3a29d0d3941f27c1b1215fe1ac28220ce5ec74c292e610ea9c132d6763
|
data/README.md
CHANGED
|
@@ -112,7 +112,7 @@ response = client.ask("What is the capital of France?")
|
|
|
112
112
|
# With system prompt
|
|
113
113
|
response = client.ask(
|
|
114
114
|
"Explain quantum computing",
|
|
115
|
-
|
|
115
|
+
system_prompt: "You are a physics teacher. Explain concepts simply."
|
|
116
116
|
)
|
|
117
117
|
```
|
|
118
118
|
|
data/lib/helicone/client.rb
CHANGED
|
@@ -66,12 +66,12 @@ module Helicone
|
|
|
66
66
|
#
|
|
67
67
|
# @param prompt [String] User prompt text
|
|
68
68
|
# @param model [String] Model ID to use for completion
|
|
69
|
-
# @param
|
|
69
|
+
# @param system_prompt [String] Optional system prompt
|
|
70
70
|
# @param options [Hash] Additional options passed to chat
|
|
71
71
|
# @return [String] The text content of the response
|
|
72
|
-
def ask(prompt, model: nil,
|
|
72
|
+
def ask(prompt, model: nil, system_prompt: nil, **options)
|
|
73
73
|
messages = []
|
|
74
|
-
messages << Message.system(
|
|
74
|
+
messages << Message.system(system_prompt) if system_prompt
|
|
75
75
|
messages << Message.user_text(prompt)
|
|
76
76
|
|
|
77
77
|
response = chat(messages: messages, model: model, **options)
|
|
@@ -83,13 +83,13 @@ module Helicone
|
|
|
83
83
|
# @param prompt [String] User prompt text
|
|
84
84
|
# @param image_url [String] URL or base64 data URI of the image
|
|
85
85
|
# @param model [String] Model ID to use for completion
|
|
86
|
-
# @param
|
|
86
|
+
# @param system_prompt [String] Optional system prompt
|
|
87
87
|
# @param detail [String] Image detail level: "auto", "low", or "high"
|
|
88
88
|
# @param options [Hash] Additional options passed to chat
|
|
89
89
|
# @return [String] The text content of the response
|
|
90
|
-
def ask_with_image(prompt, image_url, model: nil,
|
|
90
|
+
def ask_with_image(prompt, image_url, model: nil, system_prompt: nil, detail: "auto", **options)
|
|
91
91
|
messages = []
|
|
92
|
-
messages << Message.system(
|
|
92
|
+
messages << Message.system(system_prompt) if system_prompt
|
|
93
93
|
messages << Message.user_with_images(prompt, image_url, detail: detail)
|
|
94
94
|
|
|
95
95
|
response = chat(messages: messages, model: model, **options)
|
data/lib/helicone/version.rb
CHANGED
data/sample.rb
CHANGED
|
@@ -23,7 +23,7 @@ client.ask("What is 2 + 2?")
|
|
|
23
23
|
# => "2 + 2 equals 4."
|
|
24
24
|
|
|
25
25
|
# With a system prompt
|
|
26
|
-
client.ask("Tell me a joke",
|
|
26
|
+
client.ask("Tell me a joke", system_prompt: "You are a comedian")
|
|
27
27
|
|
|
28
28
|
# With a specific model
|
|
29
29
|
client.ask("Explain Ruby blocks", model: "gpt-4o-mini")
|
|
@@ -115,7 +115,7 @@ end
|
|
|
115
115
|
# Run the agent
|
|
116
116
|
agent = Helicone::Agent.new(
|
|
117
117
|
tools: [WeatherTool, CalculatorTool],
|
|
118
|
-
|
|
118
|
+
system_prompt: "You are a helpful assistant with access to weather and calculator tools."
|
|
119
119
|
)
|
|
120
120
|
|
|
121
121
|
result = agent.run("What's the weather in San Francisco?")
|