cpee-llm 1.0.6 → 1.2.2
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/LICENSE +668 -159
- data/README.md +15 -0
- data/cpee-llm.gemspec +3 -3
- data/lib/cpee/llm/dataflow.rb +3 -3
- data/lib/cpee/llm/functions.rb +80 -77
- data/lib/cpee/llm/implementation.rb +43 -17
- data/lib/cpee/llm/implementation.xml +41 -7
- data/lib/cpee/llm/prompts/system/adapt_mermaid.txt +12 -0
- data/lib/cpee/llm/prompts/system/adapt_xml_documentation.txt +50 -0
- data/lib/cpee/llm/prompts/system/adapt_xml_endpoints.txt +80 -0
- data/lib/cpee/llm/prompts/{dataflow.txt → system/dataflow.txt} +13 -25
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/arguments.txt +8 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/color_palette.txt +10 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/description.txt +3 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/documentation.txt +35 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/exclusive_gateway.txt +7 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/finalize.txt +2 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/inclusive_gateway.txt +2 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/loop.txt +7 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/method.txt +6 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/parallel_gateway.txt +6 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/pause.txt +4 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/pause_insertion.txt +3 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/script_task.txt +5 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/sequence.txt +2 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/service_task.txt +20 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml/variables.txt +3 -0
- data/lib/cpee/llm/prompts/system/fragments/cpee_xml.txt +15 -0
- data/lib/cpee/llm/prompts/system/fragments/data_references.txt +14 -0
- data/lib/cpee/llm/prompts/system/fragments/endpoint_naming.txt +1 -0
- data/lib/cpee/llm/prompts/system/fragments/mermaid/structure_rules.txt +29 -0
- data/lib/cpee/llm/prompts/system/fragments/mermaid/syntax.txt +22 -0
- data/lib/cpee/llm/prompts/system/fragments/numeric_conversion.txt +5 -0
- data/lib/cpee/llm/prompts/system/fragments/service_registry.txt +6 -0
- data/lib/cpee/llm/prompts/system/fragments/unmatched_tasks.txt +4 -0
- data/lib/cpee/llm/prompts/system/generate_mermaid.txt +40 -0
- data/lib/cpee/llm/prompts/system/generate_mermaid_endpoints.txt +82 -0
- data/lib/cpee/llm/prompts/system/intent.txt +45 -0
- data/lib/cpee/llm/prompts/{validate_xml.txt → system/validate_xml.txt} +15 -0
- data/lib/cpee/llm/prompts/user/adapt.txt +8 -0
- data/lib/cpee/llm/prompts/user/adapt_xml_endpoints.txt +11 -0
- data/lib/cpee/llm/prompts/user/dataflow.txt +9 -0
- data/lib/cpee/llm/prompts/user/describe_text.txt +4 -0
- data/lib/cpee/llm/prompts/user/generate_mermaid.txt +5 -0
- data/lib/cpee/llm/prompts/user/generate_mermaid_endpoints.txt +9 -0
- data/lib/cpee/llm/prompts/user/intent.txt +17 -0
- data/lib/cpee/llm/prompts/user/validate_xml.txt +5 -0
- data/lib/cpee/llm/rubyllm_requests.rb +71 -119
- data/server/connect_gemini +1 -1
- data/server/connect_gpt +1 -1
- data/server/connect_morpheus +1 -1
- data/server/{cpee-llm → llm} +5 -4
- data/server/plugins.json +51 -0
- data/tools/cpee-llm +3 -3
- data/tools/cpee-llm-tool +4 -4
- metadata +46 -17
- data/lib/cpee/llm/prompts/adapt_docxml_description.txt +0 -131
- data/lib/cpee/llm/prompts/adapt_xml_endpoints.txt +0 -157
- data/lib/cpee/llm/prompts/apply.txt +0 -32
- data/lib/cpee/llm/prompts/derive.txt +0 -28
- data/lib/cpee/llm/prompts/gemini-request.json +0 -18
- data/lib/cpee/llm/prompts/generate1.txt +0 -90
- data/lib/cpee/llm/prompts/generate_enpoints.txt +0 -132
- data/lib/cpee/llm/prompts/generate_enpoints1.txt +0 -155
- data/lib/cpee/llm/prompts/identify.txt +0 -25
- data/lib/cpee/llm/prompts/validate_mermaid.xml +0 -74
- /data/lib/cpee/llm/prompts/{describe.txt → system/describe_text.txt} +0 -0
- /data/server/{cpee-llm.conf → llm.conf} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Consider the following process description:
|
|
2
|
+
|
|
3
|
+
%%%user_input
|
|
4
|
+
|
|
5
|
+
... and consider the the provided endpoint list:
|
|
6
|
+
|
|
7
|
+
%%%endpoints
|
|
8
|
+
|
|
9
|
+
Interpret the process description as business intent and generate an executable BPMN model in Mermaid.js format using only the available endpoint capabilities.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Consider the following user input:
|
|
2
|
+
|
|
3
|
+
%%%user_input
|
|
4
|
+
|
|
5
|
+
Consider the following list of plugins
|
|
6
|
+
|
|
7
|
+
%%%plugins
|
|
8
|
+
|
|
9
|
+
If appropriate, select a plugin, and return its id as json, e.g., { "id": 123 }.
|
|
10
|
+
If a plugin is appropriate for a part of the text, replace the text with %%% and return it as part of the json, e.g., { "id": 123, "input": "Some text. %%%. Some more text." }.
|
|
11
|
+
If nothing seems suitable return "null". This includes cases where the user input
|
|
12
|
+
does not convey any intent about creating, adding to, or modifying a process
|
|
13
|
+
model at all, e.g. "what is the weather today", "2+2", or "12".
|
|
14
|
+
If it seems like the text is just for creating or modifying a process model
|
|
15
|
+
return "{}". This includes creating, updating, or modifying a task, event, or
|
|
16
|
+
gateway, changing the documentation of a task, or adding or changing
|
|
17
|
+
information in any field of a task, e.g. "make task a2 pink".
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
# This file is part of CPEE-LLM.
|
|
2
2
|
#
|
|
3
3
|
# CPEE-LLM is free software: you can redistribute it and/or modify it under the
|
|
4
|
-
# terms of the GNU
|
|
4
|
+
# terms of the GNU General Public License as published by the Free
|
|
5
5
|
# Software Foundation, either version 3 of the License, or (at your option) any
|
|
6
6
|
# later version.
|
|
7
7
|
#
|
|
8
8
|
# CPEE-LLM is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
9
9
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
10
|
-
# A PARTICULAR PURPOSE. See the GNU
|
|
10
|
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
11
11
|
# details.
|
|
12
12
|
#
|
|
13
|
-
# You should have received a copy of the GNU
|
|
13
|
+
# You should have received a copy of the GNU General Public License
|
|
14
14
|
# along with CPEE-LLM (file LICENSE in the main directory). If not, see
|
|
15
15
|
# <http://www.gnu.org/licenses/>.
|
|
16
16
|
|
|
17
17
|
require 'ruby_llm'
|
|
18
18
|
require 'typhoeus'
|
|
19
19
|
require 'json'
|
|
20
|
+
require 'mime/types'
|
|
21
|
+
require 'securerandom'
|
|
20
22
|
|
|
21
23
|
module CPEE
|
|
22
24
|
|
|
23
25
|
module LLM
|
|
24
26
|
|
|
25
|
-
#
|
|
26
|
-
class LLMError < StandardError
|
|
27
|
+
# custom llm error class #{{{
|
|
28
|
+
class LLMError < StandardError
|
|
27
29
|
attr_reader :http_response
|
|
28
30
|
def initialize(message = "Something went wrong", http_response = 500)
|
|
29
31
|
@http_response = http_response
|
|
@@ -35,141 +37,91 @@ module CPEE
|
|
|
35
37
|
|
|
36
38
|
def connect_llm(myllm,llms) #{{{
|
|
37
39
|
chat = nil
|
|
38
|
-
RubyLLM.
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
context = RubyLLM.context
|
|
41
|
+
config = context.config
|
|
42
|
+
config.request_timeout = llms[:request_timeout]
|
|
43
|
+
config.max_retries = llms[:max_retries]
|
|
44
|
+
|
|
45
|
+
llms[:connectors].each do |k,v|
|
|
46
|
+
if myllm =~ /#{k}/ && chat.nil?
|
|
47
|
+
chat = eval(v)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
if chat.nil?
|
|
52
|
+
raise LLMError.new("Selected LLM model does not exist or is not supported. Please, select another LLM model.", 400)
|
|
53
|
+
end
|
|
54
|
+
return chat
|
|
55
|
+
end #}}}
|
|
41
56
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
def build_system_prompt(name) #{{{
|
|
58
|
+
expand_system_includes(File.read(File.join(__dir__,"prompts","system",name)),[name])
|
|
59
|
+
end #}}}
|
|
60
|
+
|
|
61
|
+
# replaces %%%file lines recursively, seen guards against include cycles
|
|
62
|
+
def expand_system_includes(sp,seen) #{{{
|
|
63
|
+
sp.gsub(/(^|\n)[\t ]*%%%([^\n]+)(\n|$)/) do |e|
|
|
64
|
+
b = $1
|
|
65
|
+
m = $2.strip
|
|
66
|
+
a = $3
|
|
67
|
+
f = File.join(__dir__,"prompts","system",m)
|
|
68
|
+
if File.exist?(f) && !seen.include?(m)
|
|
69
|
+
"#{a}#{expand_system_includes(File.read(f),seen + [m])}#{b}"
|
|
70
|
+
else
|
|
71
|
+
"#{a}#{b}"
|
|
46
72
|
end
|
|
73
|
+
end
|
|
74
|
+
end #}}}
|
|
47
75
|
|
|
48
|
-
|
|
49
|
-
|
|
76
|
+
def build_user_prompt(name,opts) #{{{
|
|
77
|
+
sp = File.read(File.join(__dir__,"prompts","user",name))
|
|
78
|
+
sp.gsub!(/(^|\n)[\t ]*%%%([^\n]+)(\n|$)/) do |e|
|
|
79
|
+
b = $1
|
|
80
|
+
m = $2.to_sym
|
|
81
|
+
a = $3
|
|
82
|
+
if opts[m]
|
|
83
|
+
"#{a}#{opts[m]}#{b}"
|
|
84
|
+
else
|
|
85
|
+
"#{a}#{b}"
|
|
50
86
|
end
|
|
51
87
|
end
|
|
52
|
-
|
|
88
|
+
sp
|
|
53
89
|
end #}}}
|
|
54
90
|
|
|
55
|
-
def generate_content(myllm, system_prompt, user_prompt, max_tokens, temperature, llms) #{{{
|
|
91
|
+
def generate_content(myllm, system_prompt, user_prompt, max_tokens, temperature, llms, opts={}, documents=[]) #{{{
|
|
92
|
+
temperature = temperature.nil? ? 0.1 : temperature.to_f
|
|
56
93
|
chat = connect_llm(myllm,llms)
|
|
57
94
|
chat.with_instructions system_prompt
|
|
58
95
|
chat.with_temperature(temperature)
|
|
59
96
|
if max_tokens != 0
|
|
60
97
|
if myllm.include?("gemini")
|
|
61
|
-
|
|
98
|
+
opts[:generationConfig] = { maxOutputTokens: max_tokens }
|
|
99
|
+
opts[:generationConfig].merge!(response_mime_type: 'application/json') if opts[:json]
|
|
62
100
|
elsif myllm.include?("gpt")
|
|
63
|
-
|
|
101
|
+
opts[:max_completion_tokens] = max_tokens
|
|
102
|
+
opts[:response_format] = { type: "json_object" } if opts[:json]
|
|
64
103
|
else
|
|
65
|
-
|
|
104
|
+
opts[:max_tokens] = max_tokens
|
|
66
105
|
end
|
|
67
106
|
end
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
chat.
|
|
81
|
-
chat.with_instructions system_prompt
|
|
82
|
-
chat.with_temperature(temperature)
|
|
83
|
-
response = chat.ask user_prompt
|
|
84
|
-
#puts JSON.parse(response.content)
|
|
107
|
+
opts.delete(:json)
|
|
108
|
+
chat.with_params **opts
|
|
109
|
+
message = RubyLLM::Content.new(user_prompt)
|
|
110
|
+
documents.each do |doc|
|
|
111
|
+
filename = doc.filename
|
|
112
|
+
if (filename.nil? || filename.empty?) && !doc.mimetype.to_s.empty?
|
|
113
|
+
extension = MIME::Types[doc.mimetype].first&.extensions&.first
|
|
114
|
+
filename = SecureRandom.hex(8)
|
|
115
|
+
filename += ".#{extension}" if extension
|
|
116
|
+
end
|
|
117
|
+
message.add_attachment(doc.value, filename:)
|
|
118
|
+
end
|
|
119
|
+
response = chat.ask message
|
|
85
120
|
return response.content
|
|
86
121
|
rescue Faraday::TimeoutError => e
|
|
87
122
|
raise LLMError.new(e.message, 504)
|
|
88
123
|
rescue Exception => e
|
|
89
124
|
raise LLMError.new(e.message, 500)
|
|
90
|
-
end #}}}
|
|
91
|
-
|
|
92
|
-
def generate_mermaid_model(llm, user_input, temperature, llms={}) #{{{
|
|
93
|
-
max_tokens = 4000
|
|
94
|
-
temperature = temperature.nil? ? 0.1 : temperature.to_f
|
|
95
|
-
system_prompt = File.read(File.join(__dir__,"prompts/generate1.txt"))
|
|
96
|
-
user_prompt = "Consider following process description: #{user_input}. Generate a BPMN model in Mermaid.js format."
|
|
97
|
-
new_mermaid = generate_content(llm,system_prompt,user_prompt,max_tokens,temperature,llms)
|
|
98
|
-
return new_mermaid
|
|
99
|
-
end #}}}
|
|
100
|
-
|
|
101
|
-
def adapt_mermaid_model(llm, user_input, process_model, llms={}) #{{{
|
|
102
|
-
max_tokens = 4000
|
|
103
|
-
temperature = 0
|
|
104
|
-
system_prompt = File.read(File.join(__dir__,"prompts/apply.txt"))
|
|
105
|
-
user_prompt = "Consider following process model: #{process_model}. Update this process model according to provided changes #{user_input}."
|
|
106
|
-
new_mermaid = generate_content(llm,system_prompt,user_prompt,max_tokens,temperature,llms)
|
|
107
|
-
return new_mermaid
|
|
108
|
-
end #}}}
|
|
109
|
-
|
|
110
|
-
def adapt_docxml_description(llm, user_input, process_model, llms={}) #{{{
|
|
111
|
-
max_tokens = 20000
|
|
112
|
-
temperature = 0
|
|
113
|
-
system_prompt = File.read(File.join(__dir__,"prompts/adapt_docxml_description.txt"))
|
|
114
|
-
user_prompt = "Consider following process model: #{process_model}. Update this process model according to provided changes #{user_input}."
|
|
115
|
-
new_cpee = generate_content(llm,system_prompt,user_prompt,max_tokens,temperature,llms)
|
|
116
|
-
return new_cpee
|
|
117
|
-
end #}}}
|
|
118
|
-
|
|
119
|
-
def adapt_xml_model(llm, user_input, process_model, api_specification, llms={}) #{{{
|
|
120
|
-
max_tokens = 20000
|
|
121
|
-
temperature = 0
|
|
122
|
-
system_prompt = File.read(File.join(__dir__,"prompts/adapt_xml_endpoints.txt"))
|
|
123
|
-
user_prompt = "Consider following process model: #{process_model.to_s} and task specification #{api_specification} with endpoint data. Update this process model according to provided changes #{user_input}."
|
|
124
|
-
new_cpee = generate_content(llm,system_prompt,user_prompt,max_tokens,temperature,llms)
|
|
125
|
-
return new_cpee
|
|
126
|
-
end #}}}
|
|
127
|
-
|
|
128
|
-
def generate_plain_text(llm, user_input, llms={}) #{{{
|
|
129
|
-
max_tokens = 4000
|
|
130
|
-
temperature = 0
|
|
131
|
-
system_prompt = File.read(File.join(__dir__,"prompts/describe.txt"))
|
|
132
|
-
user_prompt = "Consider following process process model: #{user_input}. Generate a text describing provided process description."
|
|
133
|
-
process_description = generate_content(llm,system_prompt,user_prompt,max_tokens,temperature,llms)
|
|
134
|
-
return process_description
|
|
135
|
-
end #}}}
|
|
136
|
-
|
|
137
|
-
def generate_generic_content(llm, user_input, system_prompt, json, temperature, llms={}) #{{{
|
|
138
|
-
max_tokens = 20000
|
|
139
|
-
temperature = temperature.nil? ? 0 : temperature.to_f
|
|
140
|
-
if json == 'true'
|
|
141
|
-
process_description = generate_json_content(llm,system_prompt,user_input,max_tokens,temperature,llms)
|
|
142
|
-
else
|
|
143
|
-
process_description = generate_content(llm,system_prompt,user_input,max_tokens,temperature,llms)
|
|
144
|
-
end
|
|
145
|
-
return process_description
|
|
146
|
-
end #}}}
|
|
147
|
-
|
|
148
|
-
def generate_dataflow_content(llm, mermaid_model, api_specification, llms={}) #{{{
|
|
149
|
-
max_tokens = 10000
|
|
150
|
-
temperature = 0.1
|
|
151
|
-
system_prompt = File.read(File.join(__dir__,"prompts/dataflow.txt"))
|
|
152
|
-
user_prompt = "Given process mode #{mermaid_model} and task specification #{api_specification} with endpoint data, define the execution context and return a JSON specification."
|
|
153
|
-
dataflow = generate_content(llm,system_prompt,user_prompt,max_tokens,temperature,llms)
|
|
154
|
-
return dataflow
|
|
155
|
-
end #}}}
|
|
156
|
-
|
|
157
|
-
def generate_endpoint_mermaid_model(llm, user_input, endpoints, llms={}) #{{{
|
|
158
|
-
max_tokens = 4000
|
|
159
|
-
temperature = 0.1
|
|
160
|
-
system_prompt = File.read(File.join(__dir__,"prompts/generate_enpoints.txt"))
|
|
161
|
-
user_prompt = "Consider the following process description: #{user_input} and the provided endpoint list: #{endpoints}. Interpret the process description as business intent and generate an executable BPMN model in Mermaid.js format using only the available endpoint capabilities."
|
|
162
|
-
new_mermaid = generate_content(llm,system_prompt,user_prompt,max_tokens,temperature,llms)
|
|
163
|
-
return new_mermaid
|
|
164
|
-
end #}}}
|
|
165
|
-
|
|
166
|
-
def validate_xml_model(llm, cpee_model, llms={}) #{{{
|
|
167
|
-
max_tokens = 0
|
|
168
|
-
temperature = 0.1
|
|
169
|
-
system_prompt = File.read(File.join(__dir__,"prompts/validate_xml.txt"))
|
|
170
|
-
user_prompt = "Consider following CPEE XML promcess model created by autobpmn.ai: #{cpee_model}. Repair the model so that it becomes executable. Return only the repaired XML without any comments or markdown formatting."
|
|
171
|
-
repaired_cpee = generate_content(llm,system_prompt,user_prompt,max_tokens,temperature,llms)
|
|
172
|
-
return repaired_cpee
|
|
173
125
|
end #}}}
|
|
174
126
|
|
|
175
127
|
end
|
data/server/connect_gemini
CHANGED
data/server/connect_gpt
CHANGED
data/server/connect_morpheus
CHANGED
|
@@ -2,4 +2,4 @@ config.openai_api_key = 'insert your key here'
|
|
|
2
2
|
config.openai_api_base = "https://morpheus.cit.tum.de/api/v1"
|
|
3
3
|
config.openai_use_system_role = true
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
context.chat(model: myllm,provider: :openai,assume_model_exists: true)
|
data/server/{cpee-llm → llm}
RENAMED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
# This file is part of CPEE-LLM.
|
|
4
4
|
#
|
|
5
5
|
# CPEE-LLM is free software: you can redistribute it and/or modify it under the
|
|
6
|
-
# terms of the GNU
|
|
6
|
+
# terms of the GNU General Public License as published by the Free
|
|
7
7
|
# Software Foundation, either version 3 of the License, or (at your option) any
|
|
8
8
|
# later version.
|
|
9
9
|
#
|
|
10
10
|
# CPEE-LLM is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
11
11
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
12
|
-
# A PARTICULAR PURPOSE. See the GNU
|
|
12
|
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
13
13
|
# details.
|
|
14
14
|
#
|
|
15
|
-
# You should have received a copy of the GNU
|
|
15
|
+
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# along with CPEE-LLM (file LICENSE in the main directory). If not, see
|
|
17
17
|
# <http://www.gnu.org/licenses/>.
|
|
18
18
|
|
|
@@ -26,7 +26,7 @@ end
|
|
|
26
26
|
|
|
27
27
|
options = {
|
|
28
28
|
:host => 'localhost',
|
|
29
|
-
:port =>
|
|
29
|
+
:port => 9305,
|
|
30
30
|
:secure => false,
|
|
31
31
|
:llms => {}
|
|
32
32
|
}
|
|
@@ -38,6 +38,7 @@ Riddl::Server.new(CPEE::LLM::SERVER, options) do
|
|
|
38
38
|
@riddl_opts[:llms][:connectors].each do |k,v|
|
|
39
39
|
@riddl_opts[:llms][:connectors][k] = File.read(v)
|
|
40
40
|
end
|
|
41
|
+
@riddl_opts[:plugins] = File.join(__dir__,'plugins.json')
|
|
41
42
|
|
|
42
43
|
use CPEE::LLM::implementation(@riddl_opts)
|
|
43
44
|
end.loop!
|
data/server/plugins.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": 1,
|
|
4
|
+
"priority": 1,
|
|
5
|
+
"url": "https://echo.bpm.in.tum.de/services/llm/dnames/",
|
|
6
|
+
"description": "Use ONLY when the user wants to know whether a document exists or where it is, and plans no further operation on it (e.g. 'does the spec document exist', 'where is the process document'). A vague or generic reference (e.g. 'the process document', 'that file') still counts as a document reference, it does not need to be a specific file name. Looks up the document, extracts its url, and outputs the result directly to chat. If the input hints at any further operation on the document (analyse, extract, look at, summarize, use it to build or modify a process model, ...), do NOT use this plugin - use plugin id 2 instead.",
|
|
7
|
+
"required_input": [
|
|
8
|
+
"documents"
|
|
9
|
+
],
|
|
10
|
+
"output": "chat"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": 2,
|
|
14
|
+
"priority": 1,
|
|
15
|
+
"url": "https://echo.bpm.in.tum.de/services/llm/dnames/",
|
|
16
|
+
"description": "Use when the user wants to look up a document AND then do something further with it (analyse it, extract from it, use it to create or modify a process model, ...), e.g. 'analyse the process document and create a process from it'. A vague or generic reference (e.g. 'the process document', 'that file') still counts as a document reference, it does not need to be a specific file name. Looks up the document, extracts its url, and inserts the result back into the text so a subsequent plugin selection pass can pick up from there. If the input hints at NO further operation on the document, do NOT use this plugin - use plugin id 1 instead.",
|
|
17
|
+
"required_input": [
|
|
18
|
+
"documents"
|
|
19
|
+
],
|
|
20
|
+
"output": "reintent"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": 3,
|
|
24
|
+
"priority": 2,
|
|
25
|
+
"url": "https://echo.bpm.in.tum.de/services/llm/documents/",
|
|
26
|
+
"description": "Use ONLY when a document url is already given in the input (not a symbolic/vague document name - if only a name is given, use plugin id 2 to resolve it to a url first) AND the user just wants the document's content described or extracted, with no explicit intention to use the result to build or change the process model. Analyses, extracts from, or otherwise works on the document at the given url and outputs the textual result to chat. If the input explicitly signifies that the result should feed into creating or modifying the process model (e.g. 'and create a process from it', 'and modify the model with the result', 'add it to the model'), do NOT use this plugin - use plugin id 4 instead.",
|
|
27
|
+
"required_input": [],
|
|
28
|
+
"output_template": "%%%",
|
|
29
|
+
"output": "chat"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": 4,
|
|
33
|
+
"priority": 2,
|
|
34
|
+
"url": "https://echo.bpm.in.tum.de/services/llm/documents/",
|
|
35
|
+
"description": "Use when a document url is already given in the input (not a symbolic/vague document name - if only a name is given, use plugin id 2 to resolve it to a url first) AND the input explicitly signifies that the result should feed into creating or modifying the process model, e.g. 'and create a process from it', 'and build a model from it', 'and modify the models with the result', or 'add it to the model'. Analyses, extracts from, or otherwise works on the document at the given url and feeds the textual result back into the pipeline so it is used to create or modify the process model. If the input has no such explicit intention to affect the model, do NOT use this plugin - use plugin id 3 instead.",
|
|
36
|
+
"required_input": [],
|
|
37
|
+
"output_template": "%%%",
|
|
38
|
+
"output": "pipe"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": 5,
|
|
42
|
+
"priority": 2,
|
|
43
|
+
"url": "https://echo.bpm.in.tum.de/services/llm/stats/",
|
|
44
|
+
"description": "Answer a questions about the process model. This should relate to tasks, gateways or events, or any information contained in them. It can also relate to quantitative properties of the process, e.g. 'how many tasks'.",
|
|
45
|
+
"required_input": [
|
|
46
|
+
"model"
|
|
47
|
+
],
|
|
48
|
+
"output_template": "%%%",
|
|
49
|
+
"output": "chat"
|
|
50
|
+
}
|
|
51
|
+
]
|
data/tools/cpee-llm
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
# This file is part of CPEE-LLM.
|
|
4
4
|
#
|
|
5
5
|
# CPEE-LLM is free software: you can redistribute it and/or modify it under the
|
|
6
|
-
# terms of the GNU
|
|
6
|
+
# terms of the GNU General Public License as published by the Free
|
|
7
7
|
# Software Foundation, either version 3 of the License, or (at your option) any
|
|
8
8
|
# later version.
|
|
9
9
|
#
|
|
10
10
|
# CPEE-LLM is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
11
11
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
12
|
-
# A PARTICULAR PURPOSE. See the GNU
|
|
12
|
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
13
13
|
# details.
|
|
14
14
|
#
|
|
15
|
-
# You should have received a copy of the GNU
|
|
15
|
+
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# along with CPEE-LLM (file LICENSE in the main directory). If not, see
|
|
17
17
|
# <http://www.gnu.org/licenses/>.
|
|
18
18
|
|
data/tools/cpee-llm-tool
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
# This file is part of CPEE-LLM.
|
|
4
4
|
#
|
|
5
5
|
# CPEE-LLM is free software: you can redistribute it and/or modify it under the
|
|
6
|
-
# terms of the GNU
|
|
6
|
+
# terms of the GNU General Public License as published by the Free
|
|
7
7
|
# Software Foundation, either version 3 of the License, or (at your option) any
|
|
8
8
|
# later version.
|
|
9
9
|
#
|
|
10
10
|
# CPEE-LLM is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
11
11
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
12
|
-
# A PARTICULAR PURPOSE. See the GNU
|
|
12
|
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
13
13
|
# details.
|
|
14
14
|
#
|
|
15
|
-
# You should have received a copy of the GNU
|
|
15
|
+
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# along with CPEE-LLM (file LICENSE in the main directory). If not, see
|
|
17
17
|
# <http://www.gnu.org/licenses/>.
|
|
18
18
|
|
|
@@ -27,7 +27,7 @@ require 'typhoeus'
|
|
|
27
27
|
# ./cpee-llm-tool.rb adapt 'Add task A after dismissal review.' 'geminin-2.0-flash' 1501
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
srv = Riddl::Client.new('http://localhost:
|
|
30
|
+
srv = Riddl::Client.new('http://localhost:9305/')
|
|
31
31
|
status, res = srv.post [
|
|
32
32
|
Riddl::Parameter::Complex.new("rpst_xml","text/xml",ARGV[0] == 'adapt' ? Typhoeus.get("https://cpee.org/flow/engine/#{ARGV[2]}/properties/dslx/").response_body() : File.read('cpee_empty_example')),
|
|
33
33
|
Riddl::Parameter::Complex.new("user_input","text/plain",ARGV[1]),
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cpee-llm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nataliia Klievtsova
|
|
@@ -126,30 +126,59 @@ files:
|
|
|
126
126
|
- lib/cpee/llm/functions.rb
|
|
127
127
|
- lib/cpee/llm/implementation.rb
|
|
128
128
|
- lib/cpee/llm/implementation.xml
|
|
129
|
-
- lib/cpee/llm/prompts/
|
|
130
|
-
- lib/cpee/llm/prompts/
|
|
131
|
-
- lib/cpee/llm/prompts/
|
|
132
|
-
- lib/cpee/llm/prompts/dataflow.txt
|
|
133
|
-
- lib/cpee/llm/prompts/
|
|
134
|
-
- lib/cpee/llm/prompts/
|
|
135
|
-
- lib/cpee/llm/prompts/
|
|
136
|
-
- lib/cpee/llm/prompts/
|
|
137
|
-
- lib/cpee/llm/prompts/
|
|
138
|
-
- lib/cpee/llm/prompts/
|
|
139
|
-
- lib/cpee/llm/prompts/
|
|
140
|
-
- lib/cpee/llm/prompts/
|
|
141
|
-
- lib/cpee/llm/prompts/
|
|
129
|
+
- lib/cpee/llm/prompts/system/adapt_mermaid.txt
|
|
130
|
+
- lib/cpee/llm/prompts/system/adapt_xml_documentation.txt
|
|
131
|
+
- lib/cpee/llm/prompts/system/adapt_xml_endpoints.txt
|
|
132
|
+
- lib/cpee/llm/prompts/system/dataflow.txt
|
|
133
|
+
- lib/cpee/llm/prompts/system/describe_text.txt
|
|
134
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml.txt
|
|
135
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/arguments.txt
|
|
136
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/color_palette.txt
|
|
137
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/description.txt
|
|
138
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/documentation.txt
|
|
139
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/exclusive_gateway.txt
|
|
140
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/finalize.txt
|
|
141
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/inclusive_gateway.txt
|
|
142
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/loop.txt
|
|
143
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/method.txt
|
|
144
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/parallel_gateway.txt
|
|
145
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/pause.txt
|
|
146
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/pause_insertion.txt
|
|
147
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/script_task.txt
|
|
148
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/sequence.txt
|
|
149
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/service_task.txt
|
|
150
|
+
- lib/cpee/llm/prompts/system/fragments/cpee_xml/variables.txt
|
|
151
|
+
- lib/cpee/llm/prompts/system/fragments/data_references.txt
|
|
152
|
+
- lib/cpee/llm/prompts/system/fragments/endpoint_naming.txt
|
|
153
|
+
- lib/cpee/llm/prompts/system/fragments/mermaid/structure_rules.txt
|
|
154
|
+
- lib/cpee/llm/prompts/system/fragments/mermaid/syntax.txt
|
|
155
|
+
- lib/cpee/llm/prompts/system/fragments/numeric_conversion.txt
|
|
156
|
+
- lib/cpee/llm/prompts/system/fragments/service_registry.txt
|
|
157
|
+
- lib/cpee/llm/prompts/system/fragments/unmatched_tasks.txt
|
|
158
|
+
- lib/cpee/llm/prompts/system/generate_mermaid.txt
|
|
159
|
+
- lib/cpee/llm/prompts/system/generate_mermaid_endpoints.txt
|
|
160
|
+
- lib/cpee/llm/prompts/system/intent.txt
|
|
161
|
+
- lib/cpee/llm/prompts/system/validate_xml.txt
|
|
162
|
+
- lib/cpee/llm/prompts/user/adapt.txt
|
|
163
|
+
- lib/cpee/llm/prompts/user/adapt_xml_endpoints.txt
|
|
164
|
+
- lib/cpee/llm/prompts/user/dataflow.txt
|
|
165
|
+
- lib/cpee/llm/prompts/user/describe_text.txt
|
|
166
|
+
- lib/cpee/llm/prompts/user/generate_mermaid.txt
|
|
167
|
+
- lib/cpee/llm/prompts/user/generate_mermaid_endpoints.txt
|
|
168
|
+
- lib/cpee/llm/prompts/user/intent.txt
|
|
169
|
+
- lib/cpee/llm/prompts/user/validate_xml.txt
|
|
142
170
|
- lib/cpee/llm/rubyllm_requests.rb
|
|
143
171
|
- server/connect_gemini
|
|
144
172
|
- server/connect_gpt
|
|
145
173
|
- server/connect_morpheus
|
|
146
|
-
- server/
|
|
147
|
-
- server/
|
|
174
|
+
- server/llm
|
|
175
|
+
- server/llm.conf
|
|
176
|
+
- server/plugins.json
|
|
148
177
|
- tools/cpee-llm
|
|
149
178
|
- tools/cpee-llm-tool
|
|
150
179
|
homepage: http://github.com/etm/cpee-llm/
|
|
151
180
|
licenses:
|
|
152
|
-
-
|
|
181
|
+
- GPL-3.0-or-later
|
|
153
182
|
metadata: {}
|
|
154
183
|
rdoc_options: []
|
|
155
184
|
require_paths:
|