# pip install openai from openai import OpenAI # openai==1.52.2 client = OpenAI( api_key="UPSTAGE_API_KEY", base_url="https://api.upstage.ai/v1" ) stream = client.chat.completions.create( model="solar-pro", messages=[ { "role": "user", "content": "Hi, how are you?" } ], stream=True, ) for chunk in stream: if chunk.choices[0].delta.content is not None: print(chunk.choices[0].delta.content, end="") # Use with stream=False # print(stream.choices[0].message.content)
🎉
Sign up to receive $10 free credit!
We use cookies to improve your experience on www.upstage.ai. By continuing to browse, you agree to our use of cookies.