Migrating from v0.8 to v0.9
Version 0.9 of LlamaIndex.TS introduces significant architectural changes to improve package size and runtime compatibility. The main goals of this release are:
- Reduce the package size of the main
llamaindex
package by moving dependencies into provider packages, making it more suitable for serverless environments - Enable consistent code across different environments by using unified imports (no separate imports for Node.js and Edge runtimes)
Major Changes
Installing Provider Packages
In v0.9, you need to explicitly install the provider packages you want to use. The main llamaindex
package no longer includes these dependencies by default.
Updating Imports
You'll need to update your imports to get classes directly from their respective provider packages. Here's how to migrate different components:
1. AI Model Providers
Previously:
Now:
Note: This examples requires installing the
@llamaindex/openai
package:
For more details on available AI model providers and their configuration, see the LLMs documentation and the Embedding Models documentation.
2. Storage Providers
Previously:
Now:
For more information about available storage options, refer to the Data Stores documentation.
3. Data Loaders
Previously:
Now:
For more details about available data loaders and their usage, check the Loading Data.
4. Prefer using llamaindex
instead of @llamaindex/core
llamaindex
is now re-exporting most of @llamaindex/core
. To simplify imports, just use import { ... } from "llamaindex"
instead of import { ... } from "@llamaindex/core"
. This is possible because llamaindex
is now a smaller package.
We might change imports internally in @llamaindex/core
in the future. Let us know if you're missing something.
Benefits of the Changes
- Smaller Bundle Size: By moving dependencies to separate packages, your application only includes the features you actually use
- Runtime Consistency: The same code works across different environments without environment-specific imports
- Improved Serverless Support: Reduced package size makes it easier to deploy to serverless environments with size limitations
Need Help?
If you encounter any issues during migration, please:
- Check our GitHub repository for the latest updates
- Join our Discord community for support
- Open an issue on GitHub if you find a bug or have a feature request
Last updated on