Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski committed Dec 10, 2024
1 parent 8a29399 commit e6e69dd
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ settings.gradle.kts
*.data
*.parsed.json
package-lock.json
.kotlin/
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ open class ImageActor(
temperature: Double = 0.3,
val width: Int = 1024,
val height: Int = 1024,
var openAI: OpenAIClient? = null,
) : BaseActor<List<String>, ImageResponse>(
prompt = prompt,
name = name,
Expand Down Expand Up @@ -78,7 +79,7 @@ open class ImageActor(
api = api
).choices.first().message?.content ?: throw RuntimeException("No response")
}
return ImageResponseImpl(text, api = this.openAI!!)
return ImageResponseImpl(text, api = this.openAI ?: throw RuntimeException("No API"))
}

override fun withModel(model: ChatModel): ImageActor = ImageActor(
Expand All @@ -89,9 +90,9 @@ open class ImageActor(
temperature = temperature,
width = width,
height = height,
openAI = openAI
)

var openAI: OpenAIClient? = null
fun setImageAPI(openAI: OpenAIClient): ImageActor {
this.openAI = openAI
return this
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
| Task Type | Description | Key Features | Input | Output | Special Considerations |
|-----------------------|--------------------------------------|---------------------------------------------------------------------------------|----------------------------------------------------|-----------------------------------------------------|------------------------------------------|
| AbstractTask | Base class for task execution | - State management<br>- Code file handling<br>- Dependency tracking | - PlanSettings<br>- TaskConfigBase | - Task execution results<br>- State updates | Must implement promptSegment() and run() |
| CommandAutoFixTask | Executes commands with auto-fixing | - Auto-fix capability<br>- Command resolution<br>- Working directory management | - Command list<br>- Working directory | - Command execution results<br>- Fix attempts | Max 5 retry attempts |
| CommandSessionTask | Manages interactive command sessions | - Session persistence<br>- Multiple command execution<br>- State maintenance | - Command list<br>- Session ID<br>- Timeout | - Command outputs<br>- Session state | Max 10 concurrent sessions |
| ForeachTask | Executes tasks on multiple items | - Sequential iteration<br>- Subtask management<br>- Progress tracking | - Item list<br>- Subtask definitions | - Per-item results<br>- Overall status | Maintains dependencies per iteration |
| GitHubSearchTask | Searches GitHub content | - Multi-type search<br>- Result formatting<br>- Sorting options | - Search query<br>- Search type<br>- Result count | - Formatted results<br>- Metadata | Requires GitHub API token |
| GoogleSearchTask | Performs Google searches | - Web search<br>- Result formatting<br>- Metadata inclusion | - Search query<br>- Result count | - Formatted results<br>- Pagemap data | Requires Google API credentials |
| FileModificationTask | Modifies code files | - File creation/modification<br>- Code quality maintenance<br>- Diff generation | - Input files<br>- Modifications | - Modified files<br>- Change documentation | Supports auto-fix mode |
| DocumentationTask | Generates code documentation | - Documentation generation<br>- Format handling<br>- Change management | - Source files<br>- Topics | - Documentation files<br>- Inline comments | Supports manual/auto approval |
| SecurityAuditTask | Performs security analysis | - Vulnerability detection<br>- Standards compliance<br>- Fix suggestions | - Source files<br>- Focus areas | - Audit report<br>- Fix recommendations | Security-focused analysis |
| TestGenerationTask | Creates test suites | - Test case generation<br>- Framework integration<br>- Coverage optimization | - Source files<br>- References | - Test files<br>- Test documentation | Language-specific output |
| EmbeddingSearchTask | Semantic search functionality | - Embedding-based search<br>- Query filtering<br>- Distance metrics | - Positive/negative queries<br>- Search parameters | - Ranked results<br>- Context summaries | Requires indexed content |
| KnowledgeIndexingTask | Indexes content for search | - Content processing<br>- Chunk generation<br>- Parallel processing | - File paths<br>- Parsing type | - Indexed content<br>- Progress reports | Uses thread pool |
| WebSearchAndIndexTask | Search and index web content | - Web search<br>- Content download<br>- Indexing | - Search query<br>- Result count | - Downloaded content<br>- Index files | Max 10 search results |
| CodeOptimizationTask | Optimizes code performance | - Performance analysis<br>- Code optimization<br>- Impact assessment | - Files to optimize<br>- Optimization focus | - Optimization suggestions<br>- Performance metrics | Maintains code readability |
| RefactorTask | Refactors code structure | - Code restructuring<br>- Pattern application<br>- Quality improvement | - Files to refactor<br>- Refactoring focus | - Refactored code<br>- Change documentation | Preserves functionality |
| InquiryTask | Analyzes code and answers questions | - Code analysis<br>- Question answering<br>- Context awareness | - Input files<br>- Questions<br>- Inquiry goal | - Detailed answers<br>- Analysis report | Supports interactive mode |
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ open class SingleTaskApp(
val describer = planSettings.describer()
val taskConfig = ParsedActor(
name = "SingleTaskChooser",
resultClass = TaskConfigBase::class.java,
resultClass = taskType.taskDataClass,
prompt = """
Given the following input, choose ONE task to execute. Do not create a full plan, just select the most appropriate task types for the given input.
Available task types:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.simiacryptus.skyenet.apps.general
import com.simiacryptus.diff.addApplyFileDiffLinks
import com.simiacryptus.jopenai.API
import com.simiacryptus.jopenai.ChatClient
import com.simiacryptus.jopenai.OpenAIClient
import com.simiacryptus.jopenai.describe.Description
import com.simiacryptus.jopenai.models.ApiModel
import com.simiacryptus.jopenai.models.ApiModel.Role
Expand Down Expand Up @@ -36,6 +37,7 @@ open class WebDevApp(
applicationName: String = "Web Dev Assistant v1.2",
open val symbols: Map<String, Any> = mapOf(),
val temperature: Double = 0.1,
val api2: OpenAIClient,
) : ApplicationServer(
applicationName = applicationName,
path = "/webdev",
Expand All @@ -59,6 +61,7 @@ open class WebDevApp(
model = settings.model,
parsingModel = settings.parsingModel,
root = root,
api2 = api2,
).start(
userMessage = userMessage,
)
Expand All @@ -79,6 +82,7 @@ open class WebDevApp(

class WebDevAgent(
val api: API,
val api2: OpenAIClient,
dataStorage: StorageInterface,
session: Session,
user: User?,
Expand Down Expand Up @@ -174,7 +178,9 @@ class WebDevAgent(
""".trimMargin(),
textModel = model,
imageModel = ImageModels.DallE3,
),
).apply {
setImageAPI(api2)
},
),
val root: File,
) : ActorSystem<WebDevAgent.ActorTypes>(actorMap.map { it.key.name to it.value }.toMap(), dataStorage, user, session) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.simiacryptus.jopenai.describe.Description

@JsonTypeIdResolver(TaskConfigBase.PlanTaskTypeIdResolver::class)
@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "task_type")
abstract class TaskConfigBase(
open class TaskConfigBase(
@Description("An enumeration indicating the type of task to be executed. Must be a single value from the TaskType enum.")
val task_type: String? = null,
@Description("A detailed description of the specific task to be performed, including its role in the overall plan and its dependencies on other tasks.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import org.slf4j.LoggerFactory
open class ImageActorTestApp(
private val actor: ImageActor,
applicationName: String = "ImageActorTest_" + actor.javaClass.simpleName,
temperature: Double = 0.3,
) : ApplicationServer(
applicationName = applicationName,
path = "/imageActorTest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ object ActorTestAppServer : com.simiacryptus.skyenet.webui.application.Applicati
)
)
),
ChildWebApp("/images", ImageActorTestApp(ImageActor(textModel = OpenAIModels.GPT4oMini))),
ChildWebApp("/images", ImageActorTestApp(ImageActor(textModel = OpenAIModels.GPT4oMini).apply {
openAI = OpenAIClient()
})),
ChildWebApp(
"/test_coding_scala",
CodingActorTestApp(CodingActor(ScalaLocalInterpreter::class, model = OpenAIModels.GPT4oMini))
Expand All @@ -95,21 +97,20 @@ object ActorTestAppServer : com.simiacryptus.skyenet.webui.application.Applicati
temperature = 0.2,
budget = 2.0,
autoFix = true,
commandAutoFixCommands = listOf(
"C:\\Program Files\\nodejs\\npx.cmd", "C:\\Program Files\\nodejs\\npm.cmd"
),
env = mapOf(),
workingDir = ".",
language = if (isWindows) "powershell" else "bash",
).apply {
setTaskSettings(
TaskType.TaskPlanning, TaskSettingsBase(
TaskType.TaskPlanning.name,
enabled = true,
model = OpenAIModels.GPT4o,
)
)
setTaskSettings(
TaskType.RunShellCommand, TaskSettingsBase(
TaskType.RunShellCommand.name,
enabled = false,
model = OpenAIModels.GPT4o,
)
Expand Down

0 comments on commit e6e69dd

Please sign in to comment.