foobara-ai 0.0.2 → 0.0.4

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: 03f80dea5773af148c7f339f9d3e7dec8a88f2af6221a4faf7fcf37c98cff736
4
- data.tar.gz: 2b3c9838f177e073bb2c32ec12d16e2de4338939a095cf242bc67f5935bed6e8
3
+ metadata.gz: a04cb75747f713b682ced3aef91fc7f5630f8fa5173abb755762d883b56d33b6
4
+ data.tar.gz: cbfa07fc11c8e1b3f56dcfb6f1a98ec7a3d7fb2a3ad15b1923df1e972b3667a5
5
5
  SHA512:
6
- metadata.gz: d5f20ee178bec92ff8015297ca8c4a9f8d8480d4bf164f279acc7b005f477fe9a1d2448990939bfd774aeaebd9744a470129cb9c07feb4109e15cd4a27751fcc
7
- data.tar.gz: f063f51a9902fae91bebd5f4436631aa837af8c92efb57673c81a43737d4821ad399b9fc809b8c41ca32d481714418231b2ebfd5936b8793003557b6399d0f11
6
+ metadata.gz: ddb7e385fc1f5b1a8f45d71e0d62a50b325822b551d781820d389461a73ae42c88a8765be843d76049c721f36f4621abd462679c9af2f789e18e332837f42faf
7
+ data.tar.gz: 3a127986f25ad800cb10db0534026271c79462f8f7a6385db276905f25012925009f4946d96f0f4b4809061134e5a1586e870cbf02f9b25a10a8935b0c22efd5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.0.4] - 2025-03-04
2
+
3
+ - Add an instructions input that translates to a system prompt
4
+
1
5
  ## [0.0.2] - 2025-03-03
2
6
 
3
7
  - Release as a gem
@@ -6,6 +6,7 @@ module Foobara
6
6
 
7
7
  inputs do
8
8
  question :string, :required, "whatever you want to know!"
9
+ instructions :string, "Results in a system prompt. You can specify how you want the LLM to behave."
9
10
  service :service_enum, "If two services expose the same model, you can specify which one to use."
10
11
  model :model_enum, default: "gpt-3.5-turbo", description: "The model to use."
11
12
  end
@@ -41,7 +42,13 @@ module Foobara
41
42
  end
42
43
 
43
44
  def run_ai_service
44
- self.answer = run_mapped_subcommand!(ai_command, question:, model:)
45
+ inputs = { question:, model: }
46
+
47
+ if instructions
48
+ inputs[:instructions] = instructions
49
+ end
50
+
51
+ self.answer = run_mapped_subcommand!(ai_command, inputs)
45
52
  end
46
53
  end
47
54
  end
@@ -8,13 +8,15 @@ module Foobara
8
8
  class QuestionToCreateMessage < Foobara::DomainMapper
9
9
  from do
10
10
  question :string, :required
11
+ instructions :string,
12
+ default: "You are a scientific-minded assistant who answers concisely and precisely."
11
13
  model :model_enum
12
14
  end
13
15
  to Foobara::Ai::AnthropicApi::CreateMessage
14
16
 
15
17
  def map
16
18
  {
17
- system: "You are a scientific-minded assistant who answers concisely and precisely.",
19
+ system: instructions,
18
20
  messages: [
19
21
  {
20
22
  role: "user",
@@ -35,6 +37,10 @@ module Foobara
35
37
  def model
36
38
  from[:model]
37
39
  end
40
+
41
+ def instructions
42
+ from[:instructions]
43
+ end
38
44
  end
39
45
  end
40
46
  end
@@ -8,6 +8,9 @@ module Foobara
8
8
  class QuestionToGenerateChatCompletion < Foobara::DomainMapper
9
9
  from do
10
10
  question :string, :required
11
+ instructions :string,
12
+ default: "You are a scientific-minded assistant who answers concisely and precisely."
13
+
11
14
  model :model_enum
12
15
  end
13
16
  to Foobara::Ai::OllamaApi::GenerateChatCompletion
@@ -17,7 +20,7 @@ module Foobara
17
20
  messages: [
18
21
  {
19
22
  role: "system",
20
- content: "You are a scientific-minded assistant who answers concisely and precisely."
23
+ content: instructions
21
24
  },
22
25
  {
23
26
  role: "user",
@@ -38,6 +41,10 @@ module Foobara
38
41
  def model
39
42
  from[:model]
40
43
  end
44
+
45
+ def instructions
46
+ from[:instructions]
47
+ end
41
48
  end
42
49
  end
43
50
  end
@@ -8,6 +8,8 @@ module Foobara
8
8
  class QuestionToCreateChatCompletion < Foobara::DomainMapper
9
9
  from do
10
10
  question :string, :required
11
+ instructions :string,
12
+ default: "You are a scientific-minded assistant who answers concisely and precisely."
11
13
  model :model_enum
12
14
  end
13
15
  to Foobara::Ai::OpenAiApi::CreateChatCompletion
@@ -17,7 +19,7 @@ module Foobara
17
19
  messages: [
18
20
  {
19
21
  role: "system",
20
- content: "You are a scientific-minded assistant who answers concisely and precisely."
22
+ content: instructions
21
23
  },
22
24
  {
23
25
  role: "user",
@@ -38,6 +40,10 @@ module Foobara
38
40
  def model
39
41
  from[:model]
40
42
  end
43
+
44
+ def instructions
45
+ from[:instructions]
46
+ end
41
47
  end
42
48
  end
43
49
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-04 00:00:00.000000000 Z
10
+ date: 2025-03-05 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: foobara-anthropic-api