Skip to content

Commit

Permalink
1.0.56 (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski authored Mar 26, 2024
1 parent bdb2414 commit 89e3f5a
Show file tree
Hide file tree
Showing 14 changed files with 2,567 additions and 72 deletions.
2 changes: 2 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ dependencies {

implementation(group = "com.simiacryptus", name = "jo-penai", version = "1.0.49")

implementation("org.apache.commons:commons-text:1.11.0")

implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.9")
implementation(group = "commons-io", name = "commons-io", version = "2.15.0")
implementation(group = "com.google.guava", name = "guava", version = "32.1.3-jre")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.simiacryptus.jopenai.models.ChatModels
import com.simiacryptus.jopenai.util.ClientUtil.toContentList
import com.simiacryptus.skyenet.core.OutputInterceptor
import com.simiacryptus.skyenet.interpreter.Interpreter
import org.apache.commons.text.StringEscapeUtils.escapeHtml4
import java.util.*
import javax.script.ScriptException
import kotlin.reflect.KClass
Expand Down Expand Up @@ -310,7 +311,7 @@ open class CodingActor(
Role.assistant,
"""
|```${language.lowercase()}
|${previousCode}
|${previousCode?.let { escapeHtml4(it).indent(" ") }}
|```
|""".trimMargin().trim().toContentList()
),
Expand All @@ -320,7 +321,7 @@ open class CodingActor(
|The previous code failed with the following error:
|
|```
|${error.message?.trim() ?: ""}
|${error.message?.trim() ?: ""?.let { escapeHtml4(it).indent(" ") }}
|```
|
|Correct the code and try again.
Expand Down Expand Up @@ -392,9 +393,9 @@ open class CodingActor(
fun getRenderedResponse(respondWithCode: List<Pair<String, String>>, defaultLanguage: String = "") =
respondWithCode.joinToString("\n") {
when (it.first) {
"code" -> "```$defaultLanguage\n${it.second}\n```"
"text" -> it.second
else -> "```${it.first}\n${it.second}\n```"
"code" -> "```$defaultLanguage\n${it.second?.let { escapeHtml4(it).indent(" ") }}\n```"
"text" -> it.second?.let { escapeHtml4(it).indent(" ") }.toString()
else -> "```${it.first}\n${it.second?.let { escapeHtml4(it).indent(" ") }}\n```"
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.simiacryptus.skyenet.core.actors

import com.simiacryptus.skyenet.core.actors.CodingActor.Companion.indent

class MultiExeption(exceptions: Collection<Throwable>) : RuntimeException(
exceptions.joinToString("\n\n") { "```text\n${it.stackTraceToString()}\n```" }
exceptions.joinToString("\n\n") { "```text\n${/*escapeHtml4*/(it.stackTraceToString()).indent(" ")}\n```" }
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.simiacryptus.jopenai.describe.TypeDescriber
import com.simiacryptus.jopenai.models.ChatModels
import com.simiacryptus.jopenai.util.ClientUtil.toContentList
import com.simiacryptus.jopenai.util.JsonUtil
import com.simiacryptus.skyenet.core.actors.CodingActor.Companion.indent
import java.util.function.Function

open class ParsedActor<T : Any>(
Expand Down Expand Up @@ -68,7 +69,7 @@ open class ParsedActor<T : Any>(
|
|This is an example output:
|```json
|${JsonUtil.toJson(exampleInstance!!)}
|${JsonUtil.toJson(exampleInstance!!).indent(" ")}
|```
|
""".trimMargin()
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Gradle Releases -> https://github.com/gradle/gradle/releases
libraryGroup = com.simiacryptus.skyenet
libraryVersion = 1.0.55
libraryVersion = 1.0.56
gradleVersion = 7.6.1
Loading

0 comments on commit 89e3f5a

Please sign in to comment.