Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial system prompt in ChatHandler and completion #28

Merged
merged 4 commits into from
Feb 4, 2025

Conversation

brichet
Copy link
Collaborator

@brichet brichet commented Jan 24, 2025

Fixes #25

Use the same prompts as jupyter-ai (except for the model name, which is not part of the BaseChatModel and may not be provided by all chat model).

NOTES

  1. Currently the completion prompt is not used by the codestral completer, because the codestral completer uses a text completion model, which doesn't seem to allow such prompts.

  2. For a follow up PR, we should:

FOLLOW UP

We could add a setting to let user define their own prompt #25 (comment)

@jtpio jtpio added the enhancement New feature or request label Jan 24, 2025
@brichet brichet marked this pull request as draft January 25, 2025 06:39
@brichet brichet marked this pull request as ready for review January 27, 2025 08:08
@brichet brichet marked this pull request as draft January 27, 2025 08:09
@brichet brichet marked this pull request as ready for review January 28, 2025 14:13
src/provider.ts Outdated
@@ -8,6 +8,30 @@ import { CompletionProvider } from './completion-provider';
import { getChatModel, IBaseCompleter } from './llm-models';
import { IAIProvider } from './token';

export const chatSystemPrompt = (provider_name: string) => `
Copy link
Member

@jtpio jtpio Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this function take a single option, instead of raw parameters like provider_name?

Wondering if this could make it easier to extend later.

@jtpio
Copy link
Member

jtpio commented Feb 4, 2025

We could add a setting to let user define their own prompt #25 (comment)

Wondering why we would need a getter / setter on the completer for the prompt, as it is currently set to COMPLETION_SYSTEM_PROMPT by default for now. But this would likely be useful when allowing users to set their own prompts?

@brichet
Copy link
Collaborator Author

brichet commented Feb 4, 2025

We could add a setting to let user define their own prompt #25 (comment)

Wondering why we would need a getter / setter on the completer for the prompt, as it is currently set to COMPLETION_SYSTEM_PROMPT by default for now. But this would likely be useful when allowing users to set their own prompts?

Yes, and even with the settings it could only be a writable property, since there is nothing more in the getter / setter.

Copy link
Member

@jtpio jtpio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jtpio jtpio merged commit b5358b9 into jupyterlite:main Feb 4, 2025
7 checks passed
@brichet brichet deleted the default_prompts branch February 4, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define a set of default prompts for chat and completions
2 participants