此node.js cli和api使您能夠使用llm(openai,...)生成內容(博客文章,著陸頁,...)。它可以以可用LLM支持的所有語言生成文本。
這個項目正在使用蘭鏈JS
生成內容的不同模式:自動,交互式或使用內容模板。
?支持的LLM:OpenAI(穩定),Mistral(實驗),Claude(即將發布的版本),Groq(即將發布)。
?可用LLM支持的所有語言。
SEO友好:生成帖子標題,描述和sl。
✍️默認或自定義提示。
用完成參數進行微調。
在WordPress上發佈內容。
API。
即將到來的功能:圖像世代,抹布,在NextJS上發布。
該組件可以以不同的模式使用:
在交互式模式下,CLI會要求您提供一些參數(主題/標題,語言,意圖,受眾等)。
在自動模式下,您需要向命令行提供所有必要的參數。這種操作方式使您可以在串聯中創建多種內容(例如,在Shell腳本中)。
兩種模式都將使用不同的預定義提示來生成內容:
最終結果是Markdown和HTML。
模板在一系列提示中包含文檔結構。每個提示將以特定的順序執行,並由AI提供的答案代替。可以使用不同格式:Markdown,HTML,JSON等。
模板使用的主要優點是輸出的自定義。您可以使用自己的提示。如果您想根據相同的結構(產品頁面,著陸頁等)生產不同的內容,則模板也很有趣。
AI內容生成的問題之一是重複主要關鍵字。該腳本還使用temperature , frequency_penalty和presence_penalty參數來最大程度地減少此內容。有關更多詳細信息,請參見OpenAI API文檔。
生成時,CLI使您能夠將內容髮佈到WordPress博客。將來將支持其他CMS。我們需要支持一些無頭CM。
這是一個實驗項目。歡迎您建議改進,例如其他提示和其他參數值。 API調用的成本不包括在CLI的價格中。您需要有一個OpenAI API鍵來使用此CLI。在所有情況下,您都必須查看最終輸出。 AI可以提供不正確的信息。
露營的典型古怪? utopieouréalitéen 2024?
julius post -fp 1.5 -g -tp " 5 reasons to use AI for generating content " -f ./reasons-to-use-ai-content降價結果:使用AI生成內容的5個理由
julius template-post -f ./dobermann -t ./template.md -i breed=dobermann -d模板:template.md
降價結果:dobermann.md
julius template-post -f ./dobermann -t ./template.html -i breed=dobermann -d模板:template.html
HTML結果:Dobermann.html
CLI和API可作為NPM軟件包使用。
# for the API
npm install julius-gpt -S
# for the CLI
npm install -g julius-gptCLI有4組命令:
~ julius -h
Usage: julius [options] [command]
Generate and publish your content from the command line ?
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
prompt Prompt related commands
post [options] Generate a post in interactive or automatic mode
template-post [options] Generate a post based on a content template
wp Wordpress related commands. The
您需要有一個OpenAI API鍵來使用此CLI 。您可以使用-k選項或環境變量OPENAI_API_KEY指定OpenAI API密鑰。
請參閱CLI幫助獲取不同選項的列表。
~ julius post -h ~ julius post -tp " 5 reasons to use AI for generating content "使用其他參數進一步個性化內容。
一個更高級的命令
~ julius post -fp 1.5 -g -l french -tp " Emprunter avec un revenu de retraite : quelles sont les options ? " -f ./emprunter-argent-revenu-retraite -c Belgique -d該命令將為該國觀眾提供法語的帖子,頻率為1.5:比利時。主題(TP ARG)用法語編寫。
~ julius post -i不必使用其他參數。 CLI會問您一些有關主題,語言的問題,...
模板文件可以以降價或HTML格式為單位。模板擴展名將用於確定最終輸出。
~ julius template-post -t < file > .[md | html]CLI將執行模板文件中提到的所有提示。每個提示短代碼將被AI提供的輸出所取代。
模板結構
這是模板文件的一個簡單示例:
{{s:Your are an prompt tester. You have to write your answers in a makrdown block code.}}
{{c:your answer has to be "Content of prompt 1."}}
# Heading 1
{{c:your answer has to be "Content of prompt 2."}}
提示“ S”是系統提示,帶有“ c”的提示,是內容提示。它們將被AI提供的輸出所取代。
像Langchain一樣,您可以在模板中提供一些輸入變量:
{{s:Your are an prompt tester. You have to write your answers in a makrdown block code in language : {language}.}}
{{c:Quelle est la capitale de la France ?"}}
# Heading 1
{{c: Quelle est la capitale de la Belgique ? "}}
現在,您可以使用以下命令執行此模板:
~ julius template-post -t < template-file > .md -i language=french這是一個實驗特徵,模板語法將在即將發布的版本中修改。
默認情況下,CLI使用最新的打開AI模型。我們正在努力支持以下支持:
| 提供者 | 型號 | 地位 | .ENV變量API密鑰 |
|---|---|---|---|
| Openai | GPT-4,GPT-4-Turbo-Preiview | 穩定的 | OpenAI_API_KEY |
| Mistral | Mistral-Mall-LATEST,MISTRAL-MEDIUM-LATEST,MISTRAL-LARGE-LATEST | 實驗 | mistral_api_key |
| 人類 | 克勞德 | 下一個版本 | na |
| 谷 | Mistral,駱駝 | 下一個版本 | na |
所有型號都需要一個API密鑰。您可以在.env文件或CLI參數'-K'中提供它
您可以使用-M參數選擇模型:
~ julius post -m mistral-large-latest ....使用幫助列出模型列表
~ julius post -h 或者
~ julius template-post -h 為什麼要自定義提示?
朱利葉斯使用一組提示來生成內容,可以通過在單獨的目錄中創建新版本來自定義。每個提示都存儲在其他文件中。
| 文件名 | 描述 | 輸入 |
|---|---|---|
| system.txt | 可以用作社論簡介,也可以添加重要信息,例如人格,社論樣式,目標,... | 沒有任何 |
| apietent-intent.txt | 用於根據文章的主題產生觀眾和意圖。 | {language} {主題} |
| atline.txt | 用於生成文章結構。 | {language} {topic} {country} {aigair} {intent} |
| 簡介 | 用於生成文章的簡介。 | {language} {主題} |
| 結論 | 用於生成文章的結論。 | {language} {主題} |
| heading.txt | 用於生成每個標題的內容。 | {language} {headingTitle} {keywords} |
1。製作默認提示的副本
~ julius prompt create [name] [folder]例如。 :
~ julius prompt create discover ./my-prompts此命令將將默認提示複製到文件夾中:./my-prompts/discover
2。修改提示
現在,您可以在此文件夾中修改和/或翻譯提示
3。在CLI中使用您的提示
在自動模式下,CLI會詢問您的自定義提示路徑
~ julius -i 您還可以使用CLI參數“ PF”來指定文件夾路徑
~ julius -pf ./my-prompts/discover ...此命令在本地文件〜/.julius/wordpress.json中顯示所有註冊的WordPress站點的列表。
域名或站點的ID可用於以下命令。
~ julius wp ls此命令將一個新的WordPress站點添加到本地文件〜/.Julius/WordPress.json。
~ julius wp add www.domain.com:username:password此命令在本地文件〜/.julius/wordpress.json中顯示所有註冊的WordPress站點的列表。
~ julius wp info www.domain.com | id此命令從本地文件〜/.julius/wordpress.json刪除WordPress站點。
~ julius wp rm www.domain.com | id此命令導出本地文件〜/.Julius/wordpress.json中所有註冊的WordPress站點的列表。
~ julius wp export wordpress_sites.json此命令將在本地文件〜/.julius/wordpress.json中導入所有註冊的WordPress站點的列表。
~ julius wp import wordpress_sites.json此命令顯示WordPress網站的所有類別列表。
~ julius wp categories www.domain.com | id此命令在WordPress網站上創建了一個新帖子。 JSON文件必須具有以下結構:
{
"title" : " The title of the post " ,
"slug" : " the-slug-of-the-post " ,
"content" : " The content of the post " ,
"seoTitle" : " The SEO title of the post " ,
"seoDescription" : " The SEO description of the post " ,
}可以使用命令julius post或API生成此JSON文件。
默認情況下,WordPress REST API不允許您更新SEO標題和描述。此信息由不同的插件(例如Yoast SEO)管理。您可以為此編碼插件。
可以在此目錄中找到YOAST的插件示例:Julius-WP-Plugin您可以創建一個zip並從WordPress儀表板安裝它。
您可以為其他SEO插件編碼類似的內容。
~ julius wp post www.domain.com | id categoryId post.jsonjulius wp categories www.domain.com|id此命令更新WordPress網站上的帖子(標題,內容,SEO標題和SEO描述)。 JSON文件必須具有以下結構:
{
"title" : " The title of the post " ,
"slug" : " the-slug-of-the-post " ,
"content" : " The content of the post " ,
"seoTitle" : " The SEO title of the post " ,
"seoDescription" : " The SEO description of the post " ,
}可以使用命令julius post或API生成此JSON文件。
~ julius wp update www.domain.com | id slug post.json [-d, --update-date] 請參閱單元測試:tests/test-api.spec.ts