-
Notifications
You must be signed in to change notification settings - Fork 0
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
type.constructor(input, config) #68
Conversation
✅ Deploy Preview for ellmers-web ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Very early, typescript, and particularly arrays are very unhappy. tests run fine though. not so sure about examples
- Rename `createTask` to `createTaskFromJSON` for clarity - Add validation to prevent subgraph creation for non-CompoundTasks - Improve type safety and error handling in task creation - Use type checking with `instanceof` for CompoundTask subgraph assignment
tests run 100% and building packages does not fail. Examples are next... - Update task interfaces and constructors to support more precise typing - Modify ArrayTask factory to handle more complex task type scenarios - Improve TaskRegistry registration with stronger type constraints - Add more robust error handling in task validation methods - Update compound task output type definitions - Enhance ITask and ICompoundTask interfaces with more generic type parameters
- Remove @ts-ignore and @ts-expect-error comments in multiple files - Enhance type casting and type safety in task and repository classes - Add explicit type annotations to improve type inference - Update type handling in Workflow and task creation methods
- Add detailed documentation for TaskBase class properties and methods - Improve type annotations and add explicit type definitions - Enhance input/output handling with more robust validation - Add comprehensive comments explaining task lifecycle and event handling - Remove unnecessary type imports and clean up type definitions
812b9ea
to
02d5617
Compare
02d5617
to
fa5a4a1
Compare
- Update progress event signatures to support optional message and details - Modify event emission in tasks to pass additional context - Enhance type definitions for task progress events - Simplify progress handling across different task types
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.
PR Overview
This PR refactors several task and repository classes to adopt TypeScript generics and improve type safety while also updating workflow and storage integration. Key changes include:
- Converting task classes (SimilarityTask, TextSummaryTask, TextQuestionAnswerTask, etc.) to use generics for input, output, and config.
- Updating array task factory calls and workflow definitions to support the new generic parameters.
- Adjusting repository storage queries and test setups for improved type support.
Reviewed Changes
File | Description |
---|---|
packages/ai/src/task/SimilarityTask.ts | Converted class to use generics and updated input validation casting. |
packages/ai/src/task/TextSummaryTask.ts | Updated constructor signature for improved clarity. |
packages/ai/src/task/TextTranslationTask.ts | Updated task factory call with generics; cast to any introduced. |
packages/ai/src/task/DownloadModelTask.ts | Refactored class to use generics and adjusted progress reporting. |
packages/ai/src/task/DocumentSplitterTask.ts | Revised class declaration to use generics for consistency. |
packages/storage/src/tabular/SqliteTabularRepository.ts | Enclosed table names in backticks for SQL safety. |
packages/storage/src/tabular/PostgresTabularRepository.ts | Adjusted index search with TS error suppression comment. |
packages/job-queue/src/job/JobQueue.ts | Updated waitFor return type casting to improve type inference. |
examples/web/src/RunGraphFlow.tsx | Updated task type check from property to instance check for compound tasks. |
(Other files) | Similar updates have been applied for improved type safety and consistency. |
Copilot reviewed 60 out of 60 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
packages/storage/src/tabular/PostgresTabularRepository.ts:223
- The use of '@ts-expect-error' here suggests an underlying type mismatch. Consider revisiting the type definitions for validColumns and searchKeys to eliminate the need for error suppression.
// @ts-expect-error
No description provided.