@@ -3,16 +3,329 @@ wp-cli/ai-command
33
44Interacts with the WordPress AI Client
55
6- [ ![ Build Status ] ( https://travis-ci.org /wp-cli/ai-command. svg?branch=master )] ( https://travis-ci.org /wp-cli/ai-command )
6+ [ ![ Testing ] ( https://github.com /wp-cli/ai-command/actions/workflows/testing.yml/badge. svg )] ( https://github.com /wp-cli/ai-command/actions/workflows/testing.yml )
77
88Quick links: [ Using] ( #using ) | [ Installing] ( #installing ) | [ Contributing] ( #contributing ) | [ Support] ( #support )
99
1010## Using
1111
12+ This package implements the following commands:
13+
14+ ### wp ai
15+
16+ Interacts with the WordPress AI Client for text and image generation.
17+
18+ ~~~
19+ wp ai
20+ ~~~
21+
22+ ** EXAMPLES**
23+
24+ # Check AI capabilities status
25+ $ wp ai status
26+ +------------------+-----------+
27+ | Capability | Supported |
28+ +------------------+-----------+
29+ | Text Generation | Yes |
30+ | Image Generation | No |
31+ +------------------+-----------+
32+
33+ # Generate text from a prompt
34+ $ wp ai generate text "Write a haiku about WordPress"
35+ Success: Generated text:
36+ Open source and free
37+ Empowering creators
38+ WordPress shines bright
39+
40+ # Generate an image from a prompt
41+ $ wp ai generate image "A futuristic WordPress logo" --destination-file=logo.png
42+ Success: Image saved to logo.png
43+
44+ # Check if a prompt is supported
45+ $ wp ai check "Summarize this text"
46+ Success: Text generation is supported for this prompt.
47+
48+
49+
50+ ### wp ai credentials
51+
52+ Manages AI provider credentials.
53+
54+ ~~~
55+ wp ai credentials
56+ ~~~
57+
58+ ** EXAMPLES**
59+
60+ # List all stored AI provider credentials
61+ $ wp ai credentials list
62+
63+ # Get credentials for a specific provider
64+ $ wp ai credentials get openai
65+
66+ # Set credentials for a provider
67+ $ wp ai credentials set openai --api-key=sk-...
68+
69+ # Delete credentials for a provider
70+ $ wp ai credentials delete openai
71+
72+
73+
74+
75+
76+ ### wp ai credentials get
77+
78+ Gets credentials for a specific AI provider.
79+
80+ ~~~
81+ wp ai credentials get <provider> [--format=<format>]
82+ ~~~
83+
84+ ** OPTIONS**
85+
86+ <provider>
87+ The AI provider name (e.g., openai, anthropic, google).
88+
89+ [--format=<format>]
90+ Render output in a particular format.
91+ ---
92+ default: json
93+ options:
94+ - json
95+ - yaml
96+ ---
97+
98+ ** EXAMPLES**
99+
100+ # Get OpenAI credentials
101+ $ wp ai credentials get openai
102+ {"provider":"openai","api_key":"sk-*****"}
103+
104+
105+
106+ ### wp ai credentials set
107+
108+ Sets or updates credentials for an AI provider.
109+
110+ ~~~
111+ wp ai credentials set <provider> --api-key=<api-key>
112+ ~~~
113+
114+ ** OPTIONS**
115+
116+ <provider>
117+ The AI provider name (e.g., openai, anthropic, google).
118+
119+ --api-key=<api-key>
120+ The API key for the provider.
121+
122+ ** EXAMPLES**
123+
124+ # Set OpenAI credentials
125+ $ wp ai credentials set openai --api-key=sk-...
126+ Success: Credentials for provider "openai" have been saved.
127+
128+
129+
130+ ### wp ai credentials delete
131+
132+ Deletes credentials for an AI provider.
133+
134+ ~~~
135+ wp ai credentials delete <provider>
136+ ~~~
137+
138+ ** OPTIONS**
139+
140+ <provider>
141+ The AI provider name (e.g., openai, anthropic, google).
142+
143+ ** EXAMPLES**
144+
145+ # Delete OpenAI credentials
146+ $ wp ai credentials delete openai
147+ Success: Credentials for provider "openai" have been deleted.
148+
149+
150+
151+ ### wp ai credentials list
152+
153+ Lists all stored AI provider credentials.
154+
155+ ~~~
156+ wp ai credentials list [--format=<format>]
157+ ~~~
158+
159+ ** OPTIONS**
160+
161+ [--format=<format>]
162+ Render output in a particular format.
163+ ---
164+ default: table
165+ options:
166+ - table
167+ - csv
168+ - json
169+ - yaml
170+ ---
171+
172+ ** EXAMPLES**
173+
174+ # List all credentials
175+ $ wp ai credentials list
176+ +----------+----------+
177+ | provider | api_key |
178+ +----------+----------+
179+ | openai | sk-***** |
180+ +----------+----------+
181+
182+
183+
184+ ### wp ai check
185+
186+ Checks if a prompt is supported for generation.
187+
188+ ~~~
189+ wp ai check <prompt> [--type=<type>]
190+ ~~~
191+
192+ ** OPTIONS**
193+
194+ <prompt>
195+ The prompt to check.
196+
197+ [--type=<type>]
198+ Type to check.
199+ ---
200+ options:
201+ - text
202+ - image
203+ ---
204+
205+ ** EXAMPLES**
206+
207+ # Check if text generation is supported
208+ $ wp ai check "Write a poem"
209+
210+ # Check if image generation is supported
211+ $ wp ai check "A sunset" --type=image
212+
213+
214+
215+ ### wp ai generate
216+
217+ Generates AI content.
218+
219+ ~~~
220+ wp ai generate <type> <prompt> [--model=<models>] [--provider=<provider>] [--temperature=<temperature>] [--top-p=<top-p>] [--top-k=<top-k>] [--max-tokens=<tokens>] [--system-instruction=<instruction>] [--destination-file=<file>] [--format=<format>]
221+ ~~~
222+
223+ ** OPTIONS**
224+
225+ <type>
226+ Type of content to generate.
227+ ---
228+ options:
229+ - text
230+ - image
231+ ---
232+
233+ <prompt>
234+ The prompt to send to the AI.
235+
236+ [--model=<models>]
237+ Comma-separated list of models in order of preference. Format: "provider,model" (e.g., "openai,gpt-4" or "openai,gpt-4,anthropic,claude-3").
238+
239+ [--provider=<provider>]
240+ Specific AI provider to use (e.g., "openai", "anthropic", "google").
241+
242+ [--temperature=<temperature>]
243+ Temperature for generation, typically between 0.0 and 1.0. Lower is more deterministic.
244+
245+ [--top-p=<top-p>]
246+ Top-p (nucleus sampling) parameter. Value between 0.0 and 1.0.
247+
248+ [--top-k=<top-k>]
249+ Top-k sampling parameter. Positive integer.
250+
251+ [--max-tokens=<tokens>]
252+ Maximum number of tokens to generate.
253+
254+ [--system-instruction=<instruction>]
255+ System instruction to guide the AI's behavior.
256+
257+ [--destination-file=<file>]
258+ For image generation, path to save the generated image.
259+
260+ [ --stdout]
261+ Output the whole image using standard output (incompatible with --destination-file=)
262+
263+ [--format=<format>]
264+ Output format for text.
265+ ---
266+ default: text
267+ options:
268+ - text
269+ - json
270+ ---
271+
272+ ** EXAMPLES**
273+
274+ # Generate text
275+ $ wp ai generate text "Explain WordPress in one sentence"
276+
277+ # Generate text with specific settings
278+ $ wp ai generate text "List 3 WordPress features" --temperature=0.1 --max-tokens=100
279+
280+ # Generate with top-p and top-k sampling
281+ $ wp ai generate text "Write a story" --top-p=0.9 --top-k=40
282+
283+ # Generate with model preferences
284+ $ wp ai generate text "Write a haiku" --model=openai,gpt-4,anthropic,claude-3
285+
286+ # Generate with system instruction
287+ $ wp ai generate text "Explain AI" --system-instruction="Explain as if to a 5-year-old"
288+
289+ # Generate image
290+ $ wp ai generate image "A minimalist WordPress logo" --output=wp-logo.png
291+
292+
293+
294+ ### wp ai status
295+
296+ Checks which AI capabilities are currently supported.
297+
12298~~~
13- wp hello-world
299+ wp ai status [--format=<format>]
14300~~~
15301
302+ Checks the environment and credentials to determine which AI operations
303+ are available. Displays a table showing supported capabilities.
304+
305+ ** OPTIONS**
306+
307+ [--format=<format>]
308+ Render output in a particular format.
309+ ---
310+ default: table
311+ options:
312+ - table
313+ - csv
314+ - json
315+ - yaml
316+ ---
317+
318+ ** EXAMPLES**
319+
320+ # Check AI status
321+ $ wp ai status
322+ +------------------+-----------+
323+ | Capability | Supported |
324+ +------------------+-----------+
325+ | Text Generation | Yes |
326+ | Image Generation | No |
327+ +------------------+-----------+
328+
16329## Installing
17330
18331Installing this package requires WP-CLI v2.12 or greater. Update to the latest stable release with ` wp cli update ` .
@@ -26,7 +339,7 @@ wp package install wp-cli/ai-command:@stable
26339To install the latest development version of this package, use the following command instead:
27340
28341``` bash
29- wp package install wp-cli/ai-command:dev-master
342+ wp package install wp-cli/ai-command:dev-main
30343```
31344
32345## Contributing
0 commit comments