Commit Graph

21 Commits

Author SHA1 Message Date
Sam 7c65dd171f
FIX: regression, no longer sending examples to AI helper ()
For a while now we have not been sending the examples to AI
helper, which can lead to inconsistent results.

Note: this also means that in non English we did not send
English results, so this may end up reducing performance

That said first thing we need to do is fix the regression.
2024-12-03 16:03:46 +11:00
Natalie Tay f8231d259b
FEATURE: Add locale detection prompt from translator () 2024-11-25 08:33:54 +11:00
Sam be0b78cacd
FEATURE: new endpoint for directly accessing a persona ()
The new `/admin/plugins/discourse-ai/ai-personas/stream-reply.json` was added.

This endpoint streams data direct from a persona and can be used
to access a persona from remote systems leaving a paper trail in
PMs about the conversation that happened

This endpoint is only accessible to admins.

---------

Co-authored-by: Gabriel Grubba <70247653+Grubba27@users.noreply.github.com>
Co-authored-by: Keegan George <kgeorge13@gmail.com>
2024-10-30 10:28:20 +11:00
Hoa Nguyen 1002dc877d
DEV: remove ignore column syntax for the removed provider column in completion prompt model () 2024-09-30 08:57:23 +10:00
Sam 1f74a77e17
DEV: correct flaky spec ()
We were not properly expiring prompt cache
2024-02-19 15:21:55 +11:00
Roman Rizzi 04eae76f68
REFACTOR: Represent generic prompts with an Object. ()
* REFACTOR: Represent generic prompts with an Object.

* Adds a bit more validation for clarity

* Rewrite bot title prompt and fix quirk handling

---------

Co-authored-by: Sam Saffron <sam.saffron@gmail.com>
2024-01-12 14:36:44 -03:00
Sam 03fc94684b
FIX: AI helper not working correctly with mixtral ()
* 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 7b4710d5c9
FEATURE: Generate post illustrations () 2023-12-19 11:17:34 -08:00
Roman Rizzi 2798e4c86d
FIX: Custom instructions where missing when generating custom prompt input () 2023-12-11 19:26:56 -03:00
Keegan George a89549919d
FIX: Missing closing `>` in input tag () 2023-12-11 12:09:17 -08:00
Roman Rizzi f26adf2cf6
FIX: Use XML tags in generate_titles prompt. ()
We must ensure we can isolate titles, and the models sometimes ignore the example we give them.

Additionally, anons can generate HyDE posts, so we need to check if user is nil when attempting to log requests.
2023-11-28 12:52:22 -03:00
Roman Rizzi 54a8dd9556
REFACTOR: Use LLM abstraction in the AI Helper. ()
It also removes the need for multiple versions of our seeded prompts per model, further simplifying the code.
2023-11-27 09:33:31 -03:00
Rafael dos Santos Silva 0e5764617a
FEATURE: AI helper on posts ()
Adds an AI Helper function when selecting text while viewing a topic.

---------

Co-authored-by: Keegan George <kgeorge13@gmail.com>
Co-authored-by: Roman Rizzi <roman@discourse.org>
2023-10-23 11:41:36 -03:00
Keegan George 2e5a39360a
FEATURE: Create custom prompts with composer AI helper ()
* DEV: Add icon support

* DEV: Add basic setup for custom prompt menu

* FEATURE: custom prompt backend

* fix custom prompt param check

* fix custom prompt replace

* WIP

* fix custom prompt usage

* fixes

* DEV: Update front-end

* DEV: No more custom prompt state

* DEV: Add specs

* FIX: Title/Category/Tag suggestions

Suggestion dropdowns broke because it `messages_with_user_input(user_input)` expects a hash now.

* DEV: Apply syntax tree

* DEV: Restrict custom prompts to configured groups

* oops

* fix tests

* lint

* I love tests

* lint is cool tho

---------

Co-authored-by: Rafael dos Santos Silva <xfalcox@gmail.com>
2023-09-25 15:12:54 -03:00
Rafael dos Santos Silva e673b568d9
FEATURE: StableBeluga2 support for AiHelper ()
* FEATURE: StableBeluga2 support for AiHelper

* lint
2023-08-25 15:54:51 -03:00
Roman Rizzi 7e3cb0ea16
FEATURE: Multi-model support for the AI Bot module. ()
We'll create one bot user for each available model. When listed in the `ai_bot_enabled_chat_bots` setting, they will reply.

This PR lets us use Claude-v1 in stream mode.
2023-05-11 10:03:03 -03:00
Sam e76fc77189
fixes ()
* Minor... use username suggester in case username already exists

* FIX: ensure we truncate long prompts

Previously we

1. Used raw length instead of token counts for counting length
2. We totally dropped a prompt if it was too long

New implementation will truncate "raw" if it gets too long maintaining
meaning.
2023-05-06 07:31:53 -03:00
Roman Rizzi 71b105a1bb
FEATURE: Introduce the ai-bot module ()
This module lets you chat with our GPT bot inside a PM. The bot only replies to members of the groups listed on the ai_bot_allowed_groups setting and only if you invite it to participate in the PM.
2023-05-05 15:28:31 -03:00
Rafael dos Santos Silva bb0b829634
FEATURE: Anthropic Claude for AIHelper and Summarization modules () 2023-04-10 11:04:42 -03:00
Roman Rizzi 39f7f1f29e
FEATURE: Prompts can consist of multiple messages. ()
A prompt with multiple messages leads to better results, as the AI can learn for given examples. Alongside this change, we provide a better default proofreading prompt.
2023-03-21 12:04:59 -03:00
Roman Rizzi 320ac6e84b
REFACTOR: Store prompts in a dedicated table. ()
This change makes it easier to add new prompts to our AI helper. We don't have a UI for it yet. You'll have to do it through a console.
2023-03-17 15:14:19 -03:00