everyai 0.0.6 → 0.0.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/everyai/agent.rb +48 -0
  3. data/lib/everyai.rb +6 -3
  4. metadata +4 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0d7d1e9d63e7fd278a1fb7d64aa992c38bd55a8dc1663c486af894737343faf
4
- data.tar.gz: 3115c0159b908b21ffc2c63e6686e87a2dd6f7ab33ad77fc8f89393cac06921f
3
+ metadata.gz: eb5be648b3d839fdb8eb4412456aaf0a6c8877cc8e0509278f00c196212396be
4
+ data.tar.gz: 86758e35d6e225ae3bb354ac3616a68d16b9fc0557a609f5454457ab1361015d
5
5
  SHA512:
6
- metadata.gz: 7fac790345ee17c259018dbc1f5df69573a9d12206784e20c7dd37348b36b174158c2eb36d1b0b3229672bee948c4167e8bb93a926dc0c81c3f1b3e4b1f3099f
7
- data.tar.gz: 4d3606fa5ddb6373b48dccc90f9676e4e1d0ee4945b074f4f41f7fe5d93eedccb4d034a2330a7ee4c51c56186c98793444e00f5c59dea89f1b1b75643cba249c
6
+ metadata.gz: b47113be928cb3ce172ad3b6d8550a11bfa23a6cd741666247a927d7b86ce4940633f89b60acfb8c3805182bc60759bf5ccbe51ceb805ae67252212e3c1b5078
7
+ data.tar.gz: 374742102725b2334a150dbddd62474bdeff72ceb067c4831e95cf9d61e3ac4c9d74543d3530ece53fc39d25968d72aa88376a080df727ed92f17395665fb08e
@@ -0,0 +1,48 @@
1
+ class Everyai
2
+ class Agent
3
+ AGENT_PATH = "#{Everyai::DOMAIN}/api/v1/agents"
4
+ AGENT_GENERATION_PATH = "#{AGENT_PATH}/generations"
5
+
6
+ class << self
7
+ def find(agent_id)
8
+ url = URI.parse(AGENT_PATH)
9
+ response = Net::HTTP.post_form(url, { "token": Everyai.api_key, "agent_id": agent_id })
10
+ body = JSON.parse(response.body)
11
+ if response.kind_of? Net::HTTPSuccess
12
+ body["results"]
13
+ new(agent_id)
14
+ else
15
+ body["errors"]
16
+ end
17
+ end
18
+
19
+ def generate(prompt, model: "llama3.2", **model_options)
20
+ agent_id = model_options[:agent_id]
21
+ options = model_options.except(:agent_id)
22
+ if !agent_id
23
+ { errors: "You need to include an agent id first" }
24
+ end
25
+
26
+ agent = new(agent_id)
27
+ agent.generate(prompt, model: model, **model_options)
28
+ end
29
+ end
30
+
31
+ attr_reader :agent_id
32
+
33
+ def initialize(agent_id)
34
+ @agent_id = agent_id
35
+ end
36
+
37
+ def generate(prompt, model: "llama3.2", **model_options)
38
+ url = URI.parse(AGENT_GENERATION_PATH)
39
+ response = Net::HTTP.post_form(url, { "prompt": prompt, "model": model, "token": Everyai.api_key, "agent_id": agent_id, "options": model_options.to_json })
40
+ body = JSON.parse(response.body)
41
+ if response.kind_of? Net::HTTPSuccess
42
+ body["results"]
43
+ else
44
+ body["errors"]
45
+ end
46
+ end
47
+ end
48
+ end
data/lib/everyai.rb CHANGED
@@ -3,7 +3,8 @@ require 'uri'
3
3
  require 'json'
4
4
 
5
5
  class Everyai
6
- DOMAIN = "https://every-llm.com" #"http://localhost:3000"
6
+ DOMAIN = "https://every-llm.com"
7
+ #DOMAIN = "http://localhost:3000"
7
8
  API_GENERATIONS_PATH = "#{DOMAIN}/api/v1/generations"
8
9
 
9
10
  class << self
@@ -17,7 +18,7 @@ class Everyai
17
18
  @api_key
18
19
  end
19
20
 
20
- def generate(prompt, model: "llama3.1", **model_options)
21
+ def generate(prompt, model: "llama3.2", **model_options)
21
22
  url = URI.parse(API_GENERATIONS_PATH)
22
23
  response = Net::HTTP.post_form(url, { "prompt": prompt, "model": model, "token": api_key, "options": model_options.to_json })
23
24
  body = JSON.parse(response.body)
@@ -32,7 +33,7 @@ class Everyai
32
33
  generate(prompt, model: model )
33
34
  end
34
35
 
35
- def llama(prompt, model: "llama3.1", context: nil)
36
+ def llama(prompt, model: "llama3.2", context: nil)
36
37
  generate(prompt, model: model, context: context)
37
38
  end
38
39
 
@@ -41,3 +42,5 @@ class Everyai
41
42
  end
42
43
  end
43
44
  end
45
+
46
+ require_relative 'everyai/agent'
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: everyai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Enoch Tamulonis
8
8
  - Kurt Tamulonis
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-09-08 00:00:00.000000000 Z
11
+ date: 2025-01-15 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: This ruby gem allows you to connect to any AI model with one simple interface.
15
14
  Never worry about configuration and installing libraries. We make connecting to
@@ -20,12 +19,12 @@ extensions: []
20
19
  extra_rdoc_files: []
21
20
  files:
22
21
  - lib/everyai.rb
22
+ - lib/everyai/agent.rb
23
23
  homepage: https://rubygems.org/gems/everyai
24
24
  licenses:
25
25
  - MIT
26
26
  metadata:
27
27
  source_code_uri: https://github.com/Every-LLM/every-ai-gem
28
- post_install_message:
29
28
  rdoc_options: []
30
29
  require_paths:
31
30
  - lib
@@ -40,8 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
39
  - !ruby/object:Gem::Version
41
40
  version: '0'
42
41
  requirements: []
43
- rubygems_version: 3.5.7
44
- signing_key:
42
+ rubygems_version: 3.6.2
45
43
  specification_version: 4
46
44
  summary: Every AI ruby gem. Connect to any AI model easily
47
45
  test_files: []