-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for direct call of genaiscript from js #925
Conversation
LGTM 🚀 The changes in the PR look good. The introduction of worker threads can help improve performance by offloading heavy tasks to separate threads, reducing the load on the main thread and making the application more scalable. Summary of Changes:
Functional Concerns:
Additional Recommendations:
Overall, the PR looks good with a high potential to improve the scalability and performance of the application. Ensure comprehensive testing to catch any unforeseen issues.
|
import { runScript } from "genaiscript/api" | ||
|
||
const { exitCode, results } = await runScript("summarize", ["myfile.txt"]) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Front matter is missing at the beginning of the file. It should include a title and sidebar order.
generated by pr-docs-review-commit
missing_frontmatter
## Using a the CLI as a Node.JS API | ||
|
||
The CLI can be imported and [used as an API in your Node.JS application](/genaiscript/reference/cli/api). | ||
|
||
## Topics | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link to the API documentation should be more descriptive than "Using a the CLI as a Node.JS API". Consider using a more specific title.
generated by pr-docs-review-commit
link_to_api_doc
title: Node.JS API | ||
sidebar: | ||
order: 50 | ||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Front matter is missing at the beginning of the file. It should include a title and sidebar order.
generated by pr-docs-review-commit
missing_frontmatter
This is more a v0 to get things going.
Typings coming up later.
The main changes introduced by this
GIT_DIFF
are as follows:Worker Threads Implementation: The addition of worker threads allows for offloading computationally intensive tasks, such as script execution, to separate threads. This improves the responsiveness and scalability of the application.
Refactoring of Script Execution Logic: The script execution logic from "run.ts" has been moved to "worker.ts". This refactoring enhances modularity, making it easier to manage and extend individual components.
API Changes: While not directly visible in this diff, the changes imply modifications to public APIs in files like
prompt_template.d.ts
andprompt_type.ts
. These modifications ensure that users can interact with the updated script execution features seamlessly.Code Duplication Reduction: The removal of duplicate code between "run.ts" and "worker.ts" through refactoring improves maintainability and reduces potential for errors.
Performance Enhancements: By offloading tasks to worker threads, applications utilizing this CLI tool can handle more complex scripts concurrently without significant performance degradation.