API Reference
TurnWiseClient
Main client for interacting with TurnWise.Constructor
turnwise_api_key(str): Your TurnWise API keyopenrouter_api_key(str): Your OpenRouter API keyturnwise_base_url(Optional[str]): Custom base URL (defaults to production)default_model(str): Default model for evaluations
Methods
verify()
Verify API key and connection.list_datasets()
List all datasets for the authenticated user.get_conversations(dataset_id)
Get all conversations for a dataset.get_pipelines(dataset_id)
Get all evaluation pipelines for a dataset.register_metric(dataset_id, metric)
Register a metric in TurnWise.evaluate(dataset_id, metric, …)
Run evaluation on a dataset.dataset_id(int): Dataset ID to evaluatemetric(Metric): Metric definitionmax_concurrent(int): Maximum concurrent evaluationsauto_sync(bool): Automatically sync results to TurnWiseprogress_callback(Optional[Callable]): Progress callback function
List[EvaluationResult]
sync_results(results)
Manually sync evaluation results to TurnWise.close()
Close the client and cleanup resources.Metric
Definition of an evaluation metric.Constructor
name(str): Metric nameprompt(str): Evaluation prompt (supports@VARIABLEsyntax)evaluation_level(EvaluationLevel): Level to evaluate atoutput_type(OutputType): Type of outputdescription(Optional[str]): Metric descriptionoutput_schema(Optional[Dict]): JSON schema for JSON output typemodel_name(Optional[str]): Model to use (overrides default)aggregate_results(bool): Aggregate step results to message levelnode_id(Optional[int]): Existing node ID (for reusing metrics)pipeline_id(Optional[int]): Pipeline ID (for reusing metrics)
EvaluationLevel
Enumeration of evaluation levels.OutputType
Enumeration of output types.EvaluationResult
Result of an evaluation.Properties
entity_id(int): ID of evaluated entityentity_type(str): Type of entity (“conversation”, “message”, “step”)result(Any): Raw evaluation resultmetadata(Dict): Additional metadata
Methods
get_score()
Extract score from result.EvaluationOrchestrator
Lower-level orchestrator for manual evaluation control.Constructor
llm_provider(LLMProvider): LLM provider instancedefault_model(str): Default model nameextract_goals(bool): Whether to extract goals from conversations