Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Made by Taylor Christian Newsome Twitter.com/ClumsyLulz This script sets up google bard on the command line in powershell
- $prompt = Read-Host "Enter your prompt for Google Bard:"
- $url = "https://api.ailab.io/v1/dialog"
- $headers = New-Object System.Collections.Generic.Dictionary[[string], [string]]
- $headers.Add("Content-Type", "application/json")
- $body = New-Object PSObject
- $body.prompt = $prompt
- $request = New-Object System.Net.Http.HttpClient
- $response = $request.PostAsync($url, (ConvertTo-Json -InputObject $body)).Result
- if ($response.StatusCode -eq 200) {
- $responseBody = $response.Content.ReadAsStringAsync().Result | ConvertFrom-Json
- Write-Output "Google Bard's response:"
- Write-Output $responseBody.data.text
- } else {
- Write-Output "Error: Failed to send request to Google Bard API."
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement