ticuna 0.2.5 → 0.2.6

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: ad184878c7d2fd8d8ee366a2de9996588b74ed1729bc21cc0b22fab7ffe7abb5
4
- data.tar.gz: 4f4fae314169358a091dbb9dfafdc712807ec3f35b27634434d06b587d6080b6
3
+ metadata.gz: 559816faa31497288f44f3c2174199ad15af23dceb2c7e373b2f9b7446c87725
4
+ data.tar.gz: 8758245018266453979599a0428b94bcbaaba288c6455c113f40c7e39abb97dd
5
5
  SHA512:
6
- metadata.gz: c5a0f5ced928c16bcefd52df2a904fa07c895f724aa49eb4621b99b97247034da6a8b64167297bc480e322faf667b5e8c3864f0dc8a4d31099a535c721159464
7
- data.tar.gz: e7d4fe0589f6d82554968f2a095048ac41c33f16c7ffb078e96d95024d3ddc52d13c6ab6dd218650ebbd1eec2d28e2f30d95c1820f63168ea6948ac68013f721
6
+ metadata.gz: 76171e5dc940d98159fb8b94119facf7cc9b23f08f30a37cda59ad57483e91915a261e694c50f2135eb17fa20955e05092358a98382e763ed762de1c610ee827
7
+ data.tar.gz: ec1bf63e151eec143d2d1a8ded518cef4ca7b9a64654612f54eeaf3d7695b99e9ca83b7485e9d239c587c19930b8259a65f1c9c1a245fb6ade3e4426fc5be175
data/CHANGELOG.md CHANGED
@@ -28,4 +28,7 @@
28
28
 
29
29
  ## [0.2.5] - 2025-10-13
30
30
  - Better messages
31
- - Add `errors?` method
31
+ - Add `errors?` method
32
+
33
+ ## [0.2.6] - 2025-10-22
34
+ - Add `context` method
data/lib/ticuna/llm.rb CHANGED
@@ -18,6 +18,7 @@ module Ticuna
18
18
  def initialize_llm(provider_client)
19
19
  @provider = provider_client
20
20
  @tools = []
21
+ @contexts = []
21
22
  end
22
23
 
23
24
  def tool(klass)
@@ -25,13 +26,21 @@ module Ticuna
25
26
  self
26
27
  end
27
28
 
29
+ def context(value = nil, &block)
30
+ value = block.call if block
31
+ @contexts << value if value
32
+ self
33
+ end
34
+
28
35
  def ask(message, stream: false, model: :gpt_4_1, output_format: :text, &block)
29
- tool_contexts = @tools.map(&:context).compact.join("\n\n")
36
+ tool_contexts = @tools.map(&:context).compact
37
+ direct_contexts = @contexts.compact
38
+ combined_contexts = (tool_contexts + direct_contexts).reject { |ctx| ctx.to_s.strip.empty? }
30
39
 
31
- system_message = if tool_contexts.empty?
40
+ system_message = if combined_contexts.empty?
32
41
  nil
33
42
  else
34
- { role: "developer", content: tool_contexts }
43
+ { role: "developer", content: combined_contexts.join("\n\n") }
35
44
  end
36
45
 
37
46
  messages = if system_message
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ticuna
4
- VERSION = "0.2.5"
4
+ VERSION = "0.2.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticuna
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chirana
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-13 00:00:00.000000000 Z
11
+ date: 2025-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday