-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1465a85
commit a59fec8
Showing
4 changed files
with
33 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
import { HelloAgent, Task } from "./Agent"; | ||
import { Effect, Layer, pipe } from "effect"; | ||
import { Effect } from "effect"; | ||
import { Schema } from "@effect/schema"; | ||
import { AppLayer, LLMServiceLive } from "./services"; | ||
import { AppLayer } from "./services"; | ||
|
||
describe("Agent", () => { | ||
it("should ", {timeout:100000},async () => { | ||
const program = Effect.gen(function* () { | ||
it("should ", { timeout: 100000 }, async () => { | ||
const program = Effect.gen(function* (_) { | ||
const agent = new HelloAgent(); | ||
const createTask = Effect.succeed( | ||
new Task( | ||
"Create a greeting for Alex Whiteside, a software architect who enjoys sarcasm and XKCD", | ||
["Be Positive", "Be Creative"], | ||
Schema.Struct({greeting: Schema.String}), | ||
Schema.Struct({ greeting: Schema.String }), | ||
), | ||
); | ||
const result = yield* agent.process(createTask); | ||
console.log(result); | ||
return yield* agent.process(createTask); | ||
}); | ||
|
||
const ollamaLayer = LLMServiceLive(); | ||
const runnable = Effect.provide(program, ollamaLayer); | ||
// const ollamaLayer = LLMServiceLive(); | ||
const runnable = Effect.provide(program, AppLayer); | ||
|
||
await Effect.runPromiseExit(runnable).then(console.log); | ||
const output = await Effect.runPromise(runnable); | ||
expect(output.data).toMatchObject( | ||
expect.objectContaining({ greeting: expect.stringContaining("Alex") }), | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { remark } from "remark"; | ||
import remarkGfm from "remark-gfm"; | ||
import { Root } from "mdast"; | ||
import { Effect } from "effect"; | ||
|
||
const markdownPipeline = remark().use(remarkGfm); | ||
|
||
export const getMdast = (md: string) => { | ||
return markdownPipeline.parse(md); | ||
return Effect.succeed(markdownPipeline.parse(md)); | ||
}; | ||
|
||
export const stringifyMdast = (node: Root)=> markdownPipeline.stringify(node) | ||
export const stringifyMdast = (node: Root)=> Effect.succeed(markdownPipeline.stringify(node)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
/// <reference types="vitest" /> | ||
|
||
import { defineConfig } from "vitest/config"; | ||
import tsconfigPaths from "vite-tsconfig-paths"; | ||
|
||
export default defineConfig({ | ||
plugins: [tsconfigPaths()], | ||
build:{ | ||
sourcemap:'inline' | ||
|
||
}, | ||
|
||
test: { | ||
|
||
globals: true, | ||
}, | ||
}); |