Update import statements in GitbookLoader, JsonToolkit, CSVAgent, UnstructuredHTMLLoader, IMSDbLoader, IFixitLoader, BSHTMLLoader, ReadTheDocsLoader, OpenAPIToolkit, Qdrant, EverNoteLoader, CoNLLULoader, and AirbyteJSONLoader components
This commit is contained in:
parent
6ffb7cc233
commit
15dd9e3ee1
20 changed files with 61 additions and 69 deletions
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.field_typing import BaseLanguageModel, AgentExecutor
|
||||
from langflow.field_typing import BaseLanguageModel, AgentExecutor
|
||||
|
||||
|
||||
class CSVAgentComponent(CustomComponent):
|
||||
display_name = "CSVAgent"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.field_typing import Document
|
||||
from langflow.field_typing import Document
|
||||
from typing import Optional, Dict
|
||||
|
||||
|
||||
class AZLyricsLoaderComponent(CustomComponent):
|
||||
display_name = "AZLyricsLoader"
|
||||
description = "Load `AZLyrics` webpages."
|
||||
|
|
@ -10,18 +10,8 @@ class AZLyricsLoaderComponent(CustomComponent):
|
|||
|
||||
def build_config(self):
|
||||
return {
|
||||
"metadata": {
|
||||
"display_name": "Metadata",
|
||||
"type": "dict",
|
||||
"default": {},
|
||||
"show": True
|
||||
},
|
||||
"web_path": {
|
||||
"display_name": "Web Page",
|
||||
"type": "str",
|
||||
"required": True,
|
||||
"show": True
|
||||
},
|
||||
"metadata": {"display_name": "Metadata", "type": "dict", "default": {}, "show": True},
|
||||
"web_path": {"display_name": "Web Page", "type": "str", "required": True, "show": True},
|
||||
}
|
||||
|
||||
def build(self, metadata: Optional[Dict] = None, web_path: str = "") -> Document:
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.field_typing import Document
|
||||
from langflow.field_typing import Document
|
||||
from typing import Optional, Dict
|
||||
|
||||
|
||||
class AirbyteJSONLoaderComponent(CustomComponent):
|
||||
display_name = "AirbyteJSONLoader"
|
||||
description = "Load local `Airbyte` json files."
|
||||
documentation = "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/airbyte_json"
|
||||
documentation = (
|
||||
"https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/airbyte_json"
|
||||
)
|
||||
|
||||
def build_config(self):
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.field_typing import Document
|
||||
from langflow.field_typing import Document
|
||||
from typing import Optional, Dict
|
||||
|
||||
|
||||
class BSHTMLLoaderComponent(CustomComponent):
|
||||
display_name = "BSHTMLLoader"
|
||||
description = "Load `HTML` files and parse them with `beautiful soup`."
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.documents import Document
|
||||
from typing import Optional, Dict
|
||||
from langchain.field_typing import TemplateField
|
||||
from langflow.field_typing import TemplateField
|
||||
|
||||
|
||||
class CoNLLULoaderComponent(CustomComponent):
|
||||
|
|
@ -17,7 +16,7 @@ class CoNLLULoaderComponent(CustomComponent):
|
|||
required=True,
|
||||
type="file",
|
||||
file_types=["conllu"],
|
||||
suffixes=['.conllu'],
|
||||
suffixes=[".conllu"],
|
||||
),
|
||||
"metadata": TemplateField(
|
||||
display_name="Metadata",
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.field_typing import Document
|
||||
from langflow.field_typing import Document
|
||||
from typing import Optional, Dict
|
||||
|
||||
|
||||
class EverNoteLoaderComponent(CustomComponent):
|
||||
display_name = "EverNoteLoader"
|
||||
description = "Load from `EverNote`."
|
||||
documentation = "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/evernote"
|
||||
|
||||
|
||||
def build_config(self):
|
||||
return {
|
||||
"file_path": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.field_typing import Document
|
||||
from langflow.field_typing import Document
|
||||
from typing import Optional, Dict
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.field_typing import Document
|
||||
from langflow.field_typing import Document
|
||||
from typing import Optional, Dict
|
||||
|
||||
|
||||
class IFixitLoaderComponent(CustomComponent):
|
||||
display_name = "IFixitLoader"
|
||||
description = "Load `iFixit` repair guides, device wikis and answers."
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.field_typing import Document
|
||||
from langflow.field_typing import Document
|
||||
from typing import Dict, Optional
|
||||
|
||||
|
||||
class IMSDbLoaderComponent(CustomComponent):
|
||||
display_name = "IMSDbLoader"
|
||||
description = "Load `IMSDb` webpages."
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.field_typing import Document
|
||||
from langflow.field_typing import Document
|
||||
from typing import Dict, Optional
|
||||
|
||||
|
||||
class ReadTheDocsLoaderComponent(CustomComponent):
|
||||
display_name = "ReadTheDocsLoader"
|
||||
description = "Load `ReadTheDocs` documentation directory."
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
from langchain import CustomComponent
|
||||
from langchain.field_typing import Document
|
||||
from langflow.field_typing import Document
|
||||
from typing import Optional, Dict
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
|
||||
from langchain import CustomComponent
|
||||
from langchain.field_typing import Document
|
||||
from langflow.field_typing import Document
|
||||
from typing import Optional, Dict
|
||||
|
||||
|
||||
class UnstructuredWordDocumentLoaderComponent(CustomComponent):
|
||||
display_name = "UnstructuredWordDocumentLoader"
|
||||
description = "Load `Microsoft Word` file using `Unstructured`."
|
||||
documentation = "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/microsoft_word"
|
||||
documentation = (
|
||||
"https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/microsoft_word"
|
||||
)
|
||||
|
||||
def build_config(self):
|
||||
return {
|
||||
|
|
@ -17,11 +18,7 @@ class UnstructuredWordDocumentLoaderComponent(CustomComponent):
|
|||
"type": "file",
|
||||
"suffixes": [".docx", ".doc"],
|
||||
},
|
||||
"metadata": {
|
||||
"display_name": "Metadata",
|
||||
"required": False,
|
||||
"type": "dict"
|
||||
},
|
||||
"metadata": {"display_name": "Metadata", "required": False, "type": "dict"},
|
||||
}
|
||||
|
||||
def build(self, file_path: str, metadata: Optional[Dict] = None) -> Document:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from typing import Optional, Any, Dict
|
||||
from langchain.field_typing import Embeddings
|
||||
from langflow.field_typing import Embeddings
|
||||
|
||||
|
||||
class HuggingFaceEmbeddingsComponent(CustomComponent):
|
||||
display_name = "HuggingFaceEmbeddings"
|
||||
description = "HuggingFace sentence_transformers embedding models."
|
||||
documentation = "https://python.langchain.com/docs/modules/data_connection/text_embedding/integrations/sentence_transformers"
|
||||
documentation = (
|
||||
"https://python.langchain.com/docs/modules/data_connection/text_embedding/integrations/sentence_transformers"
|
||||
)
|
||||
|
||||
def build_config(self):
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from pydantic import SecretStr
|
||||
from typing import Optional, Dict, Any
|
||||
from langchain.field_typing import BaseLanguageModel
|
||||
from langflow.field_typing import BaseLanguageModel
|
||||
|
||||
|
||||
class AnthropicComponent(CustomComponent):
|
||||
display_name = "Anthropic"
|
||||
|
|
@ -40,7 +40,13 @@ class AnthropicComponent(CustomComponent):
|
|||
# Here we are returning a placeholder class as the Anthropic class is not defined
|
||||
# This is to comply with the type hints required by the CustomComponent
|
||||
class Anthropic(BaseLanguageModel):
|
||||
def __init__(self, api_key: Optional[SecretStr], api_url: Optional[str], model_kwargs: Optional[Dict[str, Any]] = None, temperature: Optional[float] = None):
|
||||
def __init__(
|
||||
self,
|
||||
api_key: Optional[SecretStr],
|
||||
api_url: Optional[str],
|
||||
model_kwargs: Optional[Dict[str, Any]] = None,
|
||||
temperature: Optional[float] = None,
|
||||
):
|
||||
# Initialize Anthropic model with the provided arguments
|
||||
super().__init__()
|
||||
self.api_key = api_key
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.llms import BaseLLM
|
||||
from typing import Optional, Dict, Union, Any
|
||||
from langchain.field_typing import BaseLanguageModel
|
||||
from langflow.field_typing import BaseLanguageModel
|
||||
|
||||
|
||||
class ChatOpenAIComponent(CustomComponent):
|
||||
display_name = "ChatOpenAI"
|
||||
|
|
@ -69,7 +69,6 @@ class ChatOpenAIComponent(CustomComponent):
|
|||
openai_api_key: Optional[str] = None,
|
||||
temperature: float = 0.7,
|
||||
) -> Union[BaseLanguageModel, BaseLLM]:
|
||||
|
||||
# Assuming there is a class `ChatOpenAI` that takes these parameters
|
||||
# The `ChatOpenAI` class must be imported or defined elsewhere in the actual implementation
|
||||
return ChatOpenAI(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.field_typing import JsonSpec, Tool
|
||||
from langflow.field_typing import JsonSpec, Tool
|
||||
|
||||
|
||||
class JsonToolkitComponent(CustomComponent):
|
||||
display_name = "JsonToolkit"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.field_typing import AgentExecutor, TextRequestsWrapper
|
||||
from langflow.field_typing import AgentExecutor, TextRequestsWrapper
|
||||
from typing import Callable
|
||||
|
||||
|
||||
class OpenAPIToolkitComponent(CustomComponent):
|
||||
display_name = "OpenAPIToolkit"
|
||||
description = "Toolkit for interacting with an OpenAPI API."
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from typing import Optional, List
|
||||
from langchain.vectorstores import Pinecone
|
||||
from langchain.field_typing import (
|
||||
from langflow.field_typing import (
|
||||
Document,
|
||||
Embeddings,
|
||||
NestedDict,
|
||||
)
|
||||
|
||||
|
||||
class PineconeComponent(CustomComponent):
|
||||
display_name = "Pinecone"
|
||||
description = "Construct Pinecone wrapper from raw documents."
|
||||
|
|
@ -20,7 +20,7 @@ class PineconeComponent(CustomComponent):
|
|||
"namespace": {"display_name": "Namespace"},
|
||||
"pinecone_api_key": {"display_name": "Pinecone API Key", "default": ""},
|
||||
"pinecone_env": {"display_name": "Pinecone Environment", "default": ""},
|
||||
"search_kwargs": {"display_name": "Search Kwargs", "default": '{}'},
|
||||
"search_kwargs": {"display_name": "Search Kwargs", "default": "{}"},
|
||||
}
|
||||
|
||||
def build(
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.vectorstores import Qdrant
|
||||
from langchain_community.vectorstores.qdrant import Qdrant
|
||||
from typing import Optional, List
|
||||
from langflow.field_typing import Document, Embeddings, NestedDict
|
||||
|
||||
|
||||
class QdrantComponent(CustomComponent):
|
||||
display_name = "Qdrant"
|
||||
description = "Construct Qdrant wrapper from a list of texts."
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from typing import Optional, List
|
||||
from langchain.vectorstores import SupabaseVectorStore
|
||||
from langchain.field_typing import (
|
||||
from langflow.field_typing import (
|
||||
Document,
|
||||
Embeddings,
|
||||
NestedDict,
|
||||
)
|
||||
|
||||
|
||||
class SupabaseComponent(CustomComponent):
|
||||
display_name = "Supabase"
|
||||
description = "Return VectorStore initialized from texts and embeddings."
|
||||
|
|
@ -27,11 +27,11 @@ class SupabaseComponent(CustomComponent):
|
|||
self,
|
||||
embedding: Embeddings,
|
||||
documents: Optional[List[Document]] = None,
|
||||
query_name: str = '',
|
||||
query_name: str = "",
|
||||
search_kwargs: NestedDict = {},
|
||||
supabase_service_key: str = '',
|
||||
supabase_url: str = '',
|
||||
table_name: str = '',
|
||||
supabase_service_key: str = "",
|
||||
supabase_url: str = "",
|
||||
table_name: str = "",
|
||||
) -> SupabaseVectorStore:
|
||||
return SupabaseVectorStore(
|
||||
documents=documents,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue