Unit Runtime
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
For examples:
- generate a "Hello, world" and send to Kotlin Repl
@RestController
object Pages {
@GetMapping("/")
fun main() = "Hello World!"
}
- 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
- Backend
- Kotlin
- basic REPL
- Spring Boot framework based on https://github.com/JetBrains/kotless
- Ktor framework based on https://github.com/JetBrains/kotless
- TypeScript
- basic REPL
- Deno with Hono
- Java
- Python
- Kotlin
- Frontend
- React with TypeScript and Babel
- Vue
- [ ]Angular
Development
- git clone
https://github.com/prompt-engineering/unit-runtime
./gradlew bootRun
API:
LICENSE
This code is distributed under the MIT license. See LICENSE in this directory.