luo 0.1.18 → 0.1.21
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/Gemfile.lock +1 -1
- data/README.zh.md +7 -6
- data/lib/luo/init_project.rb +2 -0
- data/lib/luo/projects/init.rb +1 -7
- data/lib/luo/projects/luo.ipynb +89 -6
- data/lib/luo/version.rb +1 -1
- data/luo +8 -13
- metadata +1 -2
- data/.ipynb_checkpoints/luo-checkpoint.ipynb +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f0041ac90d5a47bfaa129bc877e38a350e0bdf757a6ea8d1da945ec2af83864
|
4
|
+
data.tar.gz: fafb2c21415dbe6a5fbcf1ab21477e9ef580b3122ea35c3f333d2bb1a370555b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db9272f29f87859e3c364240b7ec586966ffe230ae951c56d6457f64c929e1eedacd4176cde01c6fc33489bea169bad26756d39640802ce41441c86629e02db5
|
7
|
+
data.tar.gz: 6b279cdfb131e7042ec94ea9b12f09c7bf3012ad782d0cd8a84b98ec197470ef78bb03776c046f3ab54d7f6382cd4e5a3825288224ef6f80fc9ac8dd720a16b8
|
data/Gemfile.lock
CHANGED
data/README.zh.md
CHANGED
@@ -3,19 +3,20 @@
|
|
3
3
|
|
4
4
|
## 安装
|
5
5
|
|
6
|
-
###
|
6
|
+
### ruby 原生(不推荐)
|
7
7
|
```
|
8
8
|
gem install luo
|
9
9
|
```
|
10
10
|
|
11
|
-
###
|
12
|
-
|
11
|
+
### docker (推荐)
|
12
|
+
1. 安装docker
|
13
13
|
|
14
14
|
```
|
15
|
-
|
15
|
+
docker pull ghcr.io/mjason/luo:latest
|
16
|
+
# 把下面这句话添加到 ~/.bashrc 或者 ~/.zshrc
|
17
|
+
alias luo='docker run --rm -it -p 8888:8888 -v "$PWD:/workdir" ghcr.io/mjason/luo:latest'
|
16
18
|
```
|
17
19
|
|
18
|
-
|
19
20
|
## 环境变量说明
|
20
21
|
```Bash
|
21
22
|
OPENAI_ACCESS_TOKEN= # OpenAI的访问令牌
|
@@ -34,7 +35,7 @@ XINGHUO_ACCESS_TOKEN= # 星火大模型的访问令牌
|
|
34
35
|
2. cd demo
|
35
36
|
3. luo init
|
36
37
|
4. 修改 .env 的环境变量
|
37
|
-
5.
|
38
|
+
5. luo r
|
38
39
|
|
39
40
|
### Messages 说明
|
40
41
|
```ruby
|
data/lib/luo/init_project.rb
CHANGED
data/lib/luo/projects/init.rb
CHANGED
data/lib/luo/projects/luo.ipynb
CHANGED
@@ -12,7 +12,9 @@
|
|
12
12
|
"cell_type": "code",
|
13
13
|
"execution_count": 1,
|
14
14
|
"id": "785fea13-bdfb-4bc6-80e7-1c53d8ca2f84",
|
15
|
-
"metadata": {
|
15
|
+
"metadata": {
|
16
|
+
"tags": []
|
17
|
+
},
|
16
18
|
"outputs": [
|
17
19
|
{
|
18
20
|
"data": {
|
@@ -27,12 +29,14 @@
|
|
27
29
|
],
|
28
30
|
"source": [
|
29
31
|
"# 初始化运行环境\n",
|
30
|
-
"require_relative \"init\""
|
32
|
+
"require_relative \"init\"\n",
|
33
|
+
"require 'pry'\n",
|
34
|
+
"IRuby::Kernel.instance.switch_backend!(:pry)"
|
31
35
|
]
|
32
36
|
},
|
33
37
|
{
|
34
38
|
"cell_type": "code",
|
35
|
-
"execution_count":
|
39
|
+
"execution_count": 2,
|
36
40
|
"id": "87d49a44-a485-4331-b982-6a9143490771",
|
37
41
|
"metadata": {
|
38
42
|
"tags": []
|
@@ -44,7 +48,7 @@
|
|
44
48
|
"Luo::XinghuoFinalAgent"
|
45
49
|
]
|
46
50
|
},
|
47
|
-
"execution_count":
|
51
|
+
"execution_count": 2,
|
48
52
|
"metadata": {},
|
49
53
|
"output_type": "execute_result"
|
50
54
|
}
|
@@ -59,8 +63,87 @@
|
|
59
63
|
},
|
60
64
|
{
|
61
65
|
"cell_type": "code",
|
62
|
-
"execution_count":
|
66
|
+
"execution_count": 4,
|
63
67
|
"id": "3b2b57cf-332e-4f4e-8b54-ee35950a0501",
|
68
|
+
"metadata": {
|
69
|
+
"tags": []
|
70
|
+
},
|
71
|
+
"outputs": [
|
72
|
+
{
|
73
|
+
"data": {
|
74
|
+
"text/plain": [
|
75
|
+
":input"
|
76
|
+
]
|
77
|
+
},
|
78
|
+
"execution_count": 4,
|
79
|
+
"metadata": {},
|
80
|
+
"output_type": "execute_result"
|
81
|
+
}
|
82
|
+
],
|
83
|
+
"source": [
|
84
|
+
"$runner = Runner.new\n",
|
85
|
+
"\n",
|
86
|
+
"def input(text)\n",
|
87
|
+
" context = $runner.call(text)\n",
|
88
|
+
" Helpers.print_md <<~MD\n",
|
89
|
+
" ## Input:\n",
|
90
|
+
" #{text}\n",
|
91
|
+
"\n",
|
92
|
+
" ## Response:\n",
|
93
|
+
" #{context.response}\n",
|
94
|
+
"\n",
|
95
|
+
" ## Final Result:\n",
|
96
|
+
" #{context.final_result}\n",
|
97
|
+
"\n",
|
98
|
+
" ## History:\n",
|
99
|
+
" ```ruby\n",
|
100
|
+
" #{context.histories.to_a}\n",
|
101
|
+
" ```\n",
|
102
|
+
" MD\n",
|
103
|
+
" puts \"\\n\\n\\n\"\n",
|
104
|
+
"end"
|
105
|
+
]
|
106
|
+
},
|
107
|
+
{
|
108
|
+
"cell_type": "code",
|
109
|
+
"execution_count": 5,
|
110
|
+
"id": "3add85ed-2b49-4a5b-b625-eaf915825050",
|
111
|
+
"metadata": {
|
112
|
+
"tags": []
|
113
|
+
},
|
114
|
+
"outputs": [
|
115
|
+
{
|
116
|
+
"name": "stdout",
|
117
|
+
"output_type": "stream",
|
118
|
+
"text": [
|
119
|
+
"** call aiui weather **\n",
|
120
|
+
" Input:\n",
|
121
|
+
" 明天的天气怎么样\n",
|
122
|
+
"\n",
|
123
|
+
" Response:\n",
|
124
|
+
" 调用工具:天气查询。\n",
|
125
|
+
"\n",
|
126
|
+
" Final Result:\n",
|
127
|
+
" 明天北京市全天多云,气温16℃ ~ 28℃,空气质量良,有南风微风,气候温暖。\n",
|
128
|
+
"\n",
|
129
|
+
" History:\n",
|
130
|
+
" [{:role=>\"user\", :content=>\"明天的天气怎么样\"}, {:role=>\"assistant\", \n",
|
131
|
+
" :content=>\"明天北京市全天多云,气温16℃ ~ \n",
|
132
|
+
" 28℃,空气质量良,有南风微风,气候温暖。\"}]\n",
|
133
|
+
"\n",
|
134
|
+
"\n",
|
135
|
+
"\n"
|
136
|
+
]
|
137
|
+
}
|
138
|
+
],
|
139
|
+
"source": [
|
140
|
+
"input \"明天的天气怎么样\""
|
141
|
+
]
|
142
|
+
},
|
143
|
+
{
|
144
|
+
"cell_type": "code",
|
145
|
+
"execution_count": null,
|
146
|
+
"id": "ca165db3-1711-41c3-85eb-3f7f02d04e0a",
|
64
147
|
"metadata": {},
|
65
148
|
"outputs": [],
|
66
149
|
"source": []
|
@@ -68,7 +151,7 @@
|
|
68
151
|
],
|
69
152
|
"metadata": {
|
70
153
|
"kernelspec": {
|
71
|
-
"display_name": "Ruby 3.2.
|
154
|
+
"display_name": "Ruby 3.2.2",
|
72
155
|
"language": "ruby",
|
73
156
|
"name": "ruby"
|
74
157
|
},
|
data/lib/luo/version.rb
CHANGED
data/luo
CHANGED
@@ -1,19 +1,14 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
#docker run --rm -it \
|
10
|
-
# -v "$PWD:/workdir" \
|
11
|
-
# -v "$PWD/bundle_gems:/usr/local/bundle/" \
|
12
|
-
# ghcr.io/mjason/luo:latest \
|
13
|
-
# "$@"
|
3
|
+
if [[ $1 == "update" ]]; then
|
4
|
+
echo "Pulling the latest Docker image..."
|
5
|
+
docker pull ghcr.io/mjason/luo:latest
|
6
|
+
fi
|
7
|
+
|
8
|
+
echo "Running the Docker container..."
|
14
9
|
|
15
|
-
# 性能高
|
16
10
|
docker run --rm -it \
|
11
|
+
-p 8888:8888 \
|
17
12
|
-v "$PWD:/workdir" \
|
18
13
|
ghcr.io/mjason/luo:latest \
|
19
|
-
"$@"
|
14
|
+
"$@"
|
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.
|
4
|
+
version: 0.1.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MJ
|
@@ -180,7 +180,6 @@ files:
|
|
180
180
|
- ".idea/misc.xml"
|
181
181
|
- ".idea/modules.xml"
|
182
182
|
- ".idea/vcs.xml"
|
183
|
-
- ".ipynb_checkpoints/luo-checkpoint.ipynb"
|
184
183
|
- ".rspec"
|
185
184
|
- Dockerfile
|
186
185
|
- Gemfile
|
@@ -1,84 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "markdown",
|
5
|
-
"id": "ac60deeb-0d75-478e-823a-dfe39e73aa72",
|
6
|
-
"metadata": {},
|
7
|
-
"source": [
|
8
|
-
"欢迎使用luo实验室"
|
9
|
-
]
|
10
|
-
},
|
11
|
-
{
|
12
|
-
"cell_type": "code",
|
13
|
-
"execution_count": 1,
|
14
|
-
"id": "785fea13-bdfb-4bc6-80e7-1c53d8ca2f84",
|
15
|
-
"metadata": {},
|
16
|
-
"outputs": [
|
17
|
-
{
|
18
|
-
"data": {
|
19
|
-
"text/plain": [
|
20
|
-
"true"
|
21
|
-
]
|
22
|
-
},
|
23
|
-
"execution_count": 1,
|
24
|
-
"metadata": {},
|
25
|
-
"output_type": "execute_result"
|
26
|
-
}
|
27
|
-
],
|
28
|
-
"source": [
|
29
|
-
"# 初始化运行环境\n",
|
30
|
-
"require_relative \"init\""
|
31
|
-
]
|
32
|
-
},
|
33
|
-
{
|
34
|
-
"cell_type": "code",
|
35
|
-
"execution_count": 6,
|
36
|
-
"id": "87d49a44-a485-4331-b982-6a9143490771",
|
37
|
-
"metadata": {
|
38
|
-
"tags": []
|
39
|
-
},
|
40
|
-
"outputs": [
|
41
|
-
{
|
42
|
-
"data": {
|
43
|
-
"text/plain": [
|
44
|
-
"Luo::XinghuoFinalAgent"
|
45
|
-
]
|
46
|
-
},
|
47
|
-
"execution_count": 6,
|
48
|
-
"metadata": {},
|
49
|
-
"output_type": "execute_result"
|
50
|
-
}
|
51
|
-
],
|
52
|
-
"source": [
|
53
|
-
"class Runner < XinghuoAgentRunner\n",
|
54
|
-
" register WeatherAgent\n",
|
55
|
-
" register TimeAgent\n",
|
56
|
-
" register XinghuoFinalAgent\n",
|
57
|
-
"end"
|
58
|
-
]
|
59
|
-
},
|
60
|
-
{
|
61
|
-
"cell_type": "code",
|
62
|
-
"execution_count": null,
|
63
|
-
"id": "3b2b57cf-332e-4f4e-8b54-ee35950a0501",
|
64
|
-
"metadata": {},
|
65
|
-
"outputs": [],
|
66
|
-
"source": []
|
67
|
-
}
|
68
|
-
],
|
69
|
-
"metadata": {
|
70
|
-
"kernelspec": {
|
71
|
-
"display_name": "Ruby 3.2.1",
|
72
|
-
"language": "ruby",
|
73
|
-
"name": "ruby"
|
74
|
-
},
|
75
|
-
"language_info": {
|
76
|
-
"file_extension": ".rb",
|
77
|
-
"mimetype": "application/x-ruby",
|
78
|
-
"name": "ruby",
|
79
|
-
"version": "3.2.1"
|
80
|
-
}
|
81
|
-
},
|
82
|
-
"nbformat": 4,
|
83
|
-
"nbformat_minor": 5
|
84
|
-
}
|