-
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.
## Proposed changes This builds the initial implementation for `@gensx/openai`. A few additions to the framework were required: * Plumbing through context everywhere so that children inherit context * Add `ContextProvider` wrapper that allows you to inject context Also update the BlogWriter example and the HackerNews example to use the `@gensx/openai` package.
- Loading branch information
Showing
37 changed files
with
785 additions
and
394 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,6 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"streetsidesoftware.code-spell-checker" | ||
"streetsidesoftware.code-spell-checker", | ||
"vitest.explorer" | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug Gensx Tests", | ||
"autoAttachChildProcesses": true, | ||
"skipFiles": [ | ||
"<node_internals>/**", | ||
"**/node_modules/**" | ||
], | ||
"program": "${workspaceRoot}/packages/gensx/node_modules/vitest/vitest.mjs", | ||
"args": [ | ||
"--config", | ||
"${workspaceRoot}/packages/gensx/vitest.config.ts", | ||
"run", | ||
"${file}" | ||
], | ||
"smartStep": true, | ||
"console": "integratedTerminal", | ||
"cwd": "${workspaceRoot}/packages/gensx", | ||
"env": { | ||
"NODE_ENV": "test" | ||
} | ||
} | ||
] | ||
} |
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,13 +1,19 @@ | ||
import { gsx } from "gensx"; | ||
import { gsx, Streamable } from "gensx"; | ||
|
||
import { BlogWritingWorkflow } from "./blogWriter.js"; | ||
|
||
async function main() { | ||
console.log("\n🚀 Starting blog writing workflow"); | ||
const result = await gsx.execute<string>( | ||
<BlogWritingWorkflow prompt="Write a blog post about the future of AI" />, | ||
const stream = await gsx.execute<Streamable>( | ||
<BlogWritingWorkflow | ||
stream={true} | ||
prompt="Write a blog post about the future of AI" | ||
/>, | ||
); | ||
console.log("✅ Blog writing complete:", { result }); | ||
for await (const chunk of stream) { | ||
process.stdout.write(chunk); | ||
} | ||
console.log("\n✅ Blog writing complete"); | ||
} | ||
|
||
main().catch(console.error); |
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,6 +1,6 @@ | ||
{ | ||
"watch": [".", ".env"], | ||
"exec": "tsx --inspect=0.0.0.0:9229 ./index.tsx", | ||
"watch": [".", ".env", "../../packages/**/dist/**"], | ||
"exec": "NODE_OPTIONS='--enable-source-maps' tsx --inspect=0.0.0.0:9229 ./index.tsx", | ||
"ext": "ts, tsx, js, json" | ||
} | ||
|
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
Oops, something went wrong.