mistral_rb 0.1.5 → 0.1.7

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: 1c775af119701a9e79b9aed5e79049ffcb5d3b434d8730d51e857443d1cdeb84
4
- data.tar.gz: 43141631a0f888a09e85259832a2d30a8c3c02c8659327ff97bc859317795340
3
+ metadata.gz: d6a738ce2d5cdd375d86ff8b3573d10f88e75fa50b4320107c19af9764e57f68
4
+ data.tar.gz: 51be8eb88f3d1c17433cbd26e647abdacd6b5998496a451545bb5f49b7f012b9
5
5
  SHA512:
6
- metadata.gz: 2f8513858962d88312898f29be0d2fb786d0c0e693877e404aca529c5589d0e077b267066f297b5b2b238f77507c1a3eb93e5703d63513f31bccbff386000441
7
- data.tar.gz: 155f73296b4de0a124531c3e2c26babba0636b61ae6a39c328b815dd44b47f7124cf64ae46dc1dedfa6fc58feb099925224af1df33bb590a8587913e32d2528f
6
+ metadata.gz: c7909af91f1f7f1be58f71f7b22ef98628d34359aa9e599fa7c43b837a6401f08bcf161c4553057bc195b241ca45d4c86720bfa0f5dda71525b9685b4ad24ae3
7
+ data.tar.gz: a7acf05f8b18515490162f7e0fb7664bdb6aee75b95a1bc3288f12ec36a102c6857dc31e06212c81b6cdeb3de02d3c916a876631e860d9a085bd7f03e5bac813
@@ -42,7 +42,7 @@ class TxtContentExtractor
42
42
  pages = split_into_pages(sanitized_content)
43
43
  @page_count = pages.size
44
44
 
45
- pages
45
+ [pages, content]
46
46
  end
47
47
  end
48
48
 
@@ -9,6 +9,7 @@ class MistralEmbeddingCreator
9
9
  @chunker = chunker
10
10
  @model = model
11
11
  @api_key = api_key || ENV['MISTRAL_API_KEY']
12
+ raise 'API key not found. Please set the MISTRAL_API_KEY environment variable.' if api_key.nil? || api_key.empty?
12
13
 
13
14
  if @api_key
14
15
  @llm = MistralAPI.new(api_key: @api_key)
@@ -9,6 +9,7 @@ class OpenaiEmbeddingCreator
9
9
  @chunker = chunker
10
10
  @model = model
11
11
  @api_key = api_key || ENV['OPENAI_API_KEY']
12
+ raise 'API key not found. Please set the OPENAI_API_KEY environment variable.' if api_key.nil? || api_key.empty?
12
13
 
13
14
  if @api_key
14
15
  @llm = OpenAI::Client.new(access_token: @api_key)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MistralRb
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.7"
5
5
  end
data/lib/mistral_rb.rb CHANGED
@@ -12,6 +12,7 @@ class MistralAPI
12
12
  include HTTParty
13
13
 
14
14
  def initialize(api_key: ENV["MISTRAL_API_KEY"], base_uri: "https://api.mistral.ai/v1")
15
+ raise 'API key not found. Please set the MISTRAL_API_KEY environment variable.' if api_key.nil? || api_key.empty?
15
16
  @headers = {
16
17
  "Authorization" => "Bearer #{api_key}",
17
18
  "Content-Type" => "application/json"
@@ -19,7 +20,7 @@ class MistralAPI
19
20
  self.class.base_uri base_uri
20
21
  end
21
22
 
22
- def create_chat_completion(model:, messages:, temperature: 0.7, top_p: 1, max_tokens: nil, stream: false, safe_mode: false, random_seed: nil)
23
+ def create_chat_completion(model:, messages:, temperature: 0.7, top_p: 1, max_tokens: nil, stream: false, safe_prompt: false, random_seed: nil)
23
24
  body = {
24
25
  model: model,
25
26
  messages: messages,
@@ -27,7 +28,7 @@ class MistralAPI
27
28
  top_p: top_p,
28
29
  max_tokens: max_tokens,
29
30
  stream: stream,
30
- safe_mode: safe_mode,
31
+ safe_prompt: safe_prompt,
31
32
  random_seed: random_seed
32
33
  }.compact.to_json
33
34
 
@@ -7,6 +7,8 @@ Dotenv.load()
7
7
  class PineconeService
8
8
  attr_reader :index
9
9
  def initialize(pinecone_key: ENV['PINECONE_API_KEY'], pinecone_env: ENV['PINECONE_ENV'], index_name:)
10
+ raise 'API key not found. Please set the PINECONE_API_KEY environment variable.' if pinecone_key.nil? || pinecone_key.empty?
11
+ raise 'ENV not found. Please set the PINECONE_ENV environment variable.' if pinecone_env.nil? || pinecone_env.empty?
10
12
  @pinecone_key = pinecone_key
11
13
  @pinecone_env = pinecone_env
12
14
  @index_name = index_name
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mistral_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franck Stephane Ndzomga
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-02 00:00:00.000000000 Z
11
+ date: 2024-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler