The Invoke-ChatCompletion command in PSAISuite supports piping data directly into the function as context. This allows you to use the output of any command or file as additional context for your chat prompt.
- Any data piped into
Invoke-ChatCompletionis treated as context and prepended to your main prompt message. - The context is sent as a user message before your main prompt, giving the AI model more information.
Get-Content .\README.md | Invoke-ChatCompletion -Messages "Summarize this document." -Model "openai:gpt-4o-mini""This is context from the pipeline" | Invoke-ChatCompletion -Messages "Explain the context." -Model "openai:gpt-4o-mini"Get-Process | Out-String | Invoke-ChatCompletion -Messages "What processes are running?" -Model "openai:gpt-4o-mini"- The piped context is always prepended to the messages you provide via the
-Messagesparameter. - You can use this feature to summarize, analyze, or ask questions about any data accessible from PowerShell.
You can use the shorter icc alias instead of typing Invoke-ChatCompletion:
icc -Messages "Your prompt here" -Model "openai:gpt-4o-mini"All examples above work the same way with icc.
When using the -Model parameter with icc (or Invoke-ChatCompletion), you can use tab completion to quickly select available providers and models. Start typing a provider (like openai: or github:) and press Tab to see suggestions.
For more details, see the Invoke-ChatCompletion help or the main documentation.