-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
232 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
version: 0.0.1 | ||
name: "Guide" | ||
description: |- | ||
The AI guide for the PPE examples and lib scripts. | ||
autoRunLLMIfPromptAvailable: false | ||
Welcome: |- | ||
I am an AI guide instructor, I will guide you to use Programmable Prompt Engine(PPE) scripts. | ||
IsServerRunning: Please make sure the brain(LLM) server has been started. Are you sure it's running? | ||
--- | ||
- !fn# |- | ||
function lang(iso6391) { | ||
return this.languages.find(l => l.value === iso6391)?.name | ||
} | ||
- !fn |- | ||
async function toChoices({files}) { | ||
let result = files.map(f => ({name: f.title, value: f.filepath})) | ||
const target = this.$lang(this.preferLang) | ||
if (this.preferLang !== 'en') { | ||
for (let i = 0; i < result.length; i++) { | ||
const item = result[i] | ||
const trans = await this.$translate({content: item.name, target, lang: 'English'}) | ||
item.name = trans.split('\n')[0].trim() | ||
} | ||
} | ||
result.push({name: await this.$translate({content: 'Exit', target, lang: 'English'}), value: 'quit'}) | ||
return result | ||
} | ||
- $if: "!this.preferLang" | ||
then: | ||
- $if: "@input(inputType='confirm', content={{Welcome+'\n'+IsServerRunning}}, value=true, format=(answer) => answer ? 'Yes' : 'No')" | ||
then: | ||
- $set: | ||
languages: "@support_langs" | ||
- $set: | ||
preferLang: "@input(inputType='AutoComplete', content='Which language do you prefer?', choices=languages, limit=10)" | ||
- $if: "preferLang !== 'en'" | ||
then: | ||
# - $set: | ||
# ENV.USER_ENV.userPreferredLanguage: ?=preferLang | ||
- $set: | ||
GiveMeGoodBrain: "#I would translate content to {{preferLang | lang}} automatically. \\nBut remember an expert should have a good brain(LLM)." | ||
- -> translator(content=GiveMeGoodBrain, target=preferLang) -> $print | ||
- -> guide_lib_list(file="README.md") -> $set('catalog', content) | ||
- $echo: ?=catalog.summary | ||
# Choose a topic | ||
- -> translator(content=content+"\nPlease select what you want to know:", target=preferLang) -> $set('question') | ||
- -> $toChoices(files=catalog.files) -> input(inputType='AutoComplete', content=question, choices=result, limit=10, memoized=false) -> guide_lib_explain(file=content, lang=preferLang) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
version: 0.0.1 | ||
description: |- | ||
The AI Guide Catalog | ||
input: | ||
- lang | ||
--- | ||
- -> guide_lib_list(file="README.md") | ||
# save the catalog into `catalog` variable | ||
- $|set: catalog | ||
- $echo: ?=catalog.summary | ||
# -> translator(target=lang) | ||
# - "$print": "?='\\n🚀 ~ 🚀 ~ 🚀 ~ Hello: ' + catalog.summary" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
version: 0.0.1 | ||
type: instructor | ||
name: instructor | ||
description: |- | ||
Explain a file in the guide. | ||
input: | ||
- file | ||
- lang # the target language | ||
file: "README.md" | ||
--- | ||
- $if: "this.file === 'quit'" | ||
then: | ||
- user: "Thank you." | ||
- assistant: "Good bye. It was a pleasure speaking with you. About the Programmable Prompt Engine(PPE) Language[[bye]]" | ||
- -> trans(lang, content=messages[messages.length-1].content) -> $ret | ||
- $if: "this.file !== 'README.md'" | ||
then: | ||
- user: |- | ||
@file({{__dirname+file}}) | ||
--- | ||
Summarize the content in detail, capturing the key points and essence of it. | ||
- assistant: "[[summary:temperature=0.01]]" | ||
- -> trans(lang) -> $print(content) | ||
- -> translator(content="\nDo you have any questions?", target=lang) -> $set('question') | ||
- $if: "@input(inputType='confirm', content=question, memoized=false)" | ||
then: | ||
- -> translator(content="What do you want to know?", target=lang) -> input(memoized=false) | ||
- $echo: "@guide" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
version: 0.0.1 | ||
type: lib | ||
description: |- | ||
List all urls for the AI Guide | ||
input: | ||
- file | ||
output: | ||
type: 'object' | ||
properties: | ||
summary: | ||
type: 'string' | ||
description: extract the summary part from the content. | ||
files: | ||
type: 'array' | ||
items: | ||
type: 'object' | ||
properties: | ||
filepath: | ||
type: 'string' | ||
description: the file path from the markdown link. | ||
title: | ||
type: 'string' | ||
description: the title from markdown link | ||
description: | ||
type: 'string' | ||
description: the description for the link | ||
instruction: |- | ||
- Summary the key points and essence of it | ||
- Extract all links with title and description base on the markdown links from it | ||
file: "README.md" | ||
--- | ||
# - system: |- | ||
# - Summarize the following file provided by the user in detail, capturing the key points and essence of it. | ||
# - Extract all links with title and description base on the markdown links in the file | ||
# - Output JSON format, following the JSON schema: | ||
# {{output}} | ||
# --- | ||
# @file({{__dirname + file}}) | ||
# - user: Output all urls with title in markdown format from the README.md | ||
# - assistant: "[[urls:temperature=0.01]]" | ||
# - -> summary(file={{__dirname + file}}, content) | ||
- -> summary(file={{__dirname + file}}, content=instruction) -> json(output=output) | ||
# - $|echo: ["summary", "links[0]"] | ||
|
Oops, something went wrong.