diff --git a/gpt4all-kotlin/src/jvmMain/kotlin/com/xebia/functional/gpt4all/Gpt4AllRuntime.kt b/gpt4all-kotlin/src/jvmMain/kotlin/com/xebia/functional/gpt4all/Gpt4AllRuntime.kt index 6162a4bfe..04edf7b48 100644 --- a/gpt4all-kotlin/src/jvmMain/kotlin/com/xebia/functional/gpt4all/Gpt4AllRuntime.kt +++ b/gpt4all-kotlin/src/jvmMain/kotlin/com/xebia/functional/gpt4all/Gpt4AllRuntime.kt @@ -24,7 +24,7 @@ suspend inline fun AI.getOrElse(crossinline orElse: suspend (AIError) -> * @see getOrElse for an operator that allow directly handling the [AIError] case instead of * throwing. */ -suspend inline fun AI.getOrThrow(): A = getOrElse { throw it } +suspend inline fun AI.getOrThrow(): A = getOrElse { throw it } /** * Run the [AI] value to produce _either_ an [AIError], or [A]. this method initialises all the @@ -34,7 +34,7 @@ suspend inline fun AI.getOrThrow(): A = getOrElse { throw it } * * @see getOrElse for an operator that allow directly handling the [AIError] case. */ -suspend inline fun AI.toEither(): Either = +suspend inline fun AI.toEither(): Either = Either.catchOrThrow { getOrThrow() } suspend fun AIScope(block: AI, orElse: suspend (AIError) -> A): A = diff --git a/openai/src/commonMain/kotlin/com/xebia/functional/xef/auto/llm/openai/OpenAIRuntime.kt b/openai/src/commonMain/kotlin/com/xebia/functional/xef/auto/llm/openai/OpenAIRuntime.kt index 6b95a7a8b..7ffc26f6d 100644 --- a/openai/src/commonMain/kotlin/com/xebia/functional/xef/auto/llm/openai/OpenAIRuntime.kt +++ b/openai/src/commonMain/kotlin/com/xebia/functional/xef/auto/llm/openai/OpenAIRuntime.kt @@ -27,7 +27,7 @@ suspend inline fun AI.getOrElse(crossinline orElse: suspend (AIError) -> * @see getOrElse for an operator that allow directly handling the [AIError] case instead of * throwing. */ -suspend inline fun AI.getOrThrow(): A = getOrElse { throw it } +suspend inline fun AI.getOrThrow(): A = getOrElse { throw it } /** * Run the [AI] value to produce _either_ an [AIError], or [A]. this method initialises all the @@ -37,8 +37,7 @@ suspend inline fun AI.getOrThrow(): A = getOrElse { throw it } * * @see getOrElse for an operator that allow directly handling the [AIError] case. */ -suspend inline fun AI.toEither(): Either = - Either.catchOrThrow { getOrThrow() } +suspend inline fun AI.toEither(): Either = Either.catchOrThrow { getOrThrow() } suspend fun AIScope(block: AI, orElse: suspend (AIError) -> A): A = try {