Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tlm/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ async def inference(
rag=(context is not None),
constrain_outputs=config_input.constrain_outputs,
)
config = Config.from_input(config_input, workflow_type)
model = openai_args.get("model")
config = Config.from_input(config_input, workflow_type, model)
return await tlm_inference(
completion_params=openai_args,
response=response,
Expand Down
7 changes: 6 additions & 1 deletion tlm/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
from tlm.config.provider import ModelProvider
from tlm.types import SimilarityMeasure

from tlm.config.defaults import get_settings

settings = get_settings()


class ReferenceCompletionConfigInput(BaseModel):
num_reference_completions: int | None = Field(
Expand Down Expand Up @@ -109,7 +113,7 @@ class BaseConfig(

class Config(BaseConfig):
@classmethod
def from_input(cls, input: ConfigInput, workflow_type: WorkflowType) -> "Config":
def from_input(cls, input: ConfigInput, workflow_type: WorkflowType, model: str | None) -> "Config":
defaults_for_quality = DEFAULT_CONFIG_FOR_QUALITY[input.quality_preset]
defaults_for_workflow = DEFAULT_CONFIG_FOR_QUALITY_AND_WORKFLOW[input.quality_preset].get(
workflow_type
Expand All @@ -120,6 +124,7 @@ def from_input(cls, input: ConfigInput, workflow_type: WorkflowType) -> "Config"
params = {
"reasoning_effort": reasoning_default,
"use_prompt_evaluation": workflow_type == WorkflowType.RAG,
"model": model or settings.DEFAULT_MODEL,
**defaults_for_quality,
**defaults_for_workflow,
"similarity_measure": SimilarityMeasure.for_workflow(workflow_type),
Expand Down
Loading