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.
- checksums.yaml +4 -4
- data/README.md +17 -2
- data/lib/oxaiworkers/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: 645f1edf77d22df8ca5a9afb6498c2cc3c599531f5ea0875baea83c572f902b6
|
4
|
+
data.tar.gz: 5ecc6f8ac7de22fe8b46281789afb5a0a6907512077341a42d13c72d2445407a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
data/lib/oxaiworkers/version.rb
CHANGED