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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 587a0b7425102e44f79107bd5f0471ba2cb8f88d95fe28af5e1d334093a539e3
4
- data.tar.gz: 73242cb4daa8890a1f16d578c0e6ff50d54651162d11132ce06d9fb571fec062
3
+ metadata.gz: 1b5d6ed41bd22685f456bdd30f90bb462b1d8c89d63b496862c241cd2a9a11ff
4
+ data.tar.gz: feb10f6589c89741ed978a5bd9eb96c228649fd4348ff93b7fa222e3a4d6fd1a
5
5
  SHA512:
6
- metadata.gz: 1f62948774f2cc389ec8b1d53886785667c95d4bd98d3f648307c07342b004c080feb40ae8baa9bda0cb6cf0d3cbeec33f084e9cd5a0a22622a07519a772c0b4
7
- data.tar.gz: 92ce35a290004371ed6ac8ef11d4a41344d85170f398d69ebf2d5251a1a73fc9db79e3065ab5e8d32945070854362f415276a00ac56a4d4e916cd5752f12b5d4
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/) &ndash;
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/) &ndash;
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/) &ndash;
28
+ a blog post that implements image editing with Gemini
29
+
30
+ #### Ecosystem
31
+
32
+ * [llm-shell](https://github.com/llmrb/llm-shell) &ndash; is a developer-oriented console for Large Language Model communication
33
+ * [llm-spell](https://github.com/llmrb/llm-spell) &ndash; 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LLM
4
- VERSION = "0.14.0"
4
+ VERSION = "0.14.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antar Azri