mistral_rb 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/mistral_rb/version.rb +1 -1
- data/lib/mistral_rb.rb +2 -2
- 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: 2e43cdb7fa62132f8342d13ec666a4fe48571dc0dbf5b64a2476c23d4da86aa5
|
4
|
+
data.tar.gz: 402b62dfe6f4ca6a2b77d3e13127b673037374fe75ffbe874c4cafef2fbdaeb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 921683a278ab7f4d9f443c2db7a0dd16dd08b81752e6d99ac49fe619fb23e7d2cd145d30e8760988786ffa81647f9d666a73d0ac3a56e6c34ce921bd61a8339e
|
7
|
+
data.tar.gz: cbc90300023388689b9b5572f25dec507de1cc956f90c7406cfe8fbe685011200a248bbbb7574e564b3ff0b89a9726c60890c9175ac8e4832018b4766d1dabaf
|
data/README.md
CHANGED
@@ -24,15 +24,15 @@ Here is a quick example to get you started:
|
|
24
24
|
require 'mistral_rb'
|
25
25
|
|
26
26
|
# Initialize the API with your API key
|
27
|
-
mistral = MistralAPI.new("your_api_key_here")
|
27
|
+
mistral = MistralAPI.new(api_key: "your_api_key_here")
|
28
28
|
|
29
29
|
# Create Chat Completion
|
30
|
-
response = mistral.create_chat_completion("mistral-tiny", [{role: "user", content: "Who is Macron?"}])
|
30
|
+
response = mistral.create_chat_completion(model: "mistral-tiny", messages: [{role: "user", content: "Who is Macron?"}])
|
31
31
|
puts response.choices.to_s
|
32
32
|
|
33
33
|
# Create Embeddings
|
34
|
-
embedding_response = mistral.create_embeddings("mistral-embed", ["Hello", "world"])
|
35
|
-
puts embedding_response.data.first.
|
34
|
+
embedding_response = mistral.create_embeddings(model: "mistral-embed", input: ["Hello", "world"])
|
35
|
+
puts embedding_response.data.first.inspect
|
36
36
|
|
37
37
|
# List Available Models
|
38
38
|
model_list_response = mistral.list_available_models
|
data/lib/mistral_rb/version.rb
CHANGED
data/lib/mistral_rb.rb
CHANGED
@@ -8,7 +8,7 @@ require_relative "mistral_rb/response_models"
|
|
8
8
|
class MistralAPI
|
9
9
|
include HTTParty
|
10
10
|
|
11
|
-
def initialize(api_key
|
11
|
+
def initialize(api_key:, base_uri: "https://api.mistral.ai/v1")
|
12
12
|
@headers = {
|
13
13
|
"Authorization" => "Bearer #{api_key}",
|
14
14
|
"Content-Type" => "application/json"
|
@@ -42,7 +42,7 @@ class MistralAPI
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def create_embeddings(model
|
45
|
+
def create_embeddings(model:, input:, encoding_format: "float")
|
46
46
|
body = {
|
47
47
|
model: model,
|
48
48
|
input: input,
|