llm.rb 0.14.0 → 0.14.1
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 -0
- data/lib/llm/message.rb +7 -0
- data/lib/llm/providers/openai/responses.rb +8 -0
- data/lib/llm/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: 1b5d6ed41bd22685f456bdd30f90bb462b1d8c89d63b496862c241cd2a9a11ff
|
4
|
+
data.tar.gz: feb10f6589c89741ed978a5bd9eb96c228649fd4348ff93b7fa222e3a4d6fd1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b922ffea8f415e50ab5a33e16bfe40d9dc9f8875fefccb6e1ad1afe0001ab3e3b52e2f5389d152ecf65f68913af57b6bada63eff25121a9b0d45013072f813c4
|
7
|
+
data.tar.gz: f930afdee74629503347f2115c0e9a4a734282cbade8591804988d910ac5180ef26a727d937cd496a76a46f3aa100548e61e103b7edaa6b57e35d8aa4552eb2f
|
data/README.md
CHANGED
@@ -9,6 +9,29 @@ The library provides a common, uniform interface for all the providers and
|
|
9
9
|
features it supports, in addition to provider-specific features as well. Keep
|
10
10
|
reading to find out more.
|
11
11
|
|
12
|
+
## Quick start
|
13
|
+
|
14
|
+
#### Demo
|
15
|
+
|
16
|
+
<details>
|
17
|
+
<summary>Play</summary>
|
18
|
+
<img src="share/llm-shell/examples/demo.gif/">
|
19
|
+
</details>
|
20
|
+
|
21
|
+
#### Guides
|
22
|
+
|
23
|
+
* [An introduction to RAG](https://0x1eef.github.io/posts/an-introduction-to-rag-with-llm.rb/) –
|
24
|
+
a blog post that implements the RAG pattern
|
25
|
+
* [How to estimate the age of a person in a photo](https://0x1eef.github.io/posts/age-estimation-with-llm.rb/) –
|
26
|
+
a blog post that implements an age estimation tool
|
27
|
+
* [How to edit an image with Gemini](https://0x1eef.github.io/posts/how-to-edit-images-with-gemini/) –
|
28
|
+
a blog post that implements image editing with Gemini
|
29
|
+
|
30
|
+
#### Ecosystem
|
31
|
+
|
32
|
+
* [llm-shell](https://github.com/llmrb/llm-shell) – is a developer-oriented console for Large Language Model communication
|
33
|
+
* [llm-spell](https://github.com/llmrb/llm-spell) – is a utility that can correct spelling mistakes with a Large Language Model
|
34
|
+
|
12
35
|
## Features
|
13
36
|
|
14
37
|
#### General
|
data/lib/llm/message.rb
CHANGED
@@ -117,6 +117,13 @@ module LLM
|
|
117
117
|
[*content].grep(LLM::Function::Return).any?
|
118
118
|
end
|
119
119
|
|
120
|
+
##
|
121
|
+
# @return [LLM::Response, nil]
|
122
|
+
# Returns the response associated with the message, or nil
|
123
|
+
def response
|
124
|
+
extra[:response]
|
125
|
+
end
|
126
|
+
|
120
127
|
##
|
121
128
|
# Returns a string representation of the message
|
122
129
|
# @return [String]
|
@@ -80,5 +80,13 @@ class LLM::OpenAI
|
|
80
80
|
:format_tools].each do |m|
|
81
81
|
define_method(m) { |*args, **kwargs, &b| @provider.send(m, *args, **kwargs, &b) }
|
82
82
|
end
|
83
|
+
|
84
|
+
def format_schema(params)
|
85
|
+
return {} unless params && params[:schema]
|
86
|
+
schema = params.delete(:schema)
|
87
|
+
schema = schema.to_h.merge(additionalProperties: false)
|
88
|
+
name = "JSONSchema"
|
89
|
+
{text: {format: {type: "json_schema", name:, schema:}}}
|
90
|
+
end
|
83
91
|
end
|
84
92
|
end
|
data/lib/llm/version.rb
CHANGED