Commit Graph

404 Commits

Author SHA1 Message Date
Keegan George 5c9b570562
FIX: Revert AI action not working in Firefox (#418)
* FIX: Revert AI action not working in Firefox

* Make it pretty 💄
2024-01-11 11:43:39 +11:00
Rafael dos Santos Silva 8fcba12fae
FEATURE: Support for SRV records for Discourse services (#414)
This allows admins to configure services with multiple backends using DNS SRV records. This PR also adds support for shared secret auth via headers for TEI and vLLM endpoints, so they are inline with the other ones.
2024-01-10 19:23:07 -03:00
Keegan George 9d8bbe32a9
FIX: AI Explain copy button not working (#415) 2024-01-10 10:41:48 -08:00
Keegan George 726cffc8af
FIX: New illustrate post suggestions should be auto tracked (#412) 2024-01-10 09:04:10 -08:00
Roman Rizzi abde82c1f3
FIX: Use claude-2.1 to enable system prompts (#411) 2024-01-09 14:10:20 -03:00
Discourse Translator Bot 0f4e7723d7
Update translations (#410) 2024-01-09 15:09:46 +01:00
Sam 05f7808057
FEATURE: more elegant progress (#409)
Previous to this change it was very hard to tell if completion was
stuck or not.

This introduces a "dot" that follows the completion and starts
flashing after 5 seconds.
2024-01-09 09:20:28 -03:00
Sam b0a0cbe3ca
FIX: improve bot behavior (#408)
* FIX: improve bot behavior

- Provide more information to Gemini context post function execution
- Use system prompts for Claude (fixes Dall E)
- Ensure Assistant is properly separated
- Teach Claude to return arrays in JSON vs XML

Also refactors tests so we do not copy tool preamble everywhere

* System msg is claude-2 only. fix typo

---------

Co-authored-by: Roman Rizzi <rizziromanalejandro@gmail.com>
2024-01-08 10:28:03 -03:00
Roman Rizzi 6124f910c1
FIX: Bring back Azure support. (#407)
We thought Azure's latest API version didn't have tool support yet, but I didn't understand it was complaining about a required field in the tool call message.
2024-01-05 17:08:10 -03:00
Sam 17cc09ec9c
FIX: don't include <details> in context (#406)
* FIX: don't include <details> in context

We need to be careful adding <details> into context of conversations
it can cause LLMs to hallucinate results

* Fix Gemini multi-turn ctx flattening

---------

Co-authored-by: Roman Rizzi <rizziromanalejandro@gmail.com>
2024-01-05 15:21:14 -03:00
Keegan George 7201d482d5
FEATURE: Add DallE support to AI helper's illustrate post (#404) 2024-01-05 09:03:23 -08:00
Rafael dos Santos Silva 23b2809638
FEATURE: Generate proper embeddings for posts/topics with embedded content (#401) 2024-01-05 10:27:45 -03:00
Rafael dos Santos Silva 6fc1c9f7a6
FEATURE: Try to automatically handle larger embedding indexes (#403)
* FEATURE: Try to automatically handle larger embedding indexes

* linteeeeeeeer
2024-01-05 09:56:28 -03:00
Sam dd42a4e47b
FIX: array arguments not parsed correctly (#405)
DALL E command accepts an Array as a tool argument, this was not
parsed correctly by the invoker leading to errors generating
images with DALL E

Side quest ... don't use update! it calls validations and will now
fail due to email validation
2024-01-05 14:39:32 +11:00
Roman Rizzi 971e03bdf2
FEATURE: AI Bot Gemini support. (#402)
It also corrects the syntax around tool support, which was wrong.

Gemini doesn't want us to include messages about previous tool invocations, so I had to shuffle around some code to send the response it generated from those invocations instead. For this, I created the "multi_turn" context, which bundles all the context involved in the interaction.
2024-01-04 18:15:34 -03:00
Roman Rizzi aa56baad37
FEATURE: Add Mixtral support for AI Bot (#396) 2024-01-04 12:22:43 -03:00
Roman Rizzi e6422c542e
FIX: Tools::DbSchema's tables parameter is a string (#400) 2024-01-04 11:50:26 -03:00
Roman Rizzi f9d7d7f5f0
DEV: AI bot migration to the Llm pattern. (#343)
* DEV: AI bot migration to the Llm pattern.

We added tool and conversation context support to the Llm service in discourse-ai#366, meaning we met all the conditions to migrate this module.

This PR migrates to the new pattern, meaning adding a new bot now requires minimal effort as long as the service supports it. On top of this, we introduce the concept of a "Playground" to separate the PM-specific bits from the completion, allowing us to use the bot in other contexts like chat in the future. Commands are called tools, and we simplified all the placeholder logic to perform updates in a single place, making the flow more one-wayish.

* Followup fixes based on testing

* Cleanup unused inference code

* FIX: text-based tools could be in the middle of a sentence

* GPT-4-turbo support

* Use new LLM API
2024-01-04 10:44:07 -03:00
Sam 03fc94684b
FIX: AI helper not working correctly with mixtral (#399)
* FIX: AI helper not working correctly with mixtral

This PR introduces a new function on the generic llm called #generate

This will replace the implementation of completion!

#generate introduces a new way to pass temperature, max_tokens and stop_sequences

Then LLM implementers need to implement #normalize_model_params to
ensure the generic names match the LLM specific endpoint

This also adds temperature and stop_sequences to completion_prompts
this allows for much more robust completion prompts

* port everything over to #generate

* Fix translation

- On anthropic this no longer throws random "This is your translation:"
- On mixtral this actually works

* fix markdown table generation as well
2024-01-04 09:53:47 -03:00
Keegan George 0483e0bb88
UX: Add proper attribution to illustrate post images (#398) 2024-01-03 13:01:19 -08:00
Jan Cernik d9c052f8e7
FIX: 500 error when reviewable has a missing message (#397) 2024-01-03 11:49:47 -03:00
Keegan George 1a5985134a
FIX: Show illustrate post only if stability API key present (#395) 2024-01-02 11:24:16 -08:00
Discourse Translator Bot f8fdb6db76
Update translations (#394) 2024-01-02 15:26:08 +01:00
Roman Rizzi 4182af230a
FIX: Correctly translate and read tools for Claude and Chat GPT. (#393)
I tested against the live models for the AI bot migration. It ensures Open AI's tool syntax is correct and we can correctly read the replies.
:
2024-01-02 11:21:13 -03:00
Rafael dos Santos Silva cec9bb8910
FIX: Skip embeddings for blank content (#392) 2023-12-29 14:59:08 -03:00
Rafael dos Santos Silva c778592da4
FIX: Corner cases on post embedding and crawler related (#391)
* FIX: Simplify markup for crawler related

* FIX: Handle title-less topics when truncating for embeddings

* fix
2023-12-29 14:05:02 -03:00
Rafael dos Santos Silva 140359c2ef
FEATURE: Per post embeddings (#387) 2023-12-29 12:28:45 -03:00
chapoi c3af27571b
UX: copy change (#390) 2023-12-29 16:26:03 +01:00
Sam c9b109f9d4
FIX: use async versions of clipboardCopy (#389)
Chrome and Firefox work with standard clipboardCopy, but since
we are making an ajax call Safari fails cause there is too much
delay detected.

To avoid this issue we trade in promises which are acceptable and
work in iOS.
2023-12-29 22:50:10 +11:00
Natalie Tay 73c58155f8
FIX: Get topic's category instead of array's (#388)
Currently we're seeing 500s when related_topics are getting rendered. We should get the topic's category rather than on the array.
```
ActionView::Template::Error (undefined method `category' for [#<Topic id ... ]
```
2023-12-29 16:52:48 +08:00
Sam 933784a873
FEATURE: allow easy sharing of bot conversations (#385)
* FEATURE: allow easy sharing of bot conversations

* Lean on new core API i

* Added system spec for copy functionality


* Update assets/javascripts/initializers/ai-bot-replies.js

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>

* discourse later insted of setTimeout

* Update spec/system/ai_bot/share_spec.rb

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>

* feedback from review

just check the whole payload

* remove uneeded code

* fix spec

---------

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2023-12-29 19:47:47 +11:00
Rafael dos Santos Silva 2636efcd1b
FEATURE: Render Related Topics for Crawlers (#386) 2023-12-28 15:32:03 -03:00
Rafael dos Santos Silva 1287ef4428
FEATURE: Support for Gemini Embeddings (#382) 2023-12-28 10:28:01 -03:00
Keegan George 5f088b12a7
FIX: Prevent no results label from showing when untrue (#384) 2023-12-27 16:42:13 -08:00
Rafael dos Santos Silva 76f7940b55
Revert "FEATURE: User sentiment on profile summary page (#329)" (#383)
This reverts commit 71c5077228.
2023-12-28 11:01:57 +11:00
Discourse Translator Bot 714a33a59d
Update translations (#379) 2023-12-27 16:44:48 -03:00
Rafael dos Santos Silva 20cb15ab5f
FEATURE: Mixtral for summarization (#381) 2023-12-26 17:50:02 -03:00
Rafael dos Santos Silva 3c27cbfb9a
FIX: Use vLLM if TGI is not configured for OSS LLM inference (#380) 2023-12-26 17:18:08 -03:00
Rafael dos Santos Silva 5db7bf6e68
Mixtral (#376)
Add both Mistral and Mixtral support. Also includes vLLM-openAI inference support.

Co-authored-by: Roman Rizzi <rizziromanalejandro@gmail.com>
2023-12-26 14:49:55 -03:00
Keegan George cb325bb883
UX: Menu placement bottom for AI (#378) 2023-12-22 11:53:41 -08:00
Sam a5d240991f
FEATURE: allow sending AI based report to a topic (#377)
This makes the reporting far more flexible cause it can target a
far wider audience by pointing it at a topic in a secure category
or an existing PM
2023-12-22 11:46:23 +11:00
Sam 37dd98c937
FIX: exclude non visible topics from report context (#375)
Generally non visible topics are not that interesting, do not add
this noise to the report context
2023-12-21 19:08:36 +11:00
Keegan George 8feb3ad4db
FIX: Context menu should not appear if selected text is deleted (#374) 2023-12-20 10:50:17 -08:00
Keegan George ea116f91fc
FIX: Undo issue (#372) 2023-12-20 10:46:22 -08:00
Sam af2e692761
FIX: under certain conditions we would get duplicate data from llm (#373)
Previously endpoint/base would `+=` decoded_chunk to leftover

This could lead to cases where the leftover buffer had duplicate
previously processed data

Fix ensures we properly skip previously decoded data.
2023-12-20 14:28:05 -03:00
Discourse Translator Bot 09238d33fa
Update translations (#370) 2023-12-19 22:45:37 +01:00
Sam 8664771b7f
FIX: triage no longer working with claude (#369) 2023-12-20 07:58:38 +11:00
Keegan George 5a84969c96
FIX: Illustrate post icon and translation not appearing correctly (#371) 2023-12-19 12:55:43 -08:00
Keegan George 7b4710d5c9
FEATURE: Generate post illustrations (#367) 2023-12-19 11:17:34 -08:00
Sam 529703b5ec
FEATURE: support sending AI report to an email address (#368)
Support emailing the AI report to any arbitrary email
2023-12-19 17:51:49 +11:00