v0.5.0
2024-04-10
What's New?
We're excited to announce a major update with a focus on enhancing the project's scalability and improving the developer experience. Here are the key enhancements:
🛠️ Restructured package organization:
LangChain.dart's main package has been divided into multiple packages to simplify usage and contribution to the project.
langchain_core
: Includes only the core abstractions and the LangChain Expression Language as a way to compose them together.- Depend on this package to build frameworks on top of LangChain.dart or to interoperate with it.
langchain
: Features higher-level components and use-case specific frameworks crucial to the application's cognitive architecture.- Depend on this package to build LLM applications with LangChain.dart.
- This package exposes
langchain_core
so you don't need to depend on it explicitly.
langchain_community
: Houses community-contributed components and third-party integrations not included in the main LangChain.dart API.- Depend on this package if you want to use any of the integrations or components it provides.
- Integration-specific packages such as
langchain_openai
andlangchain_google
: These enable independent imports of popular third-party integrations without full dependency on thelangchain_community
package.- Depend on an integration-specific package if you want to use the specific integration.
✨ Enhanced APIs and New .batch
API:
The LanguageModelResult
class structure (including its child classes LLMResult
and ChatResult
) has been simplified, with each LanguageModelResult
now storing a single output directly.
To generate multiple outputs, use the new .batch
API (instead of .invoke
or .stream
), which batches the invocation of a Runnable
on a list of inputs. If the underlying provider supports batching, this method will attempt to batch the calls to the provider. Otherwise, it will concurrently call invoke
on each input (you can configure the concurrencyLimit
).
Output parsers have been revamped to provide greater flexibility and compatibility with any type of Runnable
. StringOutputParser
now supports reducing the output of a stream to a single value, which is useful when the next step in the chain expects a single input value instead of a stream.
The deprecated generate
and predict
APIs have been removed, favouring the LCEL APIs (invoke
, stream
, and batch
).
The internal implementation of the stream
API has been optimized, providing clearer error messages in case of issues.
🆕 Google AI streaming and embeddings:
ChatGoogleGenerativeAI
(used for interacting with Gemini models) now supports streaming and tuned models.
Support for Google AI embedding models has been added through the GoogleGenerativeAIEmbeddings
class, compatible with the latest text-embedding-004
embedding model. Specifying the number of output dimensions is also supported.
🚚 Migration guide:
We have compiled a migration guide to assist you in updating your code to the new version. You can find it here. For any questions or assistance, please reply to this discussion or reach out to us on Discord.
Changes
Packages with breaking changes:
langchain
-v0.5.0
langchain_chroma
-v0.2.0
langchain_community
-v0.1.0
langchain_core
-v0.1.0
langchain_google
-v0.3.0
langchain_mistralai
-v0.1.0
langchain_ollama
-v0.1.0
langchain_openai
-v0.5.0
langchain_pinecone
-v0.1.0
langchain_supabase
-v0.1.0
chromadb
-v0.2.0
openai_dart
-v0.2.0
vertex_ai
-v0.1.0
Packages with other changes:
langchain
- v0.5.0
- BREAKING REFACTOR: Introduce langchain_core and langchain_community packages (#328). (5fa520e6)
- BREAKING REFACTOR: Simplify LLMResult and ChatResult classes (#363). (ffe539c1)
- BREAKING REFACTOR: Simplify Output Parsers (#367). (f24b7058)
- BREAKING REFACTOR: Remove deprecated generate and predict APIs (#335). (c55fe50f)
- REFACTOR: Simplify internal .stream implementation (#364). (c83fed22)
- FEAT: Implement .batch support (#370). (d254f929)
- FEAT: Add reduceOutputStream option to StringOutputParser (#368). (7f9a9fae)
- DOCS: Update LCEL docs. (ab3ab573)
- DOCS: Add RAG example using OllamaEmbeddings and ChatOllama (#337). (8bddc6c0)
langchain_community
- v0.1.0
langchain_core
- v0.1.0
- BREAKING REFACTOR: Introduce langchain_core and langchain_community packages (#328). (5fa520e6)
- BREAKING REFACTOR: Simplify LLMResult and ChatResult classes (#363). (ffe539c1)
- BREAKING REFACTOR: Simplify Output Parsers (#367). (f24b7058)
- REFACTOR: Simplify internal .stream implementation (#364). (c83fed22)
- FEAT: Implement .batch support (#370). (d254f929)
- FEAT: Add reduceOutputStream option to StringOutputParser (#368). (7f9a9fae)
langchain_chroma
- v0.2.0
langchain_google
- v0.3.0
- BREAKING REFACTOR: Introduce langchain_core and langchain_community packages (#328). (5fa520e6)
- BREAKING REFACTOR: Simplify LLMResult and ChatResult classes (#363). (ffe539c1)
- BREAKING REFACTOR: Simplify Output Parsers (#367). (f24b7058)
- BREAKING REFACTOR: Remove deprecated generate and predict APIs (#335). (c55fe50f)
- REFACTOR: Simplify internal .stream implementation (#364). (c83fed22)
- FEAT: Implement .batch support (#370). (d254f929)
- FEAT: Add streaming support in ChatGoogleGenerativeAI (#360). (68bfdb04)
- FEAT: Support tuned models in ChatGoogleGenerativeAI (#359). (764b633d)
- FEAT: Add support for GoogleGenerativeAIEmbeddings (#362). (d4f888a0)
- FEAT: Support output dimensionality in GoogleGenerativeAIEmbeddings (#373). (6dcb27d8)
- FEAT: Support updating API key in Google AI client (#357). (b9b808e7)
langchain_mistralai
- v0.1.0
- BREAKING REFACTOR: Introduce langchain_core and langchain_community packages (#328). (5fa520e6)
- BREAKING REFACTOR: Simplify LLMResult and ChatResult classes (#363). (ffe539c1)
- BREAKING REFACTOR: Simplify Output Parsers (#367). (f24b7058)
- BREAKING REFACTOR: Remove deprecated generate and predict APIs (#335). (c55fe50f)
- REFACTOR: Simplify internal .stream implementation (#364). (c83fed22)
- FEAT: Implement .batch support (#370). (d254f929)
langchain_ollama
- v0.1.0
- BREAKING REFACTOR: Introduce langchain_core and langchain_community packages (#328). (5fa520e6)
- BREAKING REFACTOR: Simplify LLMResult and ChatResult classes (#363). (ffe539c1)
- BREAKING REFACTOR: Simplify Output Parsers (#367). (f24b7058)
- BREAKING REFACTOR: Remove deprecated generate and predict APIs (#335). (c55fe50f)
- REFACTOR: Simplify internal .stream implementation (#364). (c83fed22)
- FEAT: Implement .batch support (#370). (d254f929)
langchain_openai
- v0.5.0
- BREAKING REFACTOR: Introduce langchain_core and langchain_community packages (#328). (5fa520e6)
- BREAKING REFACTOR: Simplify LLMResult and ChatResult classes (#363). (ffe539c1)
- BREAKING REFACTOR: Simplify Output Parsers (#367). (f24b7058)
- BREAKING REFACTOR: Remove deprecated generate and predict APIs (#335). (c55fe50f)
- REFACTOR: Simplify internal .stream implementation (#364). (c83fed22)
- FEAT: Implement .batch support (#370). (d254f929)
- FEAT: Remove deprecated OpenAI instance id (#350). (52939336)
langchain_pinecone
- v0.1.0
langchain_supabase
- v0.1.0
chromadb
- v0.2.0
openai_dart
- v0.2.0
- FEAT: Sync OpenAI API (#347). (f296eef6)
- FIX: Have the == implementation use Object instead of dynamic (#334). (89f7b0b9)
vertex_ai
- v0.1.0
googleai_dart
- v0.0.4
- FEAT: Support generateContent for tuned model in googleai_dart client (#358). (b4641a09)
- FEAT: Support output dimensionality in Google AI Embeddings (#373). (6dcb27d8)
- FEAT: Support updating API key in Google AI client (#357). (b9b808e7)
- FIX: Have the == implementation use Object instead of dynamic (#334). (89f7b0b9)
mistralai_dart
- v0.0.3+1
ollama_dart
- v0.0.3+1
📣 Check out the #announcements channel in the LangChain.dart Discord server for more details.