openai

How can i chat with chatgpt using python

How can i chat with chatgpt using python Question: I asked ChatGPT to show me how could I use OpenAi’s API to interact with it in my terminal window and it generated code which I modified a little bit in order to do what I wanted. Here is the python code: import requests with open(‘../api-key.txt’,’r’) …

Total answers: 3

When I am testing OpenAPI via Python, I am getting the following error

OpenAI API: openai.api_key = os.getenv() not working Question: I am just trying some simple functions in Python with OpenAI APIs but running into an error: I have a valid API secret key which I am using. Code: >>> import os >>> import openai >>> openai.api_key = os.getenv("I have placed the key here") >>> response = …

Total answers: 2

Why is Zappa deploy missing all / most packages present in virtual environment?

Why is Zappa deploy missing all / most packages present in virtual environment? Question: Trying to deploy a python script to AWS via Zappa. Script works in local virtual environment (using virtualenv) but Zappa deploy fails with multiple missing packages. Must be missing something pretty fundamental despite extensive troubleshooting. Details below, any ideas appreciated. Error: …

Total answers: 1

Not answering for a long time. speech_recognition

Not answering for a long time. speech_recognition Question: So i have this code that will listen to you speech recognition and and answer using pyttsx3 and openai but the problem is speech_recognition gets everything right but it will give errors if i say gibberish or just mute. can please help me. me no English code: …

Total answers: 1

Call OpenAI API with Python requests is missing a model parameter

Call OpenAI API with Python requests is missing a model parameter Question: I’m trying to call OpenAI API from Python. I know they have their own openai package, but I want to use a generic solution. I chose the requests package for its flexibility. Here is my call >>> headers = {"Authorization": "Bearer xxx"} >>> …

Total answers: 1

How to extract required information using GPT-3 API

How to extract required information using GPT-3 API Question: I tried the steps mentioned in this article. https://matthewbilyeu.com/blog/2022-09-01/responding-to-recruiter-emails-with-gpt-3 There is a screenshot that says: Here’s an example from the OpenAI Playground. I typed all the text in "playground" but do not get similar response as shown in that image. I expected similar text like {"name":"William", …

Total answers: 3

How to get the items inside of an OpenAIobject in python?

How to get the items inside of an OpenAIobject in Python? Question: I would like to get the text inside this data structure that is outputted via GPT3 OpenAI. I’m using Python. When I print the object I get: <OpenAIObject text_completion id=cmpl-6F7ScZDu2UKKJGPXTiTPNKgfrikZ at 0x7f7648cacef0> JSON: { "choices": [ { "finish_reason": "stop", "index": 0, "logprobs": null, …

Total answers: 2

slash commands not working with openai with discod bot

slash commands not working with openai with discod bot Question: I have this command on my personnal bot that generates a image based on a discord users prompt but when i make it into a slash command, there is an error, i have done tests and the image is fine but it never sends the …

Total answers: 2

Attribute Error: openai has no attribute Image

Attribute Error: openai has no attribute Image Question: So I was getting my hands-on on the new DALL.E api for Python which has been made public. I was getting the Attribution Error as it was not detecting the Image model in Open ai after running the following code: response = openai.Image.create( prompt="a white siamese cat", …

Total answers: 2

trouble retrieving value from list inside a python dictionary

trouble retrieving value from list inside a python dictionary Question: So I am developing a discord bot in python with py-cord and I have implemented the openai api to allow users to query the AI and modify the different weights and biases. What I am trying to do is make the weights specific to each …

Total answers: 1