gpt-function 0.1.0
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 +7 -0
- data/README.md +51 -0
- metadata +47 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 03c69d609f72da6694cb8dd2c81ad8e22a43eef447f5579df9376e1275c20816
|
4
|
+
data.tar.gz: 8e2e07edf55e59fa81bbe00e6f10a39e190926a312f30e038b216d4e1c50149c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 51f4d097f90ee274e6a4d199ba6bca2f4d2050a6aab67e07597596d745711c8f1001000b489e3a7fce00d0b7da8232806fa5c0da20d419af87ff77d3c437e104
|
7
|
+
data.tar.gz: cdb7ab8b59f152c8a3f59b5944abdc6473a664f80a68027895d76db5bb2b403e8bbec6a24f0ffa24beb76ecc477ee4043dd9ff4422bfcb786d1f9888a1baf68c
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Gpt::Function
|
2
|
+
|
3
|
+
這個套件支援你在 Ruby 程式中使用 GPT 函數。
|
4
|
+
|
5
|
+
你可以確保每次呼叫 GPT 函數時,都會得到相同的結果。
|
6
|
+
|
7
|
+
目前能夠使用的模型有:
|
8
|
+
|
9
|
+
- gpt-4-1106-preview
|
10
|
+
- gpt-3.5-turbo-1106
|
11
|
+
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
...
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
# 在你的 Ruby 程式中引入 'gpt-function' Gem
|
21
|
+
require 'gpt-function'
|
22
|
+
|
23
|
+
# 你需要設定你的 api key 和 model name
|
24
|
+
Gpt::Function.configure(api_key: '...', model: 'gpt-3.5-turbo-1106')
|
25
|
+
|
26
|
+
# 創建一個簡單的 GPT 函數,你需要描述這個函數的功能,以及提供一些範例
|
27
|
+
translater = Gpt::Function.new("請翻譯成繁體中文", [["apple", "蘋果"]])
|
28
|
+
|
29
|
+
# 然後就可以使用這個函數了
|
30
|
+
result = translater.call("apple")
|
31
|
+
|
32
|
+
# 回傳的結果型別會參考範例的型別
|
33
|
+
puts result # "蘋果"
|
34
|
+
|
35
|
+
# 一個較複雜的 GPT 函數,用於擷取關鍵字
|
36
|
+
keywords_extractor = Gpt::Function.new("請擷取出所有關鍵字", [
|
37
|
+
[
|
38
|
+
"藍白合「難產」!游盈隆認定「平手」 稱解套辦法就是「再做一次民調」",
|
39
|
+
["藍白合", "難產", "游盈隆", "解套", "民調"]
|
40
|
+
]
|
41
|
+
]
|
42
|
+
)
|
43
|
+
result = keywords_extractor.call("藍白「3%各表」翻臉倒數?學者曝1關鍵指標")
|
44
|
+
|
45
|
+
# 可以看到回傳的型別是陣列
|
46
|
+
puts result # ["藍白", "3%各表", "翻臉", "關鍵指標"]
|
47
|
+
```
|
48
|
+
|
49
|
+
## License
|
50
|
+
|
51
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gpt-function
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- etrex kuo
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-11-18 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: This gem allows users to create simple and complex GPT functions for
|
14
|
+
various applications such as translation and keyword extraction.
|
15
|
+
email:
|
16
|
+
- et284vu065k3@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- README.md
|
22
|
+
homepage: https://github.com/etrex/gpt-function
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata:
|
26
|
+
homepage_uri: https://github.com/etrex/gpt-function
|
27
|
+
source_code_uri: https://github.com/etrex/gpt-function
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.6.0
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubygems_version: 3.4.10
|
44
|
+
signing_key:
|
45
|
+
specification_version: 4
|
46
|
+
summary: A Ruby gem for creating simple GPT-based functions.
|
47
|
+
test_files: []
|