dataflow.api.base¶

Attributes¶

Classes¶

LLMConfigRequest

Request model for LLM configuration.

LLMGenerationResponse

Response model for LLM generation.

ToolConfig

Configuration for a tool to be used with the LLM.

Functions¶

generate_response(request[, query])

Generate a response using dynamically configured LLM.

get_env_api_key(provider)

Retrieve API key from environment variables based on provider.

root()

Root.

Module Contents¶

class dataflow.api.base.LLMConfigRequest(/, **data: Any)¶

Bases: pydantic.BaseModel

Request model for LLM configuration.

Parameters:

data (Any)

api_key: str | None = None¶
extra_params: dict[str, Any] | None = None¶
model: str = None¶
model_config¶

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

provider: haive.dataflow.api.models.llm.provider_types.LLMProvider = None¶
system_prompt: str | None = None¶
temperature: float | None = None¶
tools: list[ToolConfig] | None = None¶
class dataflow.api.base.LLMGenerationResponse(/, **data: Any)¶

Bases: pydantic.BaseModel

Response model for LLM generation.

Parameters:

data (Any)

model: str = None¶
model_config¶

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

provider: haive.dataflow.api.models.llm.provider_types.LLMProvider = None¶
response: str = None¶
class dataflow.api.base.ToolConfig(/, **data: Any)¶

Bases: pydantic.BaseModel

Configuration for a tool to be used with the LLM.

Parameters:

data (Any)

description: str | None = None¶
model_config¶

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str = None¶
result: str | None = None¶
async dataflow.api.base.generate_response(request: LLMConfigRequest, query: str = Query(..., description='The input query or message to generate a response for'))¶

Generate a response using dynamically configured LLM.

Parameters:
  • request (LLMConfigRequest) – LLM configuration details

  • query (str) – User’s input query

dataflow.api.base.get_env_api_key(provider: haive.dataflow.api.models.llm.provider_types.LLMProvider) str | None¶

Retrieve API key from environment variables based on provider.

Parameters:

provider (haive.dataflow.api.models.llm.provider_types.LLMProvider)

Return type:

str | None

async dataflow.api.base.root()¶

Root.

dataflow.api.base.AI_MODELS¶
dataflow.api.base.app¶