Skip to content

Add initial system prompt in ChatHandler and completion#28

Merged
jtpio merged 4 commits into
jupyterlite:mainfrom
brichet:default_prompts
Feb 4, 2025
Merged

Add initial system prompt in ChatHandler and completion#28
jtpio merged 4 commits into
jupyterlite:mainfrom
brichet:default_prompts

Conversation

@brichet

@brichet brichet commented Jan 24, 2025

Copy link
Copy Markdown
Collaborator

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
Comment thread src/provider.ts Outdated
import { getChatModel, IBaseCompleter } from './llm-models';
import { IAIProvider } from './token';

export const chatSystemPrompt = (provider_name: string) => `

@jtpio jtpio Feb 4, 2025

Copy link
Copy Markdown
Member

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

jtpio commented Feb 4, 2025

Copy link
Copy Markdown
Member

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

brichet commented Feb 4, 2025

Copy link
Copy Markdown
Collaborator Author

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.

@jtpio jtpio left a comment

Copy link
Copy Markdown
Member

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
@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