当前位置:   article > 正文

使用Python调用ChatGPT_python flask调用chatgpt流式stream接口 eventsourcerespons

python flask调用chatgpt流式stream接口 eventsourceresponse

import openai

# Set up the OpenAI API client

openai.api_key = "你的KEY"

# Set up the model and prompt

model_engine = "ada"

prompt = input('请输入字符串:')

# Generate a response

completion = openai.Completion.create(

engine=model_engine,

prompt=prompt,

max_tokens=1024,

n=1,

stop=None,

temperature=0.5,

)

response = completion.choices[0].text

print(response)

ChatGPT国内体验网址 https://1bit.asia

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/70580
推荐阅读
相关标签
  

闽ICP备14008679号