/unit-runtime

Unit Runtime 是一个 ChatGPT 等 AI 代码的运行环境,可一键启动并实时交互,帮助您快速构建和测试 AI 代码。Unit Runtime is an efficient and user-friendly AI code execution environment that allows for one-click startup and real-time interaction, helping you quickly build and test AI code.

Primary LanguageKotlinMIT LicenseMIT

Unit Runtime

CI

Unit Runtime is an efficient and user-friendly AI code execution environment that allows for one-click startup and real-time interaction, helping you quickly build and test AI code.

Workflow:

sequenceDiagram
    participant Human
    participant LLM/ChatGPT
    participant Unit Runtime
    participant Language REPL

    Human->>+LLM/ChatGPT: Provide prompt for generated code
    LLM/ChatGPT->>+Unit Runtime: Provide code snippets/units
    Unit Runtime->>+Language REPL: Compile and return
    Language REPL-->>-Unit Runtime: Output result
    Unit Runtime-->>-LLM/ChatGPT: Display processing result
    LLM/ChatGPT-->>-Human: Verify/modify code
Loading

For examples:

  1. generate a "Hello, world" and send to Kotlin Repl
@RestController
object Pages {
   @GetMapping("/")
   fun main() = "Hello World!"
}
  1. will start a server like: http://localhost:10043 , you can test and verify it.

Websocket API

server: ws://localhost:8080/repl

input:

@Serializable
data class InterpreterRequest(
    var id: Int = -1,
    val code: String,
    val language: String = "kotlin",
    val framework: String = "spring",
    val history: Boolean = false
)

output:

@Serializable
data class Message(
    var id: Int = -1,
    var resultValue: String,
    var className: String = "",
    var msgType: MessageType = MessageType.NONE,
    var content: MessageContent? = null,
)

Todos

Development

  1. git clone https://github.com/prompt-engineering/unit-runtime
  2. ./gradlew bootRun

API:

LICENSE

This code is distributed under the MIT license. See LICENSE in this directory.