You can interact with AI Chat directly from your terminal using the PW CLI. The CLI provides an interactive chat session that connects to your configured AI providers without needing to open the web interface.
Before using AI Chat from the CLI, ensure:
pw auth login).To start an interactive chat session, run:
pw ai-chat chat [provider-name]Replace [provider-name] with the name of the AI Chat provider you want to use. This argument is required.
The CLI connects to the specified provider and opens an interactive prompt where you can type messages and receive responses.
Once the session starts, you will see a prompt:
AI chat — type your prompt and hit Enter (Ctrl-C to quit)
you>
Type your message and press Enter to send it. The AI response is printed to the terminal prefixed with AI>.
you> What is the capital of France?
AI> The capital of France is Paris.
you>
The session maintains conversation history, so follow-up messages have context from earlier in the conversation.
pw ai-chat chat my-azure-provideryou> Explain the difference between TCP and UDP in two sentences.
AI> TCP is a connection-oriented protocol that guarantees reliable, ordered
delivery of data through acknowledgments and retransmissions. UDP is a
connectionless protocol that sends data without establishing a connection
or guaranteeing delivery, making it faster but less reliable.
pw ai-chat chat my-provideryou> I'm writing a Python script to parse CSV files. What library should I use?
AI> The built-in csv module is a good choice for simple CSV parsing. For more
complex operations like filtering, grouping, or handling large files,
consider using pandas.
you> Show me an example using the csv module.
AI> Here is a basic example:
...