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

[WIP]: PromptTemplate #654

Closed
wants to merge 6 commits into from
Closed

[WIP]: PromptTemplate #654

wants to merge 6 commits into from

Conversation

EmanuelCampos
Copy link
Collaborator

@EmanuelCampos EmanuelCampos commented Mar 18, 2024

DRAFT, not ready for use

missing:

  • refactor missing modules
  • refactor existent prompts
  • tests with refine template
  • fix circular dependency
  • refactor partial format + prompt repack

Copy link

changeset-bot bot commented Mar 18, 2024

⚠️ No Changeset found

Latest commit: e658cfe

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Mar 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
llama-index-ts-docs ❌ Failed (Inspect) Mar 18, 2024 2:30pm

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this file will be removed, just an example to test fast for now

} from "./index.js";

// Define a default prompt template
const defaultTextQaPromptTemplate = () => `Context information is below.
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this need to be function?

Suggested change
const defaultTextQaPromptTemplate = () => `Context information is below.
const defaultTextQaPromptTemplate = "Context information is below.


// Update the prompts
queryEngine.updatePrompts({
"responseSynthesizer:textQATemplate": chatMessageTemplate,
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we directly pass the template?

Suggested change
"responseSynthesizer:textQATemplate": chatMessageTemplate,
"responseSynthesizer:textQATemplate": [
{
content: "Always answer the question, even if you don't know the answer.",
role: "system",
},
{
content: defaultTextQaPromptTemplate(),
role: "user",
},
],

e.g. updatePrompts could generate a ChatPromptTemplate object if needed

Comment on lines +55 to +56
queryEngine.updatePrompts({
"responseSynthesizer:textQATemplate": chatMessageTemplate,
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about adding a convenience function for the user that is updating the most likely prompt (here responseSynthesizer:textQATemplate):

Suggested change
queryEngine.updatePrompts({
"responseSynthesizer:textQATemplate": chatMessageTemplate,
queryEngine.updatePrompt(chatMessageTemplate)

@EmanuelCampos
Copy link
Collaborator Author

closing, due to several changes on how it works, moving to #665

@marcusschiesser thanks for the comments, appreciate your review on the new PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants