All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.xebia.functional.xef.mlflow.models.kt Maven / Gradle / Ivy

The newest version!
package com.xebia.functional.xef.mlflow

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable data class RoutesResponse(val routes: List)

@Serializable
data class RouteDefinition(
  val name: String,
  @SerialName("route_type") val routeType: String,
  val model: RouteModel,
  @SerialName("route_url") val routeUrl: String,
)

@Serializable
data class RouteModel(
  val name: String,
  val provider: String,
)

@Serializable
data class Prompt(
  val prompt: String,
  val temperature: Double? = null,
  @SerialName("candidate_count") val candidateCount: Int? = null,
  val stop: List? = null,
  @SerialName("max_tokens") val maxTokens: Int? = null
)

@Serializable data class CandidateMetadata(@SerialName("finish_reason") val finishReason: String?)

@Serializable data class PromptCandidate(val text: String, val metadata: CandidateMetadata?)

@Serializable
enum class RouteType {
  @SerialName("llm/v1/completions") COMPLETIONS,
  @SerialName("llm/v1/chat") CHAT,
  @SerialName("llm/v1/embeddings") EMBEDDINGS
}

@Serializable
data class ResponseMetadata(
  val model: String,
  @SerialName("route_type") val routeType: RouteType,
  @SerialName("input_tokens") val inputTokens: Int? = null,
  @SerialName("output_tokens") val outputTokens: Int? = null,
  @SerialName("total_tokens") val totalTokens: Int? = null
)

@Serializable
data class PromptResponse(val candidates: List, val metadata: ResponseMetadata)

@Serializable data class ValidationDetail(val msg: String, val type: String)

@Serializable data class ValidationError(val detail: List?)

@Serializable
enum class ChatRole {
  @SerialName("system") SYSTEM,
  @SerialName("user") USER,
  @SerialName("assistant") ASSISTANT
}

@Serializable data class ChatMessage(val role: ChatRole, val content: String)

@Serializable
data class Chat(
  val messages: List,
  val temperature: Double? = null,
  @SerialName("candidate_count") val candidateCount: Int? = null,
  val stop: List? = null,
  @SerialName("max_tokens") val maxTokens: Int? = null
)

@Serializable data class ChatCandidate(val message: ChatMessage, val metadata: CandidateMetadata)

@Serializable
data class ChatResponse(val candidates: List, val metadata: ResponseMetadata)

@Serializable data class Embeddings(val text: List)

@Serializable
data class EmbeddingsResponse(val embeddings: List>, val metadata: ResponseMetadata)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy