luo 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 102af9d7257f2583c64ff49ad555fd6bfe6127e2d5ef5db2817ef88c0deff2dd
4
- data.tar.gz: f407808206d508f2741a165fe45534d5d951dd3f064481ed75e683cee577a6a2
3
+ metadata.gz: 1830a5e907eb9c92fe84162093cc7c46fa7f1970b07c58b120114dba73499e47
4
+ data.tar.gz: 609ec33cce3365b956494f1446983924a03c5341ed5be8d350575d3303a250a6
5
5
  SHA512:
6
- metadata.gz: 732fd0060a870fa7439d7699fad27929f21873c1051e7ec79dc70478501d5d66a7eff359184530b214624e01c3446f5ee75ead7eee6227d24cebdd074ee100dc
7
- data.tar.gz: 9327870633acba5bcbea062e3bbee7487d6d91cb9168d645b641422742d25c95fb2574f1d55bbc569bb36538a631795b25217b4449314132326836338d08b88a
6
+ metadata.gz: ef9266fbe51fa277369abbe012e531cd07df5b6141af538fb4f934fc591821530440d2ff58bef00accd7e9827bfbc24858f503a616bd765e24a2aea31e9e7bda
7
+ data.tar.gz: c2bf5ddf9f16d7640bd52c35f259fd86d4211f1a995890e3c2151cf2a097b8b54bb060be524b3d91bbd0d61fbf3cfe082366d2e6ad48b5c63d46a3a2aeceb0a4
data/Dockerfile ADDED
@@ -0,0 +1,8 @@
1
+ FROM ruby:3.2.2-alpine
2
+
3
+ # Install dependencies
4
+ RUN gem install luo
5
+
6
+ WORKDIR /workdir
7
+
8
+ ENTRYPOINT ["luo"]
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- luo (0.1.8)
4
+ luo (0.1.9)
5
5
  dotenv (~> 2.8, >= 2.8.1)
6
6
  dry-cli (~> 1.0)
7
7
  dry-configurable (~> 1.0, >= 1.0.1)
data/README.zh.md CHANGED
@@ -2,10 +2,15 @@
2
2
  是一款基于大模型的开发框架(面向产品经理),当前支持大模型提供商有: OpenAI、星火大模型。通过DSL能够快速创作并且测试大模型的效果。
3
3
 
4
4
  ## 安装
5
+
6
+ ###
5
7
  ```
6
8
  gem install luo
7
9
  ```
8
10
 
11
+ ###
12
+ docker run --rm -it -v "$PWD:/workdir" luo_cli_cli -v
13
+
9
14
  ## 环境变量说明
10
15
  ```Bash
11
16
  OPENAI_ACCESS_TOKEN= # OpenAI的访问令牌
data/lib/luo/cli.rb CHANGED
@@ -33,9 +33,19 @@ module Luo
33
33
  end
34
34
  end
35
35
 
36
+ class Run < Dry::CLI::Command
37
+ desc "Run Luo"
38
+
39
+ def call(*)
40
+ exec "ruby application.rb"
41
+ end
42
+ end
43
+
36
44
  register "version", Version, aliases: %w[v -v --version]
37
45
  register "commit", Commit, aliases: ["c"]
38
46
  register "init", Init, aliases: ["i"]
47
+ register "run", Run, aliases: ["r"]
48
+
39
49
  end
40
50
 
41
51
  end
data/lib/luo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Luo
4
- VERSION = "0.1.9"
4
+ VERSION = "0.1.10"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - MJ
@@ -181,6 +181,7 @@ files:
181
181
  - ".idea/modules.xml"
182
182
  - ".idea/vcs.xml"
183
183
  - ".rspec"
184
+ - Dockerfile
184
185
  - Gemfile
185
186
  - Gemfile.lock
186
187
  - README.md
@@ -222,7 +223,6 @@ files:
222
223
  - lib/luo/xinghuo.rb
223
224
  - lib/luo/xinghuo_agent_runner.rb
224
225
  - luo.gemspec
225
- - sample_/marqo.rb
226
226
  - sig/luo.rbs
227
227
  - sig/luo/agent.rbs
228
228
  - sig/luo/agent_runner_base.rbs
data/sample_/marqo.rb DELETED
@@ -1,98 +0,0 @@
1
- require 'httparty'
2
-
3
- class Marqo
4
- include HTTParty
5
-
6
- base_uri ENV.fetch('MARQO_URL')
7
-
8
- class SearchResult < RecursiveOpenStruct
9
- end
10
-
11
- # TODO: Add a way to pass in auth
12
- def initialize(auth = { username: 'admin', password: 'admin' })
13
- @auth = auth
14
- end
15
-
16
- def store(index:, doc:, id:, non_tensor_fields: [])
17
- return if ENV['MARQO_URL'].blank?
18
- puts
19
- puts "🧠🧠🧠 INDEX: #{index} 🧠🧠🧠"
20
- puts "🧠🧠🧠 DOC: #{doc} 🧠🧠🧠"
21
- puts "🧠🧠🧠 ID: #{id} 🧠🧠🧠"
22
- puts "🧠🧠🧠 NON TENSOR FIELDS: #{non_tensor_fields} 🧠🧠🧠"
23
- puts
24
- options = {
25
- headers: { 'Content-Type' => 'application/json' },
26
- body: [doc.merge({_id: id})].to_json
27
- }
28
- url = "/indexes/#{index.to_s.parameterize}/documents"
29
- if non_tensor_fields.any?
30
- field_array = non_tensor_fields.map { |f| "non_tensor_fields=#{f}" }
31
- url += "?#{field_array.join("&")}"
32
- end
33
- self.class.post(url, options).then do |response|
34
- puts response
35
- response.dig("items",0,"_id")
36
- end
37
- end
38
-
39
- def search(index_name, query, filter: nil, limit: 5)
40
- puts
41
- puts "🔍🔍🔍 #{index_name} 🔍🔍🔍"
42
- puts "🔍🔍🔍 #{query} 🔍🔍🔍"
43
- puts "🔍🔍🔍 #{filter} 🔍🔍🔍"
44
- puts
45
- options = {
46
- basic_auth: @auth,
47
- headers: { 'Content-Type' => 'application/json' },
48
- body: {
49
- q: query,
50
- filter: filter,
51
- searchMethod: "TENSOR",
52
- limit: limit
53
- }.to_json
54
- }
55
- response = self.class.post("/indexes/#{index_name.to_s.parameterize}/search", options)
56
- SearchResult.new(response, recurse_over_arrays: true)
57
- end
58
-
59
- def lexsearch(index_name, attributes, query)
60
- options = {
61
- basic_auth: @auth,
62
- headers: { 'Content-Type' => 'application/json' },
63
- body: {
64
- q: query,
65
- searchableAttributes: attributes,
66
- searchMethod: "LEXICAL"
67
- }.to_json
68
- }
69
- SearchResult.new(self.class.post("/indexes/#{index_name.to_s.parameterize}/search", options))
70
- end
71
-
72
- def delete(index_name, id_or_ids)
73
- options = {
74
- basic_auth: @auth,
75
- headers: { 'Content-Type' => 'application/json' },
76
- body: [id].flatten.to_json
77
- }
78
- self.class.post("/indexes/#{index_name.to_s.parameterize}/documents/delete-batch", options)
79
- end
80
-
81
- def remove(index_name)
82
- options = {
83
- basic_auth: @auth,
84
- headers: { 'Content-Type' => 'application/json' }
85
- }
86
- self.class.delete("/indexes/#{index_name.to_s.parameterize}", options)
87
- end
88
-
89
- def self.client
90
- @client ||= new
91
- end
92
-
93
- private
94
-
95
- def wrap(result)
96
- RecursiveOpenStruct.new(hash, recurse_over_arrays: true)
97
- end
98
- end