此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