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 +4 -4
 - data/CHANGELOG.md +4 -0
 - data/src/foobara/ai/answer_bot/ask.rb +8 -1
 - data/src/foobara/ai/answer_bot/domain_mappers/anthropic_api/question_to_create_message.rb +7 -1
 - data/src/foobara/ai/answer_bot/domain_mappers/ollama_api/question_to_generate_chat_completion.rb +8 -1
 - data/src/foobara/ai/answer_bot/domain_mappers/open_ai_api/question_to_create_chat_completion.rb +7 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a04cb75747f713b682ced3aef91fc7f5630f8fa5173abb755762d883b56d33b6
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: cbfa07fc11c8e1b3f56dcfb6f1a98ec7a3d7fb2a3ad15b1923df1e972b3667a5
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ddb7e385fc1f5b1a8f45d71e0d62a50b325822b551d781820d389461a73ae42c88a8765be843d76049c721f36f4621abd462679c9af2f789e18e332837f42faf
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3a127986f25ad800cb10db0534026271c79462f8f7a6385db276905f25012925009f4946d96f0f4b4809061134e5a1586e870cbf02f9b25a10a8935b0c22efd5
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| 
         @@ -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 
     | 
    
         
            -
                       
     | 
| 
      
 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:  
     | 
| 
      
 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
         
     | 
    
        data/src/foobara/ai/answer_bot/domain_mappers/ollama_api/question_to_generate_chat_completion.rb
    CHANGED
    
    | 
         @@ -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:  
     | 
| 
      
 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
         
     | 
    
        data/src/foobara/ai/answer_bot/domain_mappers/open_ai_api/question_to_create_chat_completion.rb
    CHANGED
    
    | 
         @@ -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:  
     | 
| 
      
 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. 
     | 
| 
      
 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- 
     | 
| 
      
 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
         
     |