module pixeltable.functions.together
View source on GitHub
Pixeltable UDFs that wrap various endpoints from the Together AI API. In order to use them, you must first pip install together and configure your Together AI credentials, as described in the Working with Together AI tutorial.
udf chat_completions()
chat/completions API endpoint. For additional details, see: https://docs.together.ai/reference/chat-completions-1
Request throttling: Applies the rate limit set in the config (section together.rate_limits, key chat). If no rate limit is configured, uses a default of 600 RPM.
Requirements:
pip install together
messages(Json): A list of messages comprising the conversation so far.model(String): The name of the model to query.model_kwargs(Json | None): Additional keyword arguments for the Togetherchat/completionsAPI. For details on the available parameters, see: https://docs.together.ai/reference/chat-completions-1
Json: A dictionary containing the response and other metadata.
mistralai/Mixtral-8x7B-v0.1 to an existing Pixeltable column tbl.prompt of the table tbl:
udf completions()
completions API endpoint. For additional details, see: https://docs.together.ai/reference/completions-1
Request throttling: Applies the rate limit set in the config (section together.rate_limits, key chat). If no rate limit is configured, uses a default of 600 RPM.
Requirements:
pip install together
prompt(String): A string providing context for the model to complete.model(String): The name of the model to query.model_kwargs(Json | None): Additional keyword arguments for the TogethercompletionsAPI. For details on the available parameters, see: https://docs.together.ai/reference/completions-1
Json: A dictionary containing the response and other metadata.
mistralai/Mixtral-8x7B-v0.1 to an existing Pixeltable column tbl.prompt of the table tbl:
udf embeddings()
embeddings API endpoint. For additional details, see: https://docs.together.ai/reference/embeddings-2
Request throttling: Applies the rate limit set in the config (section together.rate_limits, key embeddings). If no rate limit is configured, uses a default of 600 RPM.
Requirements:
pip install together
input(String): A string providing the text for the model to embed.model(String): The name of the embedding model to use.
Array[(None,), Float]: An array representing the application of the given embedding toinput.
togethercomputer/m2-bert-80M-8k-retrieval to an existing Pixeltable column tbl.text of the table tbl:
udf image_generations()
images/generations API endpoint. For additional details, see: https://docs.together.ai/reference/post_images-generations
Request throttling: Applies the rate limit set in the config (section together.rate_limits, key images). If no rate limit is configured, uses a default of 600 RPM.
Requirements:
pip install together
prompt(String): A description of the desired images.model(String): The model to use for image generation.model_kwargs(Json | None): Additional keyword args for the Togetherimages/generationsAPI. For details on the available parameters, see: https://docs.together.ai/reference/post_images-generations
Image: The generated image.
stabilityai/stable-diffusion-xl-base-1.0 to an existing Pixeltable column tbl.prompt of the table tbl: