Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski committed Dec 28, 2024
1 parent e067428 commit d1356b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.simiacryptus.skyenet.apps.general

import com.simiacryptus.jopenai.API
import com.simiacryptus.jopenai.ChatClient
import com.simiacryptus.jopenai.OpenAIClient
import com.simiacryptus.jopenai.describe.JsonDescriber
import com.simiacryptus.jopenai.models.ChatModel
import com.simiacryptus.jopenai.models.OpenAIModels
Expand Down Expand Up @@ -30,6 +31,7 @@ open class OutlineApp(
applicationName: String = "Outline Expansion Concept Map v1.1",
val domainName: String,
val settings: Settings? = null,
val api2: OpenAIClient,
) : ApplicationServer(
applicationName = applicationName,
path = "/idea_mapper",
Expand Down Expand Up @@ -80,6 +82,7 @@ open class OutlineApp(
val settings = this.settings ?: getSettings(session, user)!!
OutlineAgent(
api = api,
api2 = api2,
dataStorage = dataStorage,
session = session,
user = user,
Expand All @@ -99,6 +102,7 @@ open class OutlineApp(

class OutlineAgent(
val api: API,
val api2: OpenAIClient,
dataStorage: StorageInterface,
session: Session,
user: User?,
Expand Down Expand Up @@ -167,7 +171,7 @@ class OutlineAgent(
val finalOutline = finalOutline(outlineManager, sessionDir)

if (showProjector) {
showProjector(api, outlineManager, finalOutline)
showProjector(api2, outlineManager, finalOutline)
}

if (writeFinalEssay) {
Expand All @@ -193,7 +197,7 @@ class OutlineAgent(
}

private fun showProjector(
api: ChatClient,
api: OpenAIClient,
outlineManager: OutlineManager,
finalOutline: List<OutlineManager.Node>
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SearchAndAnalyzeTask(
class SearchAndAnalyzeTaskConfigData(
@Description("The search query to use for Google search")
val search_query: String = "",
@Description("The number of search results to analyze (max 5)")
@Description("The number of search results to analyze (max 20)")
val num_results: Int = 3,
@Description("The analysis goal or focus for the content")
val analysis_goal: String = "",
Expand All @@ -42,7 +42,7 @@ class SearchAndAnalyzeTask(
override fun promptSegment() = """
SearchAndAnalyze - Search Google, fetch top results, and analyze content
** Specify the search query
** Specify number of results to analyze (max 5)
** Specify number of results to analyze (max 20)
** Specify the analysis goal or focus
""".trimIndent()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.simiacryptus.skyenet.util

import com.simiacryptus.jopenai.API
import com.simiacryptus.jopenai.OpenAIClient
import com.simiacryptus.jopenai.models.ApiModel.EmbeddingRequest
import com.simiacryptus.jopenai.models.EmbeddingModels
Expand All @@ -15,7 +14,7 @@ import java.io.IOException
import java.util.*

class TensorflowProjector(
val api: API,
val api: OpenAIClient,
val dataStorage: StorageInterface,
val sessionID: Session,
val session: ApplicationInterface,
Expand All @@ -33,7 +32,7 @@ class TensorflowProjector(
@Throws(IOException::class)
private fun toVectorMap(vararg words: String): Map<String, DoubleArray> {
val vectors = words.map { word ->
word to (api as OpenAIClient).createEmbedding(
word to api.createEmbedding(
EmbeddingRequest(
model = EmbeddingModels.AdaEmbedding.modelName,
input = word.trim(),
Expand Down

0 comments on commit d1356b2

Please sign in to comment.