omniai 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/omniai/client.rb +15 -6
- data/lib/omniai/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: 239eb058ae53afd3f28fe00a18af282a856ca842a4f81bcdf22413a02d8d44fc
|
4
|
+
data.tar.gz: e74ac69ab6435fd9da3d1602c9cce5e052f53bebf609d8815868b58be0897884
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6b18cae8b5aab610bf255860ccd514b794eda3021b2f9b3aa86020968e0f449b683b4db74291e71583698b61d7612a7e49b3ee0310c806a826f7b27c50c7d92
|
7
|
+
data.tar.gz: bd12b38f3c9a150fe09644aaf187aa05aa1063ee136196e11fcaa356f4fe5bdc2c93f6292a79025f301c6d35a1202186f6ad787787828dfd5af91f229a34b550
|
data/README.md
CHANGED
@@ -60,6 +60,18 @@ require 'omniai/openai'
|
|
60
60
|
client = OmniAI::OpenAI::Client.new
|
61
61
|
```
|
62
62
|
|
63
|
+
#### Usage with LocalAI
|
64
|
+
|
65
|
+
LocalAI support is offered through [OmniAI::OpenAI](https://github.com/ksylvest/omniai-openai):
|
66
|
+
|
67
|
+
[Usage with LocalAI](https://github.com/ksylvest/omniai-openai#usage-with-localai)
|
68
|
+
|
69
|
+
#### Usage with Ollama
|
70
|
+
|
71
|
+
Ollama support is offered through [OmniAI::OpenAI](https://github.com/ksylvest/omniai-openai):
|
72
|
+
|
73
|
+
[Usage with Ollama](https://github.com/ksylvest/omniai-openai#usage-with-ollama)
|
74
|
+
|
63
75
|
### Chat
|
64
76
|
|
65
77
|
Clients that support chat (e.g. Anthropic w/ "Claude", Google w/ "Gemini", Mistral w/ "LeChat", OpenAI w/ "ChatGPT", etc) generate completions using the following calls:
|
data/lib/omniai/client.rb
CHANGED
@@ -13,19 +13,28 @@ module OmniAI
|
|
13
13
|
class Client
|
14
14
|
class Error < StandardError; end
|
15
15
|
|
16
|
-
attr_accessor :api_key
|
16
|
+
attr_accessor :api_key, :logger, :host
|
17
17
|
|
18
|
-
# @param api_key [String]
|
19
|
-
# @param
|
20
|
-
|
18
|
+
# @param api_key [String] optional
|
19
|
+
# @param host [String] optional - supports for customzing the host of the client (e.g. 'http://localhost:8080')
|
20
|
+
# @param logger [Logger] optional
|
21
|
+
def initialize(api_key: nil, logger: nil, host: nil)
|
21
22
|
@api_key = api_key
|
23
|
+
@host = host
|
22
24
|
@logger = logger
|
23
25
|
end
|
24
26
|
|
25
27
|
# @return [String]
|
26
28
|
def inspect
|
27
|
-
|
28
|
-
"
|
29
|
+
props = []
|
30
|
+
props << "api_key=#{masked_api_key.inspect}" if @api_key
|
31
|
+
props << "host=#{@host.inspect}" if @host
|
32
|
+
"#<#{self.class.name} #{props.join(' ')}>"
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [String]
|
36
|
+
def masked_api_key
|
37
|
+
"#{api_key[..2]}***" if api_key
|
29
38
|
end
|
30
39
|
|
31
40
|
# @return [HTTP::Client]
|
data/lib/omniai/version.rb
CHANGED