Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Quafadas committed Sep 3, 2024
1 parent 2e2c1b0 commit 4c45e76
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
11 changes: 5 additions & 6 deletions agentic/src/SmithyOpenAIUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ import software.amazon.smithy.model.node.Node

import scala.annotation.experimental

/** These are toy interpreters that turn services into json-in/json-out functions, and vice versa.
*
* Created for testing purposes.
*/
// format: off
val ioToolGen = new SmithyOpenAIUtil[IO]

class SmithyOpenAIUtil[F[_]](implicit F: MonadThrow[F]):
Expand All @@ -35,7 +32,7 @@ class SmithyOpenAIUtil[F[_]](implicit F: MonadThrow[F]):
docOpt.toOption.get
end toJsonSchema

// format: off

@experimental
def openAiSmithyFunctionDispatch[Alg[_[_, _, _, _, _]]](
alg: FunctorAlgebra[Alg, F]
Expand All @@ -54,7 +51,7 @@ class SmithyOpenAIUtil[F[_]](implicit F: MonadThrow[F]):
jsonEndpoint(fctConfig)
case None => F.raiseError(new Throwable(s"Function $m not found"))
end match
// format: on


private def toLowLevel[Op[_, _, _, _, _], I, E, O, SI, SO](
polyFunction: PolyFunction5[Op, Kind1[F]#toKind5],
Expand Down Expand Up @@ -88,4 +85,6 @@ class SmithyOpenAIUtil[F[_]](implicit F: MonadThrow[F]):
// println(Json.writeDocumentAsPrettyString(output))
output
end toLowLevel

end SmithyOpenAIUtil
// format: on
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ fix:
site:
mill -j 0 -w site.live

test:
mill -j 0 __.test

demo:
scala-cli run . --main-class io.github.quafadas.dairect.Showcase

Expand Down
2 changes: 1 addition & 1 deletion site/src/research.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object Researcher extends IOApp.Simple:
val clientR = EmberClientBuilder.default[IO].build
val bot: Resource[IO, ChatGpt] = ChatGpt.defaultAuthLogToFile(logFile, clientR)
val serp = clientR.flatMap(c => Serp(fileLogger(logFile)(c)))
val fetcher = clientR.map(UrlReader(_))
val fetcher = clientR.map(UrlReader(_))

val startMessages: List[AiMessage] = List(
AiMessage.system(
Expand Down

0 comments on commit 4c45e76

Please sign in to comment.