deepseek
pixeltable.functions.deepseek
chat_completions
async
chat_completions(
messages: Json,
*,
model: String,
frequency_penalty: Optional[Float] = None,
logprobs: Optional[Bool] = None,
top_logprobs: Optional[Int] = None,
max_tokens: Optional[Int] = None,
presence_penalty: Optional[Float] = None,
response_format: Optional[Json] = None,
stop: Optional[Json] = None,
temperature: Optional[Float] = None,
tools: Optional[Json] = None,
tool_choice: Optional[Json] = None,
top_p: Optional[Float] = None
) -> Json
Creates a model response for the given chat conversation.
Equivalent to the Deepseek chat/completions
API endpoint.
For additional details, see: https://api-docs.deepseek.com/api/create-chat-completion
Deepseek uses the OpenAI SDK, so you will need to install the openai
package to use this UDF.
Requirements:
pip install openai
Parameters:
-
messages
(Json
) –A list of messages to use for chat completion, as described in the Deepseek API documentation.
-
model
(String
) –The model to use for chat completion.
For details on the other parameters, see: https://api-docs.deepseek.com/api/create-chat-completion
Returns:
-
Json
–A dictionary containing the response and other metadata.
Examples:
Add a computed column that applies the model deepseek-chat
to an existing Pixeltable column tbl.prompt
of the table tbl
:
>>> messages = [
{'role': 'system', 'content': 'You are a helpful assistant.'},
{'role': 'user', 'content': tbl.prompt}
]
tbl.add_computed_column(response=chat_completions(messages, model='deepseek-chat'))