· last year · Nov 07, 2023, 12:45 PM
1#!/data/data/com.termux/files/use/bin/bash
2
3# Set the API key and prompt
4API_KEY="AIzaSyBCjs52Ge752uS0_jwhONKt-fSB82jG1lE"
5PROMPT="What would you like to talk about?"
6
7# Send the prompt to the Bard AI API and get the response
8RESPONSE=$(curl -X POST https://api.bard.ai/v1/chatbot \
9 -H "Authorization: Bearer $API_KEY" \
10 -H "Content-Type: application/json" \
11 -d "{\"prompt\":\"$PROMPT\"}" \
12 | jq -r '.response.messages[0].text')
13
14# Print the response to the console
15echo $RESPONSE