ox-ai-workers 1.0.1.4 → 1.0.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -2
  3. data/lib/oxaiworkers/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44b49317bfef1e300bfb9ae3e8bb37b92fc9da73c17b06d9d165670b812945d2
4
- data.tar.gz: 5afd7bced4a4064d9ffb14fc1e35713df5c7b891e34ac1763d9fc19d2a0434ef
3
+ metadata.gz: 645f1edf77d22df8ca5a9afb6498c2cc3c599531f5ea0875baea83c572f902b6
4
+ data.tar.gz: 5ecc6f8ac7de22fe8b46281789afb5a0a6907512077341a42d13c72d2445407a
5
5
  SHA512:
6
- metadata.gz: c0cdb98995e6dba241e4f1cdc83bb7234e8f227e0b2844d0c7a40468ae5e69396aa6337d0c7dafdcb6927d19c9f09c0d9dab3b3ffc6ef3d5d612b915adfb56a9
7
- data.tar.gz: ab0e001fc369b197f69e58a3c3bf3eaccce9a0049082f628dc06ec3713a7dd8ce99d12229dee649991f2a7c66817eed6fbb3f7ad40993dcf493fcd7ab6fde216
6
+ metadata.gz: 4e4e6d35f2d930c71aab9463b3cb7a445cf033036d80247b46259366f03c8bde177555ab9b6cadfc101f144e886f621c200236a6d912687c2e1a32da7c8c1fb1
7
+ data.tar.gz: a7b60320582364dea278357b4df37435ccb2ea548c7613263c18f78ad2ab20079222ce419753b378b245006f7cc6f508c9842259613ffc5792a19239f7afeb40
data/README.md CHANGED
@@ -385,20 +385,31 @@ You can create custom tools by extending the `ToolDefinition` module:
385
385
  class MyTool
386
386
  include OxAiWorkers::ToolDefinition
387
387
 
388
+ attr_accessor :messages
389
+
388
390
  def initialize
391
+ @messages = []
392
+
389
393
  define_function :hello_world, description: "Says hello to someone" do
390
394
  property :name, type: "string", description: "Name to greet" # Default required: true
391
- property :age, type: ["integer", "null"], description: "Age of the person" # Default required: true
395
+ property :age, type: ["integer", "null"], description: "Age of the person" # Default required: true, can be null so it's optional
392
396
  end
393
397
  end
394
398
 
395
399
  def hello_world(name:)
400
+ @messages << "Greeted #{name}"
396
401
  "Hello, #{name}!"
397
402
  end
403
+
404
+ # The context method provides information to assistants using this tool before each request
405
+ def context
406
+ return nil if @messages.empty?
407
+ "Tool activity log:\n#{@messages.join("\n")}"
408
+ end
398
409
  end
399
410
  ```
400
411
 
401
- The `define_function` method accepts an optional `strict` parameter (defaults to `true`) that controls whether additional properties are allowed in the input. When `strict: true` (default), the schema will include `additionalProperties: false`, enforcing that only defined properties can be used.
412
+ The `define_function` method accepts an optional `strict` parameter (defaults to `true`) that controls whether additional properties are allowed in the input. When `strict: true` (default), the schema will include `additionalProperties: false`, enforcing that only defined properties can be used. Tools can also implement a `context` method that returns information to be included in assistant conversations before each request, which is particularly useful when multiple assistants share a common tool to maintain shared state or history.
402
413
 
403
414
  ### Working with Files and Images
404
415
 
@@ -628,6 +639,10 @@ OxAiWorkers provides several specialized tools to extend functionality:
628
639
 
629
640
  - **FileSystem**: File operations tool
630
641
 
642
+ ```ruby
643
+ gem "ptools"
644
+ ```
645
+
631
646
  ```ruby
632
647
  # Initialize with optional parameters
633
648
  file_system = OxAiWorkers::Tool::FileSystem.new(
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OxAiWorkers
4
- VERSION = '1.0.1.4'
4
+ VERSION = '1.0.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ox-ai-workers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1.4
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Smolev