verica-observability 0.1.2 → 0.1.4
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 +23 -34
- data/lib/verica/version.rb +1 -1
- 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: 438dcb9a5e21879ac0078d2a16a33424936a998bf89abb80aafb5948581de805
|
|
4
|
+
data.tar.gz: a3297755e16825869ab659f288d4b6ffe5dfbca5161880aecd103b106af7c68b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7aa94440e9614e45bf317092481309c70751bcbc35e73ffa5eb2b75717ed77792186520c61f5cb6bc78bd42906ef297e034ae12e4dfc29d05c08adb6fc4f8d67
|
|
7
|
+
data.tar.gz: 562391c9009fe1fdfc82cd6319b3a081202824bf6cd66363f1136548f880c5f652a18e090ceb3d49b9e0d1f92cee0b4fded2e6352fdca29d8012360832eb4571
|
data/README.md
CHANGED
|
@@ -19,51 +19,40 @@ client = Verica.wrap_openai(OpenAI::Client.new)
|
|
|
19
19
|
# use `client` exactly like the original; chat completions are traced.
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
## Use (
|
|
22
|
+
## Use (`ruby-openai` gem: OpenAI, Gemini, Anthropic)
|
|
23
23
|
|
|
24
|
-
The community [`ruby-openai`](https://github.com/alexrudall/ruby-openai) gem
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
The community [`ruby-openai`](https://github.com/alexrudall/ruby-openai) gem uses
|
|
25
|
+
`client.chat(parameters: { ... })` and returns a plain Hash. Wrap it with
|
|
26
|
+
`wrap_openai_compatible`: the provider is inferred from the model (`gpt-*` →
|
|
27
|
+
openai, `gemini-*` → google, `claude-*` → anthropic), so one wrapper traces
|
|
28
|
+
OpenAI plus Gemini and Anthropic via their OpenAI-compatible endpoints.
|
|
27
29
|
|
|
28
30
|
```ruby
|
|
29
31
|
require 'verica'
|
|
30
|
-
|
|
31
32
|
Verica.init(token: ENV['VERICA_TOKEN'])
|
|
32
|
-
client = Verica.wrap_ruby_openai(OpenAI::Client.new)
|
|
33
|
-
|
|
34
|
-
client.chat(parameters: {
|
|
35
|
-
model: 'gpt-4o-mini',
|
|
36
|
-
messages: [{ role: 'user', content: 'Hello!' }]
|
|
37
|
-
})
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Streaming calls (a `stream:` proc in `parameters`) pass through untouched and
|
|
41
|
-
are traced with request-side attributes only (the streamed response is not a
|
|
42
|
-
stable Hash to read the model or usage from).
|
|
43
33
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
# OpenAI
|
|
35
|
+
openai = Verica.wrap_openai_compatible(OpenAI::Client.new(access_token: ENV['OPENAI_API_KEY']))
|
|
36
|
+
openai.chat(parameters: { model: 'gpt-4o-mini', messages: [{ role: 'user', content: 'Hello!' }] })
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Both providers expose OpenAI-compatible endpoints, so the same wrapper traces
|
|
51
|
-
them too. Use `wrap_openai_compatible` (the `ruby-openai` shape) and point the
|
|
52
|
-
client at the provider's endpoint; the provider label is inferred from the model
|
|
53
|
-
name (`gemini-*` → google, `claude-*` → anthropic).
|
|
54
|
-
|
|
55
|
-
```ruby
|
|
56
|
-
# Gemini
|
|
57
|
-
gemini = OpenAI::Client.new(
|
|
38
|
+
# Gemini (OpenAI-compatible endpoint)
|
|
39
|
+
gemini = Verica.wrap_openai_compatible(OpenAI::Client.new(
|
|
58
40
|
access_token: ENV['GEMINI_API_KEY'],
|
|
59
41
|
uri_base: 'https://generativelanguage.googleapis.com/v1beta/openai/'
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
|
|
42
|
+
))
|
|
43
|
+
gemini.chat(parameters: { model: 'gemini-2.5-flash', messages: [...] })
|
|
44
|
+
|
|
45
|
+
# Anthropic (OpenAI-compatible endpoint)
|
|
46
|
+
anthropic = Verica.wrap_openai_compatible(OpenAI::Client.new(
|
|
47
|
+
access_token: ENV['ANTHROPIC_API_KEY'],
|
|
48
|
+
uri_base: 'https://api.anthropic.com/v1/'
|
|
49
|
+
))
|
|
50
|
+
anthropic.chat(parameters: { model: 'claude-sonnet-4', messages: [...] })
|
|
63
51
|
```
|
|
64
52
|
|
|
65
|
-
`wrap_ruby_openai` is a back-compat alias of `wrap_openai_compatible
|
|
66
|
-
|
|
53
|
+
`wrap_ruby_openai` is a back-compat alias of `wrap_openai_compatible`. Streaming
|
|
54
|
+
calls (a `stream:` proc) pass through with request-side attributes only. Ruby has
|
|
55
|
+
no native Gemini/Anthropic gem support; use the OpenAI-compatible endpoints above.
|
|
67
56
|
|
|
68
57
|
## Use (RubyLLM)
|
|
69
58
|
|
data/lib/verica/version.rb
CHANGED