Skip to content

Commit

Permalink
1.2.5 (#103)
Browse files Browse the repository at this point in the history
* 1.2.5

* updates
  • Loading branch information
acharneski authored Sep 25, 2024
1 parent 56b8e63 commit 22fc44e
Show file tree
Hide file tree
Showing 40 changed files with 1,490 additions and 166 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Gradle Releases -> https://github.com/gradle/gradle/releases
libraryGroup = com.simiacryptus.skyenet
libraryVersion = 1.2.4
libraryVersion = 1.2.5
gradleVersion = 7.6.1
kotlin.daemon.jvmargs=-Xmx2g
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.simiacryptus.skyenet.apps.plan.PlanCoordinator
import com.simiacryptus.skyenet.apps.plan.PlanCoordinator.Companion.initialPlan
import com.simiacryptus.skyenet.apps.plan.PlanSettings
import com.simiacryptus.skyenet.apps.plan.PlanUtil
import com.simiacryptus.skyenet.core.platform.ApplicationServicesConfig.dataStorageRoot
import com.simiacryptus.skyenet.core.platform.Session
import com.simiacryptus.skyenet.core.platform.User
import com.simiacryptus.skyenet.webui.application.ApplicationInterface
Expand All @@ -20,7 +21,6 @@ import java.io.File
open class PlanAheadApp(
applicationName: String = "Task Planning v1.1",
path: String = "/taskDev",
val rootFile: File? = null,
val planSettings: PlanSettings,
val model: OpenAITextModel,
val parsingModel: OpenAITextModel,
Expand All @@ -32,13 +32,13 @@ open class PlanAheadApp(
applicationName = applicationName,
path = path,
showMenubar = showMenubar,
root = planSettings.workingDir?.let { File(it) } ?: dataStorageRoot,
) {
override val singleInput: Boolean get() = true
override val root: File get() = rootFile ?: super.root

@Suppress("UNCHECKED_CAST")
override fun <T : Any> initSettings(session: Session): T = planSettings.let {
if (null == rootFile) it.copy(workingDir = root.absolutePath) else
if (null == root) it.copy(workingDir = root.absolutePath) else
it
} as T

Expand All @@ -55,7 +55,7 @@ open class PlanAheadApp(
session = session,
dataStorage = dataStorage,
ui = ui,
root = dataStorage.getDataDir(user, session).toPath(),
root = planSettings?.workingDir?.let { File(it).toPath() } ?: dataStorage.getDataDir(user, session).toPath(),
planSettings = planSettings!!
)
coordinator.executeTaskBreakdownWithPrompt(JsonUtil.toJson(initialPlan), api!!)
Expand Down Expand Up @@ -83,7 +83,7 @@ open class PlanAheadApp(
session = session,
dataStorage = dataStorage,
ui = ui,
root = dataStorage.getDataDir(user, session).toPath(),
root = planSettings?.workingDir?.let { File(it).toPath() } ?: dataStorage.getDataDir(user, session).toPath(),
planSettings = planSettings!!
)
val task = coordinator.ui.newTask()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.simiacryptus.jopenai.API
import com.simiacryptus.jopenai.ChatClient
import com.simiacryptus.jopenai.models.OpenAITextModel
import com.simiacryptus.skyenet.apps.plan.*
import com.simiacryptus.skyenet.apps.plan.InquiryTask.InquiryTaskData
import com.simiacryptus.skyenet.apps.plan.file.InquiryTask.InquiryTaskData
import com.simiacryptus.skyenet.core.platform.Session
import com.simiacryptus.skyenet.core.platform.User
import com.simiacryptus.skyenet.util.MarkdownUtil
Expand All @@ -16,7 +16,6 @@ import java.util.*
open class PlanChatApp(
applicationName: String = "Task Planning Chat v1.0",
path: String = "/taskChat",
rootFile: File? = null,
planSettings: PlanSettings,
model: OpenAITextModel,
parsingModel: OpenAITextModel,
Expand All @@ -27,7 +26,6 @@ open class PlanChatApp(
) : PlanAheadApp(
applicationName = applicationName,
path = path,
rootFile = rootFile,
planSettings = planSettings,
model = model,
parsingModel = parsingModel,
Expand Down Expand Up @@ -89,7 +87,7 @@ open class PlanChatApp(
session = session,
dataStorage = dataStorage,
ui = ui,
root = dataStorage.getDataDir(user, session).toPath(),
root = planSettings?.workingDir?.let { File(it).toPath() } ?: dataStorage.getDataDir(user, session).toPath(),
planSettings = planSettings
)
val mainTask = coordinator.ui.newTask()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.simiacryptus.skyenet.apps.meta

import com.simiacryptus.jopenai.models.ChatModels
import com.simiacryptus.jopenai.models.OpenAIModels
import com.simiacryptus.skyenet.core.actors.ParsedActor

class ActorDesigner(
model: ChatModels,
temperature: Double
) : ParsedActor<AgentActorDesign>(
resultClass = AgentActorDesign::class.java,
exampleInstance = AgentActorDesign(
actors = listOf(
ActorDesign(
name = "Actor 1",
description = "Actor 1 description",
type = "Simple",
resultClass = "String",
)
)
),
model = model,
temperature = temperature,
parsingModel = OpenAIModels.GPT4oMini,
prompt = """
You are an AI actor designer.
Your task is to expand on a high-level design with requirements for each actor.
For each actor in the given design, detail:
1. The purpose of the actor
2. Actor Type, which can be one of:
1. "Simple" actors work like a chatbot, and simply return the chat model's response to the system and user prompts
2. "Parsed" actors produce complex data structures as output, which can be used in the application logic
* **IMPORTANT**: If the output is a string, use a "simple" actor instead
3. "Coding" actors are used to invoke tools via dynamically compiled scripts
4. "Image" actors produce images from a user (and system) prompt.
3. Required details for each actor type:
1. Simple and Image actors
1. System prompt
2. Parsed actors
1. system prompt
2. output data structure
1. java class name
2. definition
3. Coding actors
1. defined symbols and functions
2. libraries used
""".trimIndent()
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.simiacryptus.skyenet.apps.meta

import com.simiacryptus.jopenai.models.ChatModels
import com.simiacryptus.skyenet.apps.meta.FlowStepDesigner.Companion.fixups
import com.simiacryptus.skyenet.core.actors.CodingActor
import com.simiacryptus.skyenet.interpreter.Interpreter
import kotlin.reflect.KClass

class CodingActorDesigner(
interpreterClass: KClass<out Interpreter>,
symbols: Map<String, Any>,
model: ChatModels,
temperature: Double
) : CodingActor(
interpreterClass = interpreterClass,
symbols = symbols,
details = """
|
|Your task is to design a system that uses gpt "actors" to form a "community" of actors interacting to solve problems.
|Your task is to implement a "script" or "coding" actor that takes part in a larger system.
|"Script" actors use a multi-stage process that combines an environment definition of predefined symbols/functions and a pluggable script compilation system using Scala, Kotlin, or Groovy. The actor will return a valid script with a convenient "execute" method. This can provide both simple function calling responses and complex code generation.
|
|For context, here is the constructor signature for CodingActor class:
|```kotlin
|package com.simiacryptus.skyenet.core.actors
|
|import com.simiacryptus.jopenai.models.OpenAIModels
|import com.simiacryptus.jopenai.describe.AbbrevWhitelistYamlDescriber
|import com.simiacryptus.jopenai.describe.TypeDescriber
|import com.simiacryptus.skyenet.interpreter.Interpreter
|import kotlin.reflect.KClass
|
|class CodingActor(
| val interpreterClass: KClass<out Interpreter>,
| val symbols: Map<String, Any> = mapOf(),
| val describer: TypeDescriber = AbbrevWhitelistYamlDescriber(
| "com.simiacryptus",
| "com.github.simiacryptus"
| ),
| name: String? = interpreterClass.simpleName,
| val details: String? = null,
| model: OpenAITextModel = OpenAIModels.GPT4o,
| val fallbackModel: ChatModels = OpenAIModels.GPT4o,
| temperature: Double = 0.1,
|)
|```
|
|In this code example an example actor is defined with a prompt, name, and a standard configuration:
|```kotlin
|import com.simiacryptus.skyenet.core.actors.CodingActor
|import com.simiacryptus.skyenet.kotlin.KotlinInterpreter
|
|fun exampleCodingActor() = CodingActor(
| interpreterClass = KotlinInterpreter::class,
| details = ""${'"'}
| |You are a software implementation assistant.
| |
| |Defined functions:
| |* ...
| |
| |Expected code structure:
| |* ...
| ""${'"'}.trimMargin().trim(),
|)
|```
|
|Respond to the request with an instantiation function of the requested actor, similar to the provided example.
|DO NOT subclass the CodingActor class. Use the constructor directly within the function.
|
""".trimMargin().trim(),
model = model,
temperature = temperature,
) {
init {
evalFormat = false
codeInterceptor = { fixups(it) }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package com.simiacryptus.skyenet.apps.meta

import com.simiacryptus.jopenai.models.ChatModels
import com.simiacryptus.jopenai.models.OpenAIModels
import com.simiacryptus.skyenet.core.actors.ParsedActor

class DetailDesigner(
model: ChatModels,
temperature: Double
) : ParsedActor<AgentFlowDesign>(
resultClass = AgentFlowDesign::class.java,
exampleInstance = AgentFlowDesign(
name = "TextAnalyzer",
description = "Analyze input text for sentiment and key topics",
mainInput = DataInfo(
type = "String",
description = "raw text"
),
logicFlow = LogicFlow(
items = listOf(
LogicFlowItem(
name = "Preprocess text",
description = "Preprocess text (remove noise, normalize)",
actors = listOf(
"TextPreprocessor"
),
inputs = listOf(
DataInfo(
type = "String",
description = "raw text"
)
),
output = DataInfo(
type = "String",
description = "preprocessed text"
)
),
)
)
),
model = model,
temperature = temperature,
parsingModel = OpenAIModels.GPT4o,
prompt = """
You are an expert detailed software designer specializing in AI agent systems.
Your task is to expand on the high-level architecture and design a detailed "agent" system that uses GPT "actors" to model a creative process.
The system should have a procedural overall structure, with creative steps implemented by GPT actors.
Consider the following system interactions:
1. File storage and retrieval: Design a shared session folder accessible by both the user and the application.
2. Concurrent operations: Plan for individual actors and actions to run in parallel using Java threading.
Design user interactions including:
1. Rich message display: HTML and image rendering in the web interface.
2. User input mechanisms: Text input fields and clickable links with callback handling.
Incorporate these important design patterns:
1. Iterative Thinking: Implement user feedback loops and step-by-step processing using sequences of specialized actors.
2. Parse-and-Expand: Use an initial actor to generate a base data structure, then expand it using various (potentially recursive) actors.
3. File Builder: Design the main web interface for monitoring and control, with primary outputs written to files and displayed as links.
Your detailed design output should include:
1. Actor Specifications: For each actor, provide:
* Purpose and description
* Input and output formats
* Key responsibilities and operations
2. Logic Flow: Detailed pseudocode for the overall system flow
3. Data Structures: Specifications for data structures used to pass and handle information between actors
4. User Interface: Mockup or description of key UI components and their functionality
5. File Management: Strategy for file storage, retrieval, and organization
6. Concurrency Plan: Outline of how parallel operations will be managed
Example Actor Specification:
Actor: TextAnalyzer
Purpose: Analyze input text for sentiment and key topics
Inputs: String (raw text)
Outputs:
* Float (sentiment score from -1 to 1)
* List<String> (key topics)
Operations:
1. Preprocess text (remove noise, normalize)
2. Perform sentiment analysis
3. Extract key topics using NLP techniques
Ensure your design is comprehensive, clear, and ready for implementation.
""".trimIndent()
)
Loading

0 comments on commit 22fc44e

Please sign in to comment.