feat: adds LangChain Fake Embeddings (#4789)
adding LangChain Fake Embeddings Co-authored-by: Eric Hare <ericrhare@gmail.com>
This commit is contained in:
parent
68a0b7d6c6
commit
08849b6bab
2 changed files with 28 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from .character import CharacterTextSplitterComponent
|
||||
from .conversation import ConversationChainComponent
|
||||
from .csv import CSVAgentComponent
|
||||
from .fake_embeddings import FakeEmbeddingsComponent
|
||||
from .html_link_extractor import HtmlLinkExtractorComponent
|
||||
from .json import JsonAgentComponent
|
||||
from .json_document_builder import JSONDocumentBuilder
|
||||
|
|
@ -30,6 +31,7 @@ __all__ = [
|
|||
"CharacterTextSplitterComponent",
|
||||
"ConversationChainComponent",
|
||||
"CSVAgentComponent",
|
||||
"FakeEmbeddingsComponent",
|
||||
"HtmlLinkExtractorComponent",
|
||||
"JSONDocumentBuilder",
|
||||
"JsonAgentComponent",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
from langchain_community.embeddings import FakeEmbeddings
|
||||
|
||||
from langflow.base.embeddings.model import LCEmbeddingsModel
|
||||
from langflow.field_typing import Embeddings
|
||||
from langflow.io import IntInput
|
||||
|
||||
|
||||
class FakeEmbeddingsComponent(LCEmbeddingsModel):
|
||||
display_name = "Fake Embeddings"
|
||||
description = "Generate fake embeddings, useful for initial testing and connecting components."
|
||||
icon = "LangChain"
|
||||
name = "LangChainFakeEmbeddings"
|
||||
|
||||
inputs = [
|
||||
IntInput(
|
||||
name="dimensions",
|
||||
display_name="Dimensions",
|
||||
info="The number of dimensions the resulting output embeddings should have.",
|
||||
value=5,
|
||||
),
|
||||
]
|
||||
|
||||
def build_embeddings(self) -> Embeddings:
|
||||
return FakeEmbeddings(
|
||||
size=self.dimensions or 5,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue