Skip to content

Call ChatGPT

Integrate system functions with ChatGPT by calling the ChatGPT interface

Parameter Configuration

ParameterDescription
API AddressInterface address for calling ChatGPT, can be dynamically calculated and specified using expressions
API KeyInterface secret key used by the API interface, can be dynamically calculated and specified using expressions
Timeout (seconds)Timeout time for calling the ChatGPT interface, 0 means no timeout, wait for interface return
temperatureValue between 0-2, larger values make answers more random
top_pNucleus sampling, value between 0-1, 0.1 means only consider tokens that make up the top 10% probability mass
Maximum token count returnedEach Chinese character occupies one token, the total number of input and output tokens cannot exceed 4096
presence_penaltyNumber between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear so far in the text, increasing the likelihood that the model will talk about new topics
frequency_penaltyNumber between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text, reducing the likelihood that the model will repeat the same line verbatim
Stop WordsStop generation when encountering the following words, multiple stop words are separated by commas. Maximum 4, can be dynamically calculated and specified using expressions
Number of answers generatedStop generation when encountering the following words, multiple stop words are separated by commas. Maximum 4, can be dynamically calculated and specified using expressions
Content sentPrompt content sent to ChatGPT, can be dynamically calculated and specified using expressions

Return Values

Notes

  • Api Key Can be generated through https://platform.openai.com/account/api-keys

    • Api Key cannot be viewed again after generation, needs to be deleted and recreated, please keep Api Key properly
    • Do not share your API key with others, or expose it in browser or other client-side code
  • role field, which are system representing the system, user representing the user, and assistant representing the AI's answer

    - When role is ``system``
    
      The content represents an instruction we give to AI, that is, telling AI how to answer the user's questions. For example, if we want AI to answer in Chinese, we can write "You are an assistant who only answers questions in Chinese" in content, so that even if the user's questions are all in English, the AI's replies will be in Chinese
    - When role is ``user`` or ``assistant``
    
      The content represents the content of the conversation between the user and AI. Need to send the historical conversation together to OpenAI's interface so that it can understand the context of the entire conversation
    

Usage Scenarios

  • Call OpenAI to parse data based on context content
  • Call OpenAI to summarize and extract outlines based on context content
  • Call OpenAI to generate formatted data for system entry based on context content