LLM Mesh#

For usage information and examples, please see LLM Mesh

class dataikuapi.dss.llm.DSSLLM(client, project_key, llm_id)#

A handle to interact with a DSS-managed LLM.

Important

Do not create this class directly, use dataikuapi.dss.project.DSSProject.get_llm() instead.

new_completion()#

Create a new completion query.

Returns:

A handle on the generated completion query.

Return type:

DSSLLMCompletionQuery

new_completions()#

Create a new multi-completion query.

Returns:

A handle on the generated multi-completion query.

Return type:

DSSLLMCompletionsQuery

new_embeddings()#

Create a new embedding query.

Returns:

A handle on the generated embeddings query.

Return type:

DSSLLMEmbeddingsQuery

class dataikuapi.dss.llm.DSSLLMListItem(client, project_key, data)#

An item in a list of llms

Important

Do not instantiate this class directly, instead use dataikuapi.dss.project.DSSProject.list_llms().

to_llm()#

Convert the current item.

Returns:

A handle for the llm.

Return type:

dataikuapi.dss.llm.DSSLLM

property id#
Returns:

The id of the llm.

Return type:

string

property type#
Returns:

The type of the LLM

Return type:

string

property description#
Returns:

The description of the LLM

Return type:

string

class dataikuapi.dss.llm.DSSLLMCompletionsQuery(llm)#

A handle to interact with a multi-completion query. Completion queries allow you to send a prompt to a DSS-managed LLM and retrieve its response.

Important

Do not create this class directly, use dataikuapi.dss.llm.DSSLLM.new_completion() instead.

property settings#
Returns:

The completion query settings.

Return type:

dict

new_completion()#
execute()#

Run the completions query and retrieve the LLM response.

Returns:

The LLM response.

Return type:

DSSLLMCompletionsResponse

class dataikuapi.dss.llm.DSSLLMCompletionsQuerySingleQuery#
with_message(message, role='user')#

Add a message to the completion query.

Parameters:
  • message (str) – The message text.

  • role (str) – The message role. Use system to set the LLM behavior, assistant to store predefined responses, user to provide requests or comments for the LLM to answer to. Defaults to user.

class dataikuapi.dss.llm.DSSLLMCompletionsResponse(raw_resp)#

A handle to interact with a multi-completion response.

Important

Do not create this class directly, use dataikuapi.dss.llm.DSSLLMCompletionsQuery.execute() instead.

property responses#

The array of responses

class dataikuapi.dss.llm.DSSLLMCompletionQuery(llm)#

A handle to interact with a completion query. Completion queries allow you to send a prompt to a DSS-managed LLM and retrieve its response.

Important

Do not create this class directly, use dataikuapi.dss.llm.DSSLLM.new_completion() instead.

property settings#
Returns:

The completion query settings.

Return type:

dict

with_message(message, role='user')#

Add a message to the completion query.

Parameters:
  • message (str) – The message text.

  • role (str) – The message role. Use system to set the LLM behavior, assistant to store predefined responses, user to provide requests or comments for the LLM to answer to. Defaults to user.

execute()#

Run the completion query and retrieve the LLM response.

Returns:

The LLM response.

Return type:

DSSLLMCompletionResponse

execute_streamed()#

Prevent documentation as it’s still preview. :meta private:

class dataikuapi.dss.llm.DSSLLMCompletionResponse(raw_resp)#

A handle to interact with a completion response.

Important

Do not create this class directly, use dataikuapi.dss.llm.DSSLLMCompletionQuery.execute() instead.

property success#
Returns:

The outcome of the completion query.

Return type:

bool

property text#
Returns:

The raw text of the LLM response.

Return type:

str

class dataikuapi.dss.llm.DSSLLMEmbeddingsQuery(llm)#

A handle to interact with an embedding query. Embedding queries allow you to transform text into embedding vectors using a DSS-managed model.

Important

Do not create this class directly, use dataikuapi.dss.llm.DSSLLM.new_embeddings() instead.

add_text(text)#

Add text to the embedding query.

Parameters:

text (str) – Text to add to the query.

add_image(image_base64)#

Add an image to the embedding query.

Parameters:

image_base64 (str) – Image content, as a base 64 formatted string.

execute()#

Run the embedding query.

Returns:

The results of the embedding query.

Return type:

DSSLLMEmbeddingsResponse

class dataikuapi.dss.llm.DSSLLMEmbeddingsResponse(raw_resp)#

A handle to interact with an embedding query result.

Important

Do not create this class directly, use dataikuapi.dss.llm.DSSLLMEmbeddingsQuery.execute() instead.

get_embeddings()#

Retrieve vectors resulting from the embeddings query.

Returns:

A list of lists containing all embedding vectors.

Return type:

list

class dataikuapi.dss.knowledgebank.DSSKnowledgeBankListItem(client, data)#

An item in a list of knowledege banks

Important

Do not instantiate this class directly, instead use dataikuapi.dss.project.DSSProject.list_knowledge_banks().

to_knowledge_bank()#

Convert the current item.

Returns:

A handle for the knowledge_bank.

Return type:

dataikuapi.dss.knowledgebank.DSSKnowledgeBank

as_core_knowledge_bank()#

Get the dataiku.KnowledgeBank object corresponding to this knowledge bank

Return type:

dataiku.KnowledgeBank

property project_key#
Returns:

The project

Return type:

string

property id#
Returns:

The id of the knowledge bank.

Return type:

string

property name#
Returns:

The name of the knowledge bank.

Return type:

string

class dataikuapi.dss.knowledgebank.DSSKnowledgeBank(client, project_key, id)#

A handle to interact with a DSS-managed knowledge bank.

Important

Do not create this class directly, use dataikuapi.dss.project.DSSProject.get_knowledge_bank() instead.

as_core_knowledge_bank()#

Get the dataiku.KnowledgeBank object corresponding to this knowledge bank

Return type:

dataiku.KnowledgeBank

class dataiku.KnowledgeBank(id, project_key=None)#

This is a handle to interact with a Dataiku Knowledge Bank flow object

as_langchain_retriever(search_type='similarity', search_kwargs={})#

Get this Knowledge bank as a Langchain Retriever object

as_langchain_vectorstore()#

Get this Knowledge bank as a Langchain Vectorstore object