Skip to content

Commit

Permalink
Merge main into sweep/add-sweep-config
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Jan 23, 2024
2 parents 33cb407 + 20b80cd commit a8c4cd2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ object LLMServiceClient {

inline fun <reified T : Any> run(task: String, request: T): JsonNode = runBlocking {
val response: String = try {
async {
async(Dispatchers.Unconfined) {
client.post("${llmServiceUrl}/$task") {
contentType(ContentType.Application.Json)
setBody(jsonMapper.writeValueAsString(request))
}.body() as String
}.await()
} catch (e: Exception) {
throw LLMClientException()
throw LLMClientException(e)
}

jsonMapper.readTree(response)
}

class LLMClientException: RuntimeException("LLM request failed")
class LLMClientException(e: Exception) : RuntimeException("LLM request failed", e)

}

0 comments on commit a8c4cd2

Please sign in to comment.