Skip to content

Commit

Permalink
fix(sdk/models): improve prompt adapter templates
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyJonas committed Oct 13, 2023
1 parent 0e83bb3 commit db251d5
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 72 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions packages/galileo-sdk/src/models/llms/anthropic/claude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const CLAUDE_V2_ADAPTER: IModelAdapter = {
base: {
// every claude prompt must start with `\n\nHuman: `
Header: '\n\nHuman: ',
// every claude prompt must end with `\n\Assistant: `
// every claude prompt must end with `\n\nAssistant: `
Footer: '\n\nAssistant: ',
// claude likes tags
Body: '<system>{{>Instruction}}\n\n{{>Context}}\n\n</system>\n\n{{>Cue}}',
Expand All @@ -27,10 +27,6 @@ export const CLAUDE_V2_ADAPTER: IModelAdapter = {
Cue: 'Followup Question: {{question}}',
Delimiter: '<dialog>',
Dialog: '<dialog>\n{{>Messages}}\n\n</dialog>',
// prevent stop in dialog
AIMessage: '\tAssistant: {{content}}',
HumanMessage: '\tHuman: {{content}}',
SystemMessage: '\tSystem: {{content}}',
},
},
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions packages/galileo-sdk/src/models/llms/meta/llama2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,19 @@ export const LLAMA2_KWARGS: Kwargs = {
export const LLAMA2_ENDPOINT_KWARGS: Kwargs = {
CustomAttributes: 'accept_eula=true',
};

/*
Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question.
Chat History:
{{#each chat_history}}
{{#if (eq type "human")}}Human: {{content}}
{{~else if (eq type "ai")}}Assistant: {{content}}
{{~else if (eq type "system")}}System: {{content}}
{{~else}}{{#if type}}{{type}}: {{/if}}{{content}}
{{/if}}{{#isnt @last true}}
{{/isnt}}{{/each}}
Follow Up Input: {{question}}
Standalone question:
*/

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit db251d5

Please sign in to comment.