Skip to content

Commit 8401c5c

Browse files
author
Your Name
committed
Updates
1 parent c7bee32 commit 8401c5c

7 files changed

Lines changed: 25 additions & 0 deletions

docs/bot/ai-integrations.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ In this article, I'll describe possible AI integration flows and their purposes.
1111
* Remote AI servers
1212
* Locally AI servers
1313

14+
Types of API
15+
16+
* Assistant API from https://platform.openai.com which is fully supported and included [here](https://github.com/LiveHelperChat/chatGPT?tab=readme-ov-file#demo)
17+
* Rest API and Bot export can be found here https://github.com/LiveHelperChat/chatGPT/tree/main/doc/assistant_stream
18+
* Chat completion API which can be used with many providers with some adjustments
19+
* https://doc.livehelperchat.com/docs/bot/chatgpt-integration
20+
1421
## Remote AI services
1522

1623
These solutions include

docs/bot/chatgpt.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ Before that you will need a few things
1717
* Rest API configuration in Live Helper Chat
1818
* Bot configuration in LHC
1919

20+
# Streaming support
21+
22+
For streaming version instead of using links in instructions, use those files instead. Everything else is the same.
23+
24+
* [Rest API](/img/bot/chatgpt/open-ai-rest-api-completions-stream.json)
25+
* [Bot](/img/bot/chatgpt/open-ai-bot-completions-stream.json)
26+
27+
This configuration works only with OpenAI chat completion. For any other provider you will need to make few changes to bot and Rest API. Here is another sample which works E.g with Gemini using https://openrouter.ai
28+
29+
* [Rest API](/img/bot/chatgpt/openrouter-ai-rest-api.json)
30+
* [Bot](/img/bot/chatgpt/openrouter-gemini-bot.json)
31+
2032
# Flow with tool call support
2133

2234
The Difference from legacy is that we now support tool calls.

docs/mail/sample-mailbox.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@ You have to choose at least one matching rule for the mailbox.
5858
* If something does not work look at `Utilities` tab
5959
* You can in Utilities tab click `Reset and import` or just `Reset import status` and run cronjob again.
6060
* If nothing there read [how to see logs](debug.md#during-some-action-app-returns-white-screen-what-to-do)
61+
* You can also try to run cronjob manually. It will always try to fetch e-mails. You can look at `Utilities` tab afterward.
62+
* `php cron.php -s site_admin -c cron/mail/debug_mailbox -p <mailbox_id>`
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"bot":{"name":"ChatGTPCompletions"},"groups":[{"group":{"name":"Default","is_collapsed":0,"pos":0},"triggers":[{"trigger":{"id":2485,"name":"Default for unknown message","actions":"[{\"_id\":\"TFOVvx4HQ\",\"type\":\"typing\",\"content\":{\"text\":\"\",\"untill_message\":true,\"delay\":\"1\"}},{\"_id\":\"cvBbfqqat\",\"type\":\"restapi\",\"content\":{\"text\":\"\",\"rest_api\":95,\"rest_api_method\":\"temp1707815934109\",\"rest_api_method_params\":[],\"rest_api_method_output\":{\"temp1707816009806\":\"2486\",\"temp1707819824689\":\"2487\",\"temp1736423057534\":\"2488\",\"temp1740476556791\":\"2540\"},\"attr_options\":{\"as_system\":true,\"background_process_delegate\":true}}}]","default":1,"default_unknown":1,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]},{"trigger":{"id":2486,"name":"ChatGTP Response","actions":"[{\"_id\":\"7Ea14rw2L\",\"type\":\"text\",\"content\":{\"text\":\"{content_1}\"},\"skip_resp\":false}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]},{"trigger":{"id":2487,"name":"Failure","actions":"[{\"_id\":\"bLcR-sUVb\",\"type\":\"text\",\"content\":{\"text\":\"There was a problem with your request. I'll transfer you to an agent.\\n\",\"attr_options\":{\"json_replace\":true}}}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]},{"trigger":{"id":2488,"name":"ToolCall","actions":"[{\"_id\":\"5Ywuj8tLs\",\"type\":\"command\",\"content\":{\"text\":\"Tool call requestion\",\"attr_options\":{\"json_replace\":true,\"as_system\":true},\"command\":\"chatvariable\",\"payload\":\"{\\\"ai_action_id\\\":\\\"{content_1}\\\",\\\"ai_function_name\\\":\\\"{content_2}\\\", \\\"ai_tool_call\\\":{content_4} }\"},\"skip_resp\":false}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]},{"trigger":{"id":2489,"name":"ToolCall API","actions":"[{\"_id\":\"cvBbfqqat\",\"type\":\"restapi\",\"content\":{\"text\":\"\",\"rest_api\":95,\"rest_api_method\":\"temp1707815934109\",\"rest_api_method_params\":[],\"rest_api_method_output\":{\"temp1707816009806\":\"2486\",\"temp1707819824689\":\"2487\",\"temp1736423057534\":\"2488\",\"temp1740476556791\":\"2540\"},\"attr_options\":{\"as_system\":true,\"background_process_delegate\":true}}}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]},{"trigger":{"id":2490,"name":"password_reminder","actions":"[{\"_id\":\"HPRQ_pxev\",\"type\":\"text\",\"content\":{\"text\":\"{\\n \\\"role\\\": \\\"assistant\\\",\\n \\\"content\\\": null,\\n \\\"tool_calls\\\": {args.chat.chat_variables_array.ai_tool_call},\\n \\\"refusal\\\": null\\n},\\n{\\n \\\"role\\\": \\\"tool\\\",\\n \\\"content\\\": \\\"e-mail not found\\\",\\n \\\"tool_call_id\\\": {args.chat.chat_variables_array.ai_action_id}\\n}\",\"attr_options\":{\"as_json\":true,\"json_replace\":true,\"as_system\":true,\"json_replace_args\":true}}},{\"_id\":\"inQxADV1B\",\"type\":\"predefined\",\"content\":{\"text\":\"\",\"payload\":\"2489\"}}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[{"pattern":"password_reminder","pattern_exc":"","configuration":"{\"only_these\":true}","type":2,"on_start_type":2,"priority":0,"skip":0}],"payloads":[]},{"trigger":{"id":2491,"name":"support_price","actions":"[{\"_id\":\"HPRQ_pxev\",\"type\":\"text\",\"content\":{\"text\":\"{\\n \\\"role\\\": \\\"assistant\\\",\\n \\\"content\\\": null,\\n \\\"tool_calls\\\": {args.chat.chat_variables_array.ai_tool_call},\\n \\\"refusal\\\": null\\n},\\n{\\n \\\"role\\\": \\\"tool\\\",\\n \\\"content\\\": \\\"30 EUR\\\",\\n \\\"tool_call_id\\\": {args.chat.chat_variables_array.ai_action_id}\\n}\",\"attr_options\":{\"as_json\":true,\"json_replace\":true,\"as_system\":true,\"json_replace_args\":true}}},{\"_id\":\"inQxADV1B\",\"type\":\"predefined\",\"content\":{\"text\":\"\",\"payload\":\"2489\"}}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[{"pattern":"support_price","pattern_exc":"","configuration":"{\"only_these\":true}","type":2,"on_start_type":2,"priority":0,"skip":0}],"payloads":[]},{"trigger":{"id":2492,"name":"Function not found","actions":"[{\"_id\":\"1nX3uRE0m\",\"type\":\"text\",\"content\":{\"text\":\"Function not found - {content_1}. Make sure you have defined trigger with correct matching text.\"}}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]},{"trigger":{"id":2493,"name":"knowledge_base","actions":"[{\"_id\":\"HPRQ_pxev\",\"type\":\"text\",\"content\":{\"text\":\"{\\n \\\"role\\\": \\\"assistant\\\",\\n \\\"content\\\": null,\\n \\\"tool_calls\\\": {args.chat.chat_variables_array.ai_tool_call},\\n \\\"refusal\\\": null\\n},\\n{\\n \\\"role\\\": \\\"tool\\\",\\n \\\"content\\\": \\\"I don't know an answer\\\",\\n \\\"tool_call_id\\\": {args.chat.chat_variables_array.ai_action_id}\\n}\",\"attr_options\":{\"as_json\":true,\"json_replace\":true,\"as_system\":true,\"json_replace_args\":true}}},{\"_id\":\"inQxADV1B\",\"type\":\"predefined\",\"content\":{\"text\":\"\",\"payload\":\"2489\"}}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[{"pattern":"knowledge_base","pattern_exc":"","configuration":"{}","type":2,"on_start_type":2,"priority":0,"skip":0}],"payloads":[]},{"trigger":{"id":2540,"name":"ToolCall arguments","actions":"[{\"_id\":\"5Ywuj8tLs\",\"type\":\"command\",\"content\":{\"text\":\"Tool call requestion\",\"attr_options\":{\"json_replace\":true,\"as_system\":true},\"command\":\"chatvariable\",\"payload\":\"{\\\"ai_action_args\\\":{content_1}}\"},\"skip_resp\":false},{\"_id\":\"HPRQ_pxev\",\"type\":\"match_actions\",\"content\":{\"text\":\"{args.chat.chat_variables_array.ai_function_name}\",\"attr_options\":{\"as_json\":true,\"json_replace\":true,\"as_system\":true},\"alternative_callback\":\"2492\",\"on_start_type\":\"2\"},\"skip_resp\":false}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]}]}]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"ChatGTPCompletionsStream","description":"ChatGTP","configuration":"{\"host\":\"https:\/\/api.openai.com\",\"log_code\":\"\",\"log_audit\":false,\"log_system\":true,\"ecache\":false,\"parameters\":[{\"method\":\"POST\",\"authorization\":\"bearer\",\"api_key_location\":\"header\",\"query\":[],\"header\":[{\"key\":\"OpenAI-Beta\",\"value\":\"assistants=v1\",\"id\":\"temp1707815973681\"}],\"conditions\":[],\"postparams\":[],\"userparams\":[],\"output\":[{\"key\":\"\",\"value\":\"\",\"id\":\"temp1707816009806\",\"success_name\":\"Success\",\"success_location\":\"choices:0:delta:content\",\"success_header\":\"200\",\"output_priority\":\"10\",\"stream_content\":true,\"stream_as_html\":true},{\"key\":\"\",\"value\":\"\",\"id\":\"temp1707819824689\",\"output_priority\":\"5\",\"success_name\":\"Failure\",\"success_location\":\"\"},{\"key\":\"\",\"value\":\"\",\"id\":\"temp1736423057534\",\"success_name\":\"Tool call\",\"success_header\":\"200\",\"output_priority\":\"30\",\"success_condition_val\":\"choices:0:delta:tool_calls:0:type\",\"success_location\":\"choices:0:delta:tool_calls:0:id\",\"success_location_2\":\"choices:0:delta:tool_calls:0:function:name\",\"success_location_3\":\"choices:0:delta:tool_calls:0:function:arguments\",\"success_location_4\":\"choices:0:delta:tool_calls\",\"success_condition\":\"eq\",\"success_compare_value\":\"function\",\"stream_final\":false,\"stream_execute_trigger\":true},{\"key\":\"\",\"value\":\"\",\"id\":\"temp1740476556791\",\"success_name\":\"Tool call argument\",\"success_header\":\"200\",\"success_location\":\"choices:0:delta:tool_calls:0:function:arguments\",\"success_condition_val\":\"choices:0:delta:tool_calls:0:function:arguments\",\"success_condition\":\"notempty\",\"output_priority\":\"25\",\"stream_content\":true,\"save_stream\":true,\"final_match\":true}],\"id\":\"temp1707815934109\",\"name\":\"ChatCompletion\",\"suburl\":\"\/v1\/chat\/completions\",\"body_request_type\":\"raw\",\"body_request_type_content\":\"json\",\"auth_bearer\":\"your_api_key\",\"body_raw\":\"{\\n \\\"model\\\": \\\"gpt-4o-mini\\\",\\n \\\"stream\\\": true,\\n \\\"parallel_tool_calls\\\": false,\\n \\\"messages\\\": [\\n {\\n \\\"role\\\": \\\"system\\\",\\n \\\"content\\\": \\\"You are a helpful assistant. You can answer questions only from https:\/\/doc.livehelperchat.com. If you don't know the answer call `knowledge_base` function\\\"\\n }{if_previous_visitor_messages_list},\\n{previous_visitor_messages_list_url__10__0}\\n{separator},{\/separator}{\\n\\\"role\\\": \\\"{assistant}assistant{\/assistant}{user}user{\/user}\\\", \\n\\\"content\\\": {not_item_empty__args.item.msg}{{args.item.msg}}{\/not_item_empty}\\n}\\n{\/previous_visitor_messages_list_url}\\n{\/if_previous_visitor_messages_list}\\n ],\\n \\\"tools\\\": [\\n {\\n \\\"type\\\": \\\"function\\\",\\n \\\"function\\\": {\\n \\\"name\\\": \\\"password_reminder\\\",\\n \\\"description\\\": \\\"Sends a password reset link to the provided email address.\\\",\\n \\\"parameters\\\": {\\n \\\"type\\\": \\\"object\\\",\\n \\\"properties\\\": {\\n \\\"email\\\": {\\n \\\"type\\\": \\\"string\\\",\\n \\\"description\\\": \\\"The email address associated with the account.\\\"\\n }\\n },\\n \\\"required\\\": [\\\"email\\\"]\\n }\\n }\\n },{\\n \\\"type\\\": \\\"function\\\",\\n \\\"function\\\": {\\n \\\"name\\\": \\\"support_price\\\",\\n \\\"description\\\": \\\"Returns paid support price\\\",\\n \\\"parameters\\\": {\\n \\\"type\\\": \\\"object\\\",\\n \\\"properties\\\": {\\n },\\n \\\"required\\\": []\\n }\\n }\\n },{\\n \\\"type\\\": \\\"function\\\",\\n \\\"function\\\": {\\n \\\"name\\\": \\\"knowledge_base\\\",\\n \\\"description\\\": \\\"Fetches information from itnernal systems about live helper chat application. Should be called if you don't know the answer.\\\",\\n \\\"parameters\\\": {\\n \\\"type\\\": \\\"object\\\",\\n \\\"properties\\\": {\\n \\\"question\\\": {\\n \\\"type\\\": \\\"string\\\",\\n \\\"description\\\": \\\"Visitor question for knowledge base\\\"\\n }\\n },\\n \\\"required\\\": [\\\"question\\\"]\\n }\\n }\\n }\\n ]\\n }\",\"max_execution_time\":120,\"streaming_request\":true,\"streaming_event_type_field\":\"\"}]}"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"ChatGTPCompletionsStream","description":"ChatGTP","configuration":"{\"host\":\"https:\/\/openrouter.ai\",\"log_code\":\"\",\"log_audit\":false,\"log_system\":true,\"ecache\":false,\"parameters\":[{\"method\":\"POST\",\"authorization\":\"bearer\",\"api_key_location\":\"header\",\"query\":[],\"header\":[{\"key\":\"OpenAI-Beta\",\"value\":\"assistants=v1\",\"id\":\"temp1707815973681\"}],\"conditions\":[],\"postparams\":[],\"userparams\":[],\"output\":[{\"key\":\"\",\"value\":\"\",\"id\":\"temp1707816009806\",\"success_name\":\"Success\",\"success_location\":\"choices:0:delta:content\",\"success_header\":\"200\",\"output_priority\":\"10\",\"stream_content\":true,\"stream_as_html\":true},{\"key\":\"\",\"value\":\"\",\"id\":\"temp1707819824689\",\"output_priority\":\"5\",\"success_name\":\"Failure\",\"success_location\":\"\"},{\"key\":\"\",\"value\":\"\",\"id\":\"temp1736423057534\",\"success_name\":\"Tool call\",\"success_header\":\"200\",\"output_priority\":\"30\",\"success_condition_val\":\"choices:0:delta:tool_calls:0:type\",\"success_location\":\"choices:0:delta:tool_calls:0:id\",\"success_location_2\":\"choices:0:delta:tool_calls:0:function:name\",\"success_location_3\":\"choices:0:delta:tool_calls:0:function:arguments\",\"success_location_4\":\"choices:0:delta:tool_calls\",\"success_condition\":\"eq\",\"success_compare_value\":\"function\",\"stream_final\":true,\"stream_execute_trigger\":false,\"final_match_stream\":true}],\"id\":\"temp1707815934109\",\"name\":\"ChatCompletion\",\"suburl\":\"\/api\/v1\/chat\/completions\",\"body_request_type\":\"raw\",\"body_request_type_content\":\"json\",\"auth_bearer\":\"your_api_key\",\"body_raw\":\"{\\n \\\"model\\\": \\\"google\/gemini-2.0-flash-lite-001\\\",\\n \\\"stream\\\": true,\\n \\\"parallel_tool_calls\\\": false,\\n \\\"messages\\\": [\\n {\\n \\\"role\\\": \\\"system\\\",\\n \\\"content\\\": \\\"You are a helpful assistant. You can answer questions only from https:\/\/doc.livehelperchat.com. If you don't know the answer call `knowledge_base` function. You can call only one function at a time.\\\"\\n }{if_previous_visitor_messages_list},\\n{previous_visitor_messages_list_url__10__0}\\n{separator},{\/separator}{\\n\\\"role\\\": \\\"{assistant}assistant{\/assistant}{user}user{\/user}\\\", \\n\\\"content\\\": {not_item_empty__args.item.msg}{{args.item.msg}}{\/not_item_empty}\\n}\\n{\/previous_visitor_messages_list_url}\\n{\/if_previous_visitor_messages_list}\\n ],\\n \\\"tools\\\": [\\n {\\n \\\"type\\\": \\\"function\\\",\\n \\\"function\\\": {\\n \\\"name\\\": \\\"password_reminder\\\",\\n \\\"description\\\": \\\"Sends a password reset link to the provided email address.\\\",\\n \\\"parameters\\\": {\\n \\\"type\\\": \\\"object\\\",\\n \\\"properties\\\": {\\n \\\"email\\\": {\\n \\\"type\\\": \\\"string\\\",\\n \\\"description\\\": \\\"The email address associated with the account.\\\"\\n }\\n },\\n \\\"required\\\": [\\\"email\\\"]\\n }\\n }\\n },{\\n \\\"type\\\": \\\"function\\\",\\n \\\"function\\\": {\\n \\\"name\\\": \\\"support_price\\\",\\n \\\"description\\\": \\\"Returns paid support price\\\",\\n \\\"parameters\\\": {\\n \\\"type\\\": \\\"object\\\",\\n \\\"properties\\\": {\\n },\\n \\\"required\\\": []\\n }\\n }\\n },{\\n \\\"type\\\": \\\"function\\\",\\n \\\"function\\\": {\\n \\\"name\\\": \\\"knowledge_base\\\",\\n \\\"description\\\": \\\"Fetches information from itnernal systems about live helper chat application. Should be called if you don't know the answer.\\\",\\n \\\"parameters\\\": {\\n \\\"type\\\": \\\"object\\\",\\n \\\"properties\\\": {\\n \\\"question\\\": {\\n \\\"type\\\": \\\"string\\\",\\n \\\"description\\\": \\\"Visitor question for knowledge base\\\"\\n }\\n },\\n \\\"required\\\": [\\\"question\\\"]\\n }\\n }\\n }\\n ]\\n }\",\"max_execution_time\":120,\"streaming_request\":true,\"streaming_event_type_field\":\"\"}]}"}

0 commit comments

Comments
 (0)