#To customize gpt.

1 messages · Page 1 of 1 (latest)

sturdy turret
#

How can I have my own api in my chatgpt account with python and customize top P, frequency penalty.

solar gulchBOT
#

Hi @sturdy turret. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To customize parameters such as top_p and frequency_penalty in your ChatGPT API calls, you can include these parameters in your API request. However, it's important to note that custom GPT models are exclusive to the ChatGPT Plus ecosystem and are not accessible via the API. You would need to develop your own code-based solution using API models that offer the same techniques.

Here's an example of how you can customize top_p and frequency_penalty in a Python script using the OpenAI API:

import openai

openai.api_key = 'your-api-key'

response = openai.Completion.create(
  engine="text-davinci-003",
  prompt="Translate the following English text to French: '{}'",
  max_tokens=60,
  top_p=0.9,
  frequency_penalty=0.5
)

In this example, top_p is set to 0.9 and frequency_penalty is set to 0.5. You can adjust these values according to your needs. Please note that the top_p parameter's value range is from 0 to 1.

Remember to replace 'your-api-key' with your actual OpenAI API key.

Sources:


Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: