Learn how to query our open-source chat models.
chat.completions.create
to send a single query to a chat model:
create
method takes in a model name and a messages
array. Each message
is an object that has the content of the query, as well as a role for the message’s author.
In the example above, you can see that we’re using “user” for the role. The “user” role tells the model that this message comes from the end user of our system – for example, a customer using your chatbot app.
The other two roles are “assistant” and “system”, which we’ll talk about next.
messages
array, denoting the user-provided queries with the “user” role, and the model’s responses with the “assistant” role:
stream
option to true.
AsyncTogether
module: