Skip to content

Commit

Permalink
[Ellipsis] feat: add AI text generation command using pydantic-ai
Browse files Browse the repository at this point in the history
  • Loading branch information
ellipsis-dev[bot] authored Jan 22, 2025
1 parent 4f472eb commit 47cad56
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions cliffy/ai_generate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: ai_generate
version: "1.0.0"
help: "CLI AI generation using pydantic-ai"

requires:
- "pydantic-ai>=0.0.19"

functions: |
class GeneratePrompt(AIModel):
prompt: str
def generate_content(prompt: str):
gen = GeneratePrompt(prompt=prompt)
return gen()
commands:
"ai.generate":
help: "Generate text with pydantic-ai"
params:
- name: "prompt"
type: "str"
help: "Content prompt"
required: true
run: |
result = generate_content(prompt)
print(result)
1 change: 1 addition & 0 deletions cliffy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ def validate(manifest: TextIO) -> None:


# register commands
Loader.register_manifest("cliffy/ai_generate.yaml")
load_command = cli.command("load")(load)
build_command = cli.command("build")(build)
dev_command = cli.command("dev")(dev)
Expand Down

0 comments on commit 47cad56

Please sign in to comment.