diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/ainetwork/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/ainetwork/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c4295f2ef4886a3a6e862ed49c0050d3d9b8fc46 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/ainetwork/__init__.py @@ -0,0 +1 @@ +"""AINetwork toolkit.""" diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/ainetwork/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/ainetwork/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..abce2b6ed44fbd749f274d1a8dc3c4ab90fa8bbb --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/ainetwork/toolkit.py @@ -0,0 +1,70 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, List, Literal, Optional + +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit +from pydantic import ConfigDict, model_validator + +from langchain_community.tools.ainetwork.app import AINAppOps +from langchain_community.tools.ainetwork.owner import AINOwnerOps +from langchain_community.tools.ainetwork.rule import AINRuleOps +from langchain_community.tools.ainetwork.transfer import AINTransfer +from langchain_community.tools.ainetwork.utils import authenticate +from langchain_community.tools.ainetwork.value import AINValueOps + +if TYPE_CHECKING: + from ain.ain import Ain + + +class AINetworkToolkit(BaseToolkit): + """Toolkit for interacting with AINetwork Blockchain. + + *Security Note*: This toolkit contains tools that can read and modify + the state of a service; e.g., by reading, creating, updating, deleting + data associated with this service. + + See https://python.langchain.com/docs/security for more information. + + Parameters: + network: Optional. The network to connect to. Default is "testnet". + Options are "mainnet" or "testnet". + interface: Optional. The interface to use. If not provided, will + attempt to authenticate with the network. Default is None. + """ + + network: Optional[Literal["mainnet", "testnet"]] = "testnet" + interface: Optional[Ain] = None + + @model_validator(mode="before") + @classmethod + def set_interface(cls, values: dict) -> Any: + """Set the interface if not provided. + + If the interface is not provided, attempt to authenticate with the + network using the network value provided. + + Args: + values: The values to validate. + + Returns: + The validated values. + """ + if not values.get("interface"): + values["interface"] = authenticate(network=values.get("network", "testnet")) + return values + + model_config = ConfigDict( + arbitrary_types_allowed=True, + validate_default=True, + ) + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + return [ + AINAppOps(), + AINOwnerOps(), + AINRuleOps(), + AINTransfer(), + AINValueOps(), + ] diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/amadeus/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/amadeus/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/amadeus/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/amadeus/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..87f81653229747d345129b3cdf6f892c876625da --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/amadeus/toolkit.py @@ -0,0 +1,38 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, List, Optional + +from langchain_core.language_models import BaseLanguageModel +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit +from pydantic import ConfigDict, Field + +from langchain_community.tools.amadeus.closest_airport import AmadeusClosestAirport +from langchain_community.tools.amadeus.flight_search import AmadeusFlightSearch +from langchain_community.tools.amadeus.utils import authenticate + +if TYPE_CHECKING: + from amadeus import Client + + +class AmadeusToolkit(BaseToolkit): + """Toolkit for interacting with Amadeus which offers APIs for travel. + + Parameters: + client: Optional. The Amadeus client. Default is None. + llm: Optional. The language model to use. Default is None. + """ + + client: Client = Field(default_factory=authenticate) + llm: Optional[BaseLanguageModel] = Field(default=None) + + model_config = ConfigDict( + arbitrary_types_allowed=True, + ) + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + return [ + AmadeusClosestAirport(llm=self.llm), + AmadeusFlightSearch(), + ] diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/cassandra_database/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/cassandra_database/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ada4255d14216a3fab4d578960c8028406082d2e --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/cassandra_database/__init__.py @@ -0,0 +1 @@ +"""Apache Cassandra Toolkit.""" diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/cassandra_database/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/cassandra_database/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..2e017e994798e678bfc2f7c28b30efc10f75389b --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/cassandra_database/toolkit.py @@ -0,0 +1,37 @@ +"""Apache Cassandra Toolkit.""" + +from typing import List + +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit +from pydantic import ConfigDict, Field + +from langchain_community.tools.cassandra_database.tool import ( + GetSchemaCassandraDatabaseTool, + GetTableDataCassandraDatabaseTool, + QueryCassandraDatabaseTool, +) +from langchain_community.utilities.cassandra_database import CassandraDatabase + + +class CassandraDatabaseToolkit(BaseToolkit): + """Toolkit for interacting with an Apache Cassandra database. + + Parameters: + db: CassandraDatabase. The Cassandra database to interact + with. + """ + + db: CassandraDatabase = Field(exclude=True) + + model_config = ConfigDict( + arbitrary_types_allowed=True, + ) + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + return [ + GetSchemaCassandraDatabaseTool(db=self.db), + QueryCassandraDatabaseTool(db=self.db), + GetTableDataCassandraDatabaseTool(db=self.db), + ] diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/clickup/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/clickup/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/clickup/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/clickup/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..6411c67dae59ec1245eeb97d05ab686310ba2620 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/clickup/toolkit.py @@ -0,0 +1,120 @@ +from typing import Dict, List + +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit + +from langchain_community.tools.clickup.prompt import ( + CLICKUP_FOLDER_CREATE_PROMPT, + CLICKUP_GET_ALL_TEAMS_PROMPT, + CLICKUP_GET_FOLDERS_PROMPT, + CLICKUP_GET_LIST_PROMPT, + CLICKUP_GET_SPACES_PROMPT, + CLICKUP_GET_TASK_ATTRIBUTE_PROMPT, + CLICKUP_GET_TASK_PROMPT, + CLICKUP_LIST_CREATE_PROMPT, + CLICKUP_TASK_CREATE_PROMPT, + CLICKUP_UPDATE_TASK_ASSIGNEE_PROMPT, + CLICKUP_UPDATE_TASK_PROMPT, +) +from langchain_community.tools.clickup.tool import ClickupAction +from langchain_community.utilities.clickup import ClickupAPIWrapper + + +class ClickupToolkit(BaseToolkit): + """Clickup Toolkit. + + *Security Note*: This toolkit contains tools that can read and modify + the state of a service; e.g., by reading, creating, updating, deleting + data associated with this service. + + See https://python.langchain.com/docs/security for more information. + + Parameters: + tools: List[BaseTool]. The tools in the toolkit. Default is an empty list. + """ + + tools: List[BaseTool] = [] + + @classmethod + def from_clickup_api_wrapper( + cls, clickup_api_wrapper: ClickupAPIWrapper + ) -> "ClickupToolkit": + """Create a ClickupToolkit from a ClickupAPIWrapper. + + Args: + clickup_api_wrapper: ClickupAPIWrapper. The Clickup API wrapper. + + Returns: + ClickupToolkit. The Clickup toolkit. + """ + operations: List[Dict] = [ + { + "mode": "get_task", + "name": "Get task", + "description": CLICKUP_GET_TASK_PROMPT, + }, + { + "mode": "get_task_attribute", + "name": "Get task attribute", + "description": CLICKUP_GET_TASK_ATTRIBUTE_PROMPT, + }, + { + "mode": "get_teams", + "name": "Get Teams", + "description": CLICKUP_GET_ALL_TEAMS_PROMPT, + }, + { + "mode": "create_task", + "name": "Create Task", + "description": CLICKUP_TASK_CREATE_PROMPT, + }, + { + "mode": "create_list", + "name": "Create List", + "description": CLICKUP_LIST_CREATE_PROMPT, + }, + { + "mode": "create_folder", + "name": "Create Folder", + "description": CLICKUP_FOLDER_CREATE_PROMPT, + }, + { + "mode": "get_list", + "name": "Get all lists in the space", + "description": CLICKUP_GET_LIST_PROMPT, + }, + { + "mode": "get_folders", + "name": "Get all folders in the workspace", + "description": CLICKUP_GET_FOLDERS_PROMPT, + }, + { + "mode": "get_spaces", + "name": "Get all spaces in the workspace", + "description": CLICKUP_GET_SPACES_PROMPT, + }, + { + "mode": "update_task", + "name": "Update task", + "description": CLICKUP_UPDATE_TASK_PROMPT, + }, + { + "mode": "update_task_assignees", + "name": "Update task assignees", + "description": CLICKUP_UPDATE_TASK_ASSIGNEE_PROMPT, + }, + ] + tools = [ + ClickupAction( + name=action["name"], + description=action["description"], + mode=action["mode"], + api_wrapper=clickup_api_wrapper, + ) + for action in operations + ] + return cls(tools=tools) # type: ignore[arg-type] + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + return self.tools diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/cogniswitch/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/cogniswitch/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..df1d84976c49a8fd9f1c3bc0c8190b65a46c7df6 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/cogniswitch/__init__.py @@ -0,0 +1 @@ +"""CogniSwitch Toolkit""" diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/cogniswitch/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/cogniswitch/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..b5ed20f5d5c137ec51febc1efab544d9dc07b523 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/cogniswitch/toolkit.py @@ -0,0 +1,45 @@ +from typing import List + +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit + +from langchain_community.tools.cogniswitch.tool import ( + CogniswitchKnowledgeRequest, + CogniswitchKnowledgeSourceFile, + CogniswitchKnowledgeSourceURL, + CogniswitchKnowledgeStatus, +) + + +class CogniswitchToolkit(BaseToolkit): + """Toolkit for CogniSwitch. + + Use the toolkit to get all the tools present in the Cogniswitch and + use them to interact with your knowledge. + + Parameters: + cs_token: str. The Cogniswitch token. + OAI_token: str. The OpenAI API token. + apiKey: str. The Cogniswitch OAuth token. + """ + + cs_token: str + OAI_token: str + apiKey: str + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + return [ + CogniswitchKnowledgeStatus( + cs_token=self.cs_token, OAI_token=self.OAI_token, apiKey=self.apiKey + ), + CogniswitchKnowledgeRequest( + cs_token=self.cs_token, OAI_token=self.OAI_token, apiKey=self.apiKey + ), + CogniswitchKnowledgeSourceFile( + cs_token=self.cs_token, OAI_token=self.OAI_token, apiKey=self.apiKey + ), + CogniswitchKnowledgeSourceURL( + cs_token=self.cs_token, OAI_token=self.OAI_token, apiKey=self.apiKey + ), + ] diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/connery/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/connery/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1839897c39472e86614b6b91e83701242ce1fe0a --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/connery/__init__.py @@ -0,0 +1,7 @@ +""" +This module contains the ConneryToolkit. +""" + +from .toolkit import ConneryToolkit + +__all__ = ["ConneryToolkit"] diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/connery/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/connery/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..05b15d18c269b779877b87ff9c2e7369b9dfc788 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/connery/toolkit.py @@ -0,0 +1,60 @@ +from typing import Any, List + +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit +from pydantic import model_validator + +from langchain_community.tools.connery import ConneryService + + +class ConneryToolkit(BaseToolkit): + """ + Toolkit with a list of Connery Actions as tools. + + Parameters: + tools (List[BaseTool]): The list of Connery Actions. + """ + + tools: List[BaseTool] + + def get_tools(self) -> List[BaseTool]: + """ + Returns the list of Connery Actions. + """ + return self.tools + + @model_validator(mode="before") + @classmethod + def validate_attributes(cls, values: dict) -> Any: + """ + Validate the attributes of the ConneryToolkit class. + + Args: + values (dict): The arguments to validate. + Returns: + dict: The validated arguments. + + Raises: + ValueError: If the 'tools' attribute is not set + """ + + if not values.get("tools"): + raise ValueError("The attribute 'tools' must be set.") + + return values + + @classmethod + def create_instance(cls, connery_service: ConneryService) -> "ConneryToolkit": + """ + Creates a Connery Toolkit using a Connery Service. + + Parameters: + connery_service (ConneryService): The Connery Service + to get the list of Connery Actions. + Returns: + ConneryToolkit: The Connery Toolkit. + """ + + instance = cls(tools=connery_service.list_actions()) # type: ignore[arg-type] + + return instance diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/csv/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/csv/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4b049802888eaf0e8800d0ddfa29ec9b4ff4a42b --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/csv/__init__.py @@ -0,0 +1,26 @@ +from pathlib import Path +from typing import Any + +from langchain_core._api.path import as_import_path + + +def __getattr__(name: str) -> Any: + """Get attr name.""" + + if name == "create_csv_agent": + # Get directory of langchain package + HERE = Path(__file__).parents[3] + here = as_import_path(Path(__file__).parent, relative_to=HERE) + + old_path = "langchain." + here + "." + name + new_path = "langchain_experimental." + here + "." + name + raise ImportError( + "This agent has been moved to langchain experiment. " + "This agent relies on python REPL tool under the hood, so to use it " + "safely please sandbox the python REPL. " + "Read https://github.com/langchain-ai/langchain/blob/master/SECURITY.md " + "and https://github.com/langchain-ai/langchain/discussions/11680" + "To keep using this code as is, install langchain experimental and " + f"update your import statement from:\n `{old_path}` to `{new_path}`." + ) + raise AttributeError(f"{name} does not exist") diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/file_management/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/file_management/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..53ce9329f914837adb259a2754cd522b62015c77 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/file_management/__init__.py @@ -0,0 +1,7 @@ +"""Local file management toolkit.""" + +from langchain_community.agent_toolkits.file_management.toolkit import ( + FileManagementToolkit, +) + +__all__ = ["FileManagementToolkit"] diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/file_management/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/file_management/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..82c4f3d5cc9db7621f4b8e44b38834d5b734bd06 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/file_management/toolkit.py @@ -0,0 +1,88 @@ +from __future__ import annotations + +from typing import Any, Dict, List, Optional, Type + +from langchain_core.tools import BaseTool, BaseToolkit +from langchain_core.utils.pydantic import get_fields +from pydantic import model_validator + +from langchain_community.tools.file_management.copy import CopyFileTool +from langchain_community.tools.file_management.delete import DeleteFileTool +from langchain_community.tools.file_management.file_search import FileSearchTool +from langchain_community.tools.file_management.list_dir import ListDirectoryTool +from langchain_community.tools.file_management.move import MoveFileTool +from langchain_community.tools.file_management.read import ReadFileTool +from langchain_community.tools.file_management.write import WriteFileTool + +_FILE_TOOLS: List[Type[BaseTool]] = [ + CopyFileTool, + DeleteFileTool, + FileSearchTool, + MoveFileTool, + ReadFileTool, + WriteFileTool, + ListDirectoryTool, +] +_FILE_TOOLS_MAP: Dict[str, Type[BaseTool]] = { + get_fields(tool_cls)["name"].default: tool_cls for tool_cls in _FILE_TOOLS +} + + +class FileManagementToolkit(BaseToolkit): + """Toolkit for interacting with local files. + + *Security Notice*: This toolkit provides methods to interact with local files. + If providing this toolkit to an agent on an LLM, ensure you scope + the agent's permissions to only include the necessary permissions + to perform the desired operations. + + By **default** the agent will have access to all files within + the root dir and will be able to Copy, Delete, Move, Read, Write + and List files in that directory. + + Consider the following: + - Limit access to particular directories using `root_dir`. + - Use filesystem permissions to restrict access and permissions to only + the files and directories required by the agent. + - Limit the tools available to the agent to only the file operations + necessary for the agent's intended use. + - Sandbox the agent by running it in a container. + + See https://python.langchain.com/docs/security for more information. + + Parameters: + root_dir: Optional. The root directory to perform file operations. + If not provided, file operations are performed relative to the current + working directory. + selected_tools: Optional. The tools to include in the toolkit. If not + provided, all tools are included. + """ + + root_dir: Optional[str] = None + """If specified, all file operations are made relative to root_dir.""" + selected_tools: Optional[List[str]] = None + """If provided, only provide the selected tools. Defaults to all.""" + + @model_validator(mode="before") + @classmethod + def validate_tools(cls, values: dict) -> Any: + selected_tools = values.get("selected_tools") or [] + for tool_name in selected_tools: + if tool_name not in _FILE_TOOLS_MAP: + raise ValueError( + f"File Tool of name {tool_name} not supported." + f" Permitted tools: {list(_FILE_TOOLS_MAP)}" + ) + return values + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + allowed_tools = self.selected_tools or _FILE_TOOLS_MAP + tools: List[BaseTool] = [] + for tool in allowed_tools: + tool_cls = _FILE_TOOLS_MAP[tool] + tools.append(tool_cls(root_dir=self.root_dir)) + return tools + + +__all__ = ["FileManagementToolkit"] diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/financial_datasets/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/financial_datasets/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7121e6ee32003677b86bf38fa429d8710811430b --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/financial_datasets/__init__.py @@ -0,0 +1 @@ +"""financial datasets toolkit.""" diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/financial_datasets/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/financial_datasets/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..0fd509d0017cb5fe6acaf7cd457b20f456536aea --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/financial_datasets/toolkit.py @@ -0,0 +1,44 @@ +from __future__ import annotations + +from typing import List + +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit +from pydantic import ConfigDict, Field + +from langchain_community.tools.financial_datasets.balance_sheets import BalanceSheets +from langchain_community.tools.financial_datasets.cash_flow_statements import ( + CashFlowStatements, +) +from langchain_community.tools.financial_datasets.income_statements import ( + IncomeStatements, +) +from langchain_community.utilities.financial_datasets import FinancialDatasetsAPIWrapper + + +class FinancialDatasetsToolkit(BaseToolkit): + """Toolkit for interacting with financialdatasets.ai. + + Parameters: + api_wrapper: The FinancialDatasets API Wrapper. + """ + + api_wrapper: FinancialDatasetsAPIWrapper = Field( + default_factory=FinancialDatasetsAPIWrapper + ) + + def __init__(self, api_wrapper: FinancialDatasetsAPIWrapper): + super().__init__() + self.api_wrapper = api_wrapper + + model_config = ConfigDict( + arbitrary_types_allowed=True, + ) + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + return [ + BalanceSheets(api_wrapper=self.api_wrapper), + CashFlowStatements(api_wrapper=self.api_wrapper), + IncomeStatements(api_wrapper=self.api_wrapper), + ] diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/github/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/github/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bcd9368a52a4c85c4ce4703be431d8e32f1b959b --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/github/__init__.py @@ -0,0 +1 @@ +"""GitHub Toolkit.""" diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/github/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/github/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..7bc9bca042522b271125ad7d676ce69860788734 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/github/toolkit.py @@ -0,0 +1,479 @@ +"""GitHub Toolkit.""" + +from typing import Dict, List + +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit +from pydantic import BaseModel, Field + +from langchain_community.tools.github.prompt import ( + COMMENT_ON_ISSUE_PROMPT, + CREATE_BRANCH_PROMPT, + CREATE_FILE_PROMPT, + CREATE_PULL_REQUEST_PROMPT, + CREATE_REVIEW_REQUEST_PROMPT, + DELETE_FILE_PROMPT, + GET_FILES_FROM_DIRECTORY_PROMPT, + GET_ISSUE_PROMPT, + GET_ISSUES_PROMPT, + GET_LATEST_RELEASE_PROMPT, + GET_PR_PROMPT, + GET_RELEASE_PROMPT, + GET_RELEASES_PROMPT, + LIST_BRANCHES_IN_REPO_PROMPT, + LIST_PRS_PROMPT, + LIST_PULL_REQUEST_FILES, + OVERVIEW_EXISTING_FILES_BOT_BRANCH, + OVERVIEW_EXISTING_FILES_IN_MAIN, + READ_FILE_PROMPT, + SEARCH_CODE_PROMPT, + SEARCH_ISSUES_AND_PRS_PROMPT, + SET_ACTIVE_BRANCH_PROMPT, + UPDATE_FILE_PROMPT, +) +from langchain_community.tools.github.tool import GitHubAction +from langchain_community.utilities.github import GitHubAPIWrapper + + +class NoInput(BaseModel): + """Schema for operations that do not require any input.""" + + no_input: str = Field("", description="No input required, e.g. `` (empty string).") + + +class GetIssue(BaseModel): + """Schema for operations that require an issue number as input.""" + + issue_number: int = Field(0, description="Issue number as an integer, e.g. `42`") + + +class CommentOnIssue(BaseModel): + """Schema for operations that require a comment as input.""" + + input: str = Field(..., description="Follow the required formatting.") + + +class GetPR(BaseModel): + """Schema for operations that require a PR number as input.""" + + pr_number: int = Field(0, description="The PR number as an integer, e.g. `12`") + + +class CreatePR(BaseModel): + """Schema for operations that require a PR title and body as input.""" + + formatted_pr: str = Field(..., description="Follow the required formatting.") + + +class CreateFile(BaseModel): + """Schema for operations that require a file path and content as input.""" + + formatted_file: str = Field(..., description="Follow the required formatting.") + + +class ReadFile(BaseModel): + """Schema for operations that require a file path as input.""" + + formatted_filepath: str = Field( + ..., + description=( + "The full file path of the file you would like to read where the " + "path must NOT start with a slash, e.g. `some_dir/my_file.py`." + ), + ) + + +class UpdateFile(BaseModel): + """Schema for operations that require a file path and content as input.""" + + formatted_file_update: str = Field( + ..., description="Strictly follow the provided rules." + ) + + +class DeleteFile(BaseModel): + """Schema for operations that require a file path as input.""" + + formatted_filepath: str = Field( + ..., + description=( + "The full file path of the file you would like to delete" + " where the path must NOT start with a slash, e.g." + " `some_dir/my_file.py`. Only input a string," + " not the param name." + ), + ) + + +class DirectoryPath(BaseModel): + """Schema for operations that require a directory path as input.""" + + input: str = Field( + "", + description=( + "The path of the directory, e.g. `some_dir/inner_dir`." + " Only input a string, do not include the parameter name." + ), + ) + + +class BranchName(BaseModel): + """Schema for operations that require a branch name as input.""" + + branch_name: str = Field( + ..., description="The name of the branch, e.g. `my_branch`." + ) + + +class SearchCode(BaseModel): + """Schema for operations that require a search query as input.""" + + search_query: str = Field( + ..., + description=( + "A keyword-focused natural language search" + "query for code, e.g. `MyFunctionName()`." + ), + ) + + +class CreateReviewRequest(BaseModel): + """Schema for operations that require a username as input.""" + + username: str = Field( + ..., + description="GitHub username of the user being requested, e.g. `my_username`.", + ) + + +class SearchIssuesAndPRs(BaseModel): + """Schema for operations that require a search query as input.""" + + search_query: str = Field( + ..., + description="Natural language search query, e.g. `My issue title or topic`.", + ) + + +class TagName(BaseModel): + """Schema for operations that require a tag name as input.""" + + tag_name: str = Field( + ..., + description="The tag name of the release, e.g. `v1.0.0`.", + ) + + +class GitHubToolkit(BaseToolkit): + """GitHub Toolkit. + + *Security Note*: This toolkit contains tools that can read and modify + the state of a service; e.g., by creating, deleting, or updating, + reading underlying data. + + For example, this toolkit can be used to create issues, pull requests, + and comments on GitHub. + + See [Security](https://python.langchain.com/docs/security) for more information. + + Setup: + See detailed installation instructions here: + https://python.langchain.com/docs/integrations/tools/github/#installation + + You will need to install ``pygithub`` and set the following environment + variables: + + .. code-block:: bash + + pip install -U pygithub + export GITHUB_APP_ID="your-app-id" + export GITHUB_APP_PRIVATE_KEY="path-to-private-key" + export GITHUB_REPOSITORY="your-github-repository" + + Instantiate: + .. code-block:: python + + from langchain_community.agent_toolkits.github.toolkit import GitHubToolkit + from langchain_community.utilities.github import GitHubAPIWrapper + + github = GitHubAPIWrapper() + toolkit = GitHubToolkit.from_github_api_wrapper(github) + + Tools: + .. code-block:: python + + tools = toolkit.get_tools() + for tool in tools: + print(tool.name) + + .. code-block:: none + + Get Issues + Get Issue + Comment on Issue + List open pull requests (PRs) + Get Pull Request + Overview of files included in PR + Create Pull Request + List Pull Requests' Files + Create File + Read File + Update File + Delete File + Overview of existing files in Main branch + Overview of files in current working branch + List branches in this repository + Set active branch + Create a new branch + Get files from a directory + Search issues and pull requests + Search code + Create review request + + Include release tools: + By default, the toolkit does not include release-related tools. + You can include them by setting ``include_release_tools=True`` when + initializing the toolkit: + + .. code-block:: python + + toolkit = GitHubToolkit.from_github_api_wrapper( + github, include_release_tools=True + ) + + Setting ``include_release_tools=True`` will include the following tools: + + .. code-block:: none + + Get latest release + Get releases + Get release + + Use within an agent: + .. code-block:: python + + from langchain_openai import ChatOpenAI + from langgraph.prebuilt import create_react_agent + + # Select example tool + tools = [tool for tool in toolkit.get_tools() if tool.name == "Get Issue"] + assert len(tools) == 1 + tools[0].name = "get_issue" + + llm = ChatOpenAI(model="gpt-4o-mini") + agent_executor = create_react_agent(llm, tools) + + example_query = "What is the title of issue 24888?" + + events = agent_executor.stream( + {"messages": [("user", example_query)]}, + stream_mode="values", + ) + for event in events: + event["messages"][-1].pretty_print() + + .. code-block:: none + + ================================[1m Human Message [0m================================= + + What is the title of issue 24888? + ==================================[1m Ai Message [0m================================== + Tool Calls: + get_issue (call_iSYJVaM7uchfNHOMJoVPQsOi) + Call ID: call_iSYJVaM7uchfNHOMJoVPQsOi + Args: + issue_number: 24888 + =================================[1m Tool Message [0m================================= + Name: get_issue + + {"number": 24888, "title": "Standardize KV-Store Docs", "body": "..." + ==================================[1m Ai Message [0m================================== + + The title of issue 24888 is "Standardize KV-Store Docs". + + Parameters: + tools: List[BaseTool]. The tools in the toolkit. Default is an empty list. + """ # noqa: E501 + + tools: List[BaseTool] = [] + + @classmethod + def from_github_api_wrapper( + cls, github_api_wrapper: GitHubAPIWrapper, include_release_tools: bool = False + ) -> "GitHubToolkit": + """Create a GitHubToolkit from a GitHubAPIWrapper. + + Args: + github_api_wrapper: GitHubAPIWrapper. The GitHub API wrapper. + include_release_tools: bool. Whether to include release-related tools. + Defaults to False. + + Returns: + GitHubToolkit. The GitHub toolkit. + """ + operations: List[Dict] = [ + { + "mode": "get_issues", + "name": "Get Issues", + "description": GET_ISSUES_PROMPT, + "args_schema": NoInput, + }, + { + "mode": "get_issue", + "name": "Get Issue", + "description": GET_ISSUE_PROMPT, + "args_schema": GetIssue, + }, + { + "mode": "comment_on_issue", + "name": "Comment on Issue", + "description": COMMENT_ON_ISSUE_PROMPT, + "args_schema": CommentOnIssue, + }, + { + "mode": "list_open_pull_requests", + "name": "List open pull requests (PRs)", + "description": LIST_PRS_PROMPT, + "args_schema": NoInput, + }, + { + "mode": "get_pull_request", + "name": "Get Pull Request", + "description": GET_PR_PROMPT, + "args_schema": GetPR, + }, + { + "mode": "list_pull_request_files", + "name": "Overview of files included in PR", + "description": LIST_PULL_REQUEST_FILES, + "args_schema": GetPR, + }, + { + "mode": "create_pull_request", + "name": "Create Pull Request", + "description": CREATE_PULL_REQUEST_PROMPT, + "args_schema": CreatePR, + }, + { + "mode": "list_pull_request_files", + "name": "List Pull Requests' Files", + "description": LIST_PULL_REQUEST_FILES, + "args_schema": GetPR, + }, + { + "mode": "create_file", + "name": "Create File", + "description": CREATE_FILE_PROMPT, + "args_schema": CreateFile, + }, + { + "mode": "read_file", + "name": "Read File", + "description": READ_FILE_PROMPT, + "args_schema": ReadFile, + }, + { + "mode": "update_file", + "name": "Update File", + "description": UPDATE_FILE_PROMPT, + "args_schema": UpdateFile, + }, + { + "mode": "delete_file", + "name": "Delete File", + "description": DELETE_FILE_PROMPT, + "args_schema": DeleteFile, + }, + { + "mode": "list_files_in_main_branch", + "name": "Overview of existing files in Main branch", + "description": OVERVIEW_EXISTING_FILES_IN_MAIN, + "args_schema": NoInput, + }, + { + "mode": "list_files_in_bot_branch", + "name": "Overview of files in current working branch", + "description": OVERVIEW_EXISTING_FILES_BOT_BRANCH, + "args_schema": NoInput, + }, + { + "mode": "list_branches_in_repo", + "name": "List branches in this repository", + "description": LIST_BRANCHES_IN_REPO_PROMPT, + "args_schema": NoInput, + }, + { + "mode": "set_active_branch", + "name": "Set active branch", + "description": SET_ACTIVE_BRANCH_PROMPT, + "args_schema": BranchName, + }, + { + "mode": "create_branch", + "name": "Create a new branch", + "description": CREATE_BRANCH_PROMPT, + "args_schema": BranchName, + }, + { + "mode": "get_files_from_directory", + "name": "Get files from a directory", + "description": GET_FILES_FROM_DIRECTORY_PROMPT, + "args_schema": DirectoryPath, + }, + { + "mode": "search_issues_and_prs", + "name": "Search issues and pull requests", + "description": SEARCH_ISSUES_AND_PRS_PROMPT, + "args_schema": SearchIssuesAndPRs, + }, + { + "mode": "search_code", + "name": "Search code", + "description": SEARCH_CODE_PROMPT, + "args_schema": SearchCode, + }, + { + "mode": "create_review_request", + "name": "Create review request", + "description": CREATE_REVIEW_REQUEST_PROMPT, + "args_schema": CreateReviewRequest, + }, + ] + + release_operations: List[Dict] = [ + { + "mode": "get_latest_release", + "name": "Get latest release", + "description": GET_LATEST_RELEASE_PROMPT, + "args_schema": NoInput, + }, + { + "mode": "get_releases", + "name": "Get releases", + "description": GET_RELEASES_PROMPT, + "args_schema": NoInput, + }, + { + "mode": "get_release", + "name": "Get release", + "description": GET_RELEASE_PROMPT, + "args_schema": TagName, + }, + ] + + operations = operations + (release_operations if include_release_tools else []) + tools = [ + GitHubAction( + name=action["name"], + description=action["description"], + mode=action["mode"], + api_wrapper=github_api_wrapper, + args_schema=action.get("args_schema", None), + ) + for action in operations + ] + return cls(tools=tools) # type: ignore[arg-type] + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + return self.tools diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/gitlab/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/gitlab/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7d3ca720636309ecfe762283732a06cfc68f3294 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/gitlab/__init__.py @@ -0,0 +1 @@ +"""GitLab Toolkit.""" diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/gitlab/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/gitlab/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..8e50610770aabf3d9068bbee884e7c0af7a0c62b --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/gitlab/toolkit.py @@ -0,0 +1,170 @@ +"""GitLab Toolkit.""" + +from typing import Dict, List, Optional + +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit + +from langchain_community.tools.gitlab.prompt import ( + COMMENT_ON_ISSUE_PROMPT, + CREATE_FILE_PROMPT, + CREATE_PULL_REQUEST_PROMPT, + CREATE_REPO_BRANCH, + DELETE_FILE_PROMPT, + GET_ISSUE_PROMPT, + GET_ISSUES_PROMPT, + GET_REPO_FILES_FROM_DIRECTORY, + GET_REPO_FILES_IN_BOT_BRANCH, + GET_REPO_FILES_IN_MAIN, + LIST_REPO_BRANCES, + READ_FILE_PROMPT, + SET_ACTIVE_BRANCH, + UPDATE_FILE_PROMPT, +) +from langchain_community.tools.gitlab.tool import GitLabAction +from langchain_community.utilities.gitlab import GitLabAPIWrapper + +# only include a subset of tools by default to avoid a breaking change, where +# new tools are added to the toolkit and the user's code breaks because of +# the new tools +DEFAULT_INCLUDED_TOOLS = [ + "get_issues", + "get_issue", + "comment_on_issue", + "create_pull_request", + "create_file", + "read_file", + "update_file", + "delete_file", +] + + +class GitLabToolkit(BaseToolkit): + """GitLab Toolkit. + + *Security Note*: This toolkit contains tools that can read and modify + the state of a service; e.g., by creating, deleting, or updating, + reading underlying data. + + For example, this toolkit can be used to create issues, pull requests, + and comments on GitLab. + + See https://python.langchain.com/docs/security for more information. + + Parameters: + tools: List[BaseTool]. The tools in the toolkit. Default is an empty list. + """ + + tools: List[BaseTool] = [] + + @classmethod + def from_gitlab_api_wrapper( + cls, + gitlab_api_wrapper: GitLabAPIWrapper, + *, + included_tools: Optional[List[str]] = None, + ) -> "GitLabToolkit": + """Create a GitLabToolkit from a GitLabAPIWrapper. + + Args: + gitlab_api_wrapper: GitLabAPIWrapper. The GitLab API wrapper. + + Returns: + GitLabToolkit. The GitLab toolkit. + """ + + tools_to_include = ( + included_tools if included_tools is not None else DEFAULT_INCLUDED_TOOLS + ) + + operations: List[Dict] = [ + { + "mode": "get_issues", + "name": "Get Issues", + "description": GET_ISSUES_PROMPT, + }, + { + "mode": "get_issue", + "name": "Get Issue", + "description": GET_ISSUE_PROMPT, + }, + { + "mode": "comment_on_issue", + "name": "Comment on Issue", + "description": COMMENT_ON_ISSUE_PROMPT, + }, + { + "mode": "create_pull_request", + "name": "Create Pull Request", + "description": CREATE_PULL_REQUEST_PROMPT, + }, + { + "mode": "create_file", + "name": "Create File", + "description": CREATE_FILE_PROMPT, + }, + { + "mode": "read_file", + "name": "Read File", + "description": READ_FILE_PROMPT, + }, + { + "mode": "update_file", + "name": "Update File", + "description": UPDATE_FILE_PROMPT, + }, + { + "mode": "delete_file", + "name": "Delete File", + "description": DELETE_FILE_PROMPT, + }, + { + "mode": "create_branch", + "name": "Create a new branch", + "description": CREATE_REPO_BRANCH, + }, + { + "mode": "list_branches_in_repo", + "name": "Get the list of branches", + "description": LIST_REPO_BRANCES, + }, + { + "mode": "set_active_branch", + "name": "Change the active branch", + "description": SET_ACTIVE_BRANCH, + }, + { + "mode": "list_files_in_main_branch", + "name": "Overview of existing files in Main branch", + "description": GET_REPO_FILES_IN_MAIN, + }, + { + "mode": "list_files_in_bot_branch", + "name": "Overview of files in current working branch", + "description": GET_REPO_FILES_IN_BOT_BRANCH, + }, + { + "mode": "list_files_from_directory", + "name": "Overview of files in current working branch from a specific path", # noqa: E501 + "description": GET_REPO_FILES_FROM_DIRECTORY, + }, + ] + operations_filtered = [ + operation + for operation in operations + if operation["mode"] in tools_to_include + ] + tools = [ + GitLabAction( + name=action["name"], + description=action["description"], + mode=action["mode"], + api_wrapper=gitlab_api_wrapper, + ) + for action in operations_filtered + ] + return cls(tools=tools) # type: ignore[arg-type] + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + return self.tools diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/gmail/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/gmail/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..02e7f81659f5a224cb8aa3d3a661e99972d6b0e6 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/gmail/__init__.py @@ -0,0 +1 @@ +"""Gmail toolkit.""" diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/gmail/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/gmail/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..d9dea07de1a06970f40212f333e620fe36a18342 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/gmail/toolkit.py @@ -0,0 +1,132 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, List + +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit +from pydantic import ConfigDict, Field + +from langchain_community.tools.gmail.create_draft import GmailCreateDraft +from langchain_community.tools.gmail.get_message import GmailGetMessage +from langchain_community.tools.gmail.get_thread import GmailGetThread +from langchain_community.tools.gmail.search import GmailSearch +from langchain_community.tools.gmail.send_message import GmailSendMessage +from langchain_community.tools.gmail.utils import build_resource_service + +if TYPE_CHECKING: + # This is for linting and IDE typehints + from googleapiclient.discovery import Resource +else: + try: + # We do this so pydantic can resolve the types when instantiating + from googleapiclient.discovery import Resource + except ImportError: + pass + + +SCOPES = ["https://mail.google.com/"] + + +class GmailToolkit(BaseToolkit): + """Toolkit for interacting with Gmail. + + *Security Note*: This toolkit contains tools that can read and modify + the state of a service; e.g., by reading, creating, updating, deleting + data associated with this service. + + For example, this toolkit can be used to send emails on behalf of the + associated account. + + See https://python.langchain.com/docs/security for more information. + + Setup: + You will need a Google credentials.json file to use this toolkit. + See instructions here: https://python.langchain.com/docs/integrations/tools/gmail/#setup + + Key init args: + api_resource: Optional. The Google API resource. Default is None. + + Instantiate: + .. code-block:: python + + from langchain_google_community import GmailToolkit + + toolkit = GmailToolkit() + + Tools: + .. code-block:: python + + toolkit.get_tools() + + .. code-block:: none + + [GmailCreateDraft(api_resource=), + GmailSendMessage(api_resource=), + GmailSearch(api_resource=), + GmailGetMessage(api_resource=), + GmailGetThread(api_resource=)] + + Use within an agent: + .. code-block:: python + + from langchain_openai import ChatOpenAI + from langgraph.prebuilt import create_react_agent + + llm = ChatOpenAI(model="gpt-4o-mini") + + agent_executor = create_react_agent(llm, tools) + + example_query = "Draft an email to fake@fake.com thanking them for coffee." + + events = agent_executor.stream( + {"messages": [("user", example_query)]}, + stream_mode="values", + ) + for event in events: + event["messages"][-1].pretty_print() + + .. code-block:: none + + ================================[1m Human Message [0m================================= + + Draft an email to fake@fake.com thanking them for coffee. + ==================================[1m Ai Message [0m================================== + Tool Calls: + create_gmail_draft (call_slGkYKZKA6h3Mf1CraUBzs6M) + Call ID: call_slGkYKZKA6h3Mf1CraUBzs6M + Args: + message: Dear Fake, + + I wanted to take a moment to thank you for the coffee yesterday. It was a pleasure catching up with you. Let's do it again soon! + + Best regards, + [Your Name] + to: ['fake@fake.com'] + subject: Thank You for the Coffee + =================================[1m Tool Message [0m================================= + Name: create_gmail_draft + + Draft created. Draft Id: r-7233782721440261513 + ==================================[1m Ai Message [0m================================== + + I have drafted an email to fake@fake.com thanking them for the coffee. You can review and send it from your email draft with the subject "Thank You for the Coffee". + + Parameters: + api_resource: Optional. The Google API resource. Default is None. + """ # noqa: E501 + + api_resource: Resource = Field(default_factory=build_resource_service) + + model_config = ConfigDict( + arbitrary_types_allowed=True, + ) + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + return [ + GmailCreateDraft(api_resource=self.api_resource), + GmailSendMessage(api_resource=self.api_resource), + GmailSearch(api_resource=self.api_resource), + GmailGetMessage(api_resource=self.api_resource), + GmailGetThread(api_resource=self.api_resource), + ] diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/jira/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/jira/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9f7c67558fa53f59b5b7ac36f0c47a2dfe26f554 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/jira/__init__.py @@ -0,0 +1 @@ +"""Jira Toolkit.""" diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/jira/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/jira/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..204a11d6a2d0ac77bb507db8bc92fddffe8b1be1 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/jira/toolkit.py @@ -0,0 +1,83 @@ +from typing import Dict, List + +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit + +from langchain_community.tools.jira.prompt import ( + JIRA_CATCH_ALL_PROMPT, + JIRA_CONFLUENCE_PAGE_CREATE_PROMPT, + JIRA_GET_ALL_PROJECTS_PROMPT, + JIRA_ISSUE_CREATE_PROMPT, + JIRA_JQL_PROMPT, +) +from langchain_community.tools.jira.tool import JiraAction +from langchain_community.utilities.jira import JiraAPIWrapper + + +class JiraToolkit(BaseToolkit): + """Jira Toolkit. + + *Security Note*: This toolkit contains tools that can read and modify + the state of a service; e.g., by creating, deleting, or updating, + reading underlying data. + + See https://python.langchain.com/docs/security for more information. + + Parameters: + tools: List[BaseTool]. The tools in the toolkit. Default is an empty list. + """ + + tools: List[BaseTool] = [] + + @classmethod + def from_jira_api_wrapper(cls, jira_api_wrapper: JiraAPIWrapper) -> "JiraToolkit": + """Create a JiraToolkit from a JiraAPIWrapper. + + Args: + jira_api_wrapper: JiraAPIWrapper. The Jira API wrapper. + + Returns: + JiraToolkit. The Jira toolkit. + """ + + operations: List[Dict] = [ + { + "mode": "jql", + "name": "jql_query", + "description": JIRA_JQL_PROMPT, + }, + { + "mode": "get_projects", + "name": "get_projects", + "description": JIRA_GET_ALL_PROJECTS_PROMPT, + }, + { + "mode": "create_issue", + "name": "create_issue", + "description": JIRA_ISSUE_CREATE_PROMPT, + }, + { + "mode": "other", + "name": "catch_all_jira_api", + "description": JIRA_CATCH_ALL_PROMPT, + }, + { + "mode": "create_page", + "name": "create_confluence_page", + "description": JIRA_CONFLUENCE_PAGE_CREATE_PROMPT, + }, + ] + tools = [ + JiraAction( + name=action["name"], + description=action["description"], + mode=action["mode"], + api_wrapper=jira_api_wrapper, + ) + for action in operations + ] + return cls(tools=tools) # type: ignore[arg-type] + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + return self.tools diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/json/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/json/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bfab0ec6f83a544f93a19dc036a188cb08b82433 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/json/__init__.py @@ -0,0 +1 @@ +"""Json agent.""" diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/json/base.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/json/base.py new file mode 100644 index 0000000000000000000000000000000000000000..2e398ce103265c35050bf1f3e60e78cc0617c826 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/json/base.py @@ -0,0 +1,76 @@ +"""Json agent.""" + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Dict, List, Optional + +from langchain_core.callbacks import BaseCallbackManager +from langchain_core.language_models import BaseLanguageModel + +from langchain_community.agent_toolkits.json.prompt import JSON_PREFIX, JSON_SUFFIX +from langchain_community.agent_toolkits.json.toolkit import JsonToolkit + +if TYPE_CHECKING: + from langchain_classic.agents.agent import AgentExecutor + + +def create_json_agent( + llm: BaseLanguageModel, + toolkit: JsonToolkit, + callback_manager: Optional[BaseCallbackManager] = None, + prefix: str = JSON_PREFIX, + suffix: str = JSON_SUFFIX, + format_instructions: Optional[str] = None, + input_variables: Optional[List[str]] = None, + verbose: bool = False, + agent_executor_kwargs: Optional[Dict[str, Any]] = None, + **kwargs: Any, +) -> AgentExecutor: + """Construct a json agent from an LLM and tools. + + Args: + llm: The language model to use. + toolkit: The toolkit to use. + callback_manager: The callback manager to use. Default is None. + prefix: The prefix to use. Default is JSON_PREFIX. + suffix: The suffix to use. Default is JSON_SUFFIX. + format_instructions: The format instructions to use. Default is None. + input_variables: The input variables to use. Default is None. + verbose: Whether to print verbose output. Default is False. + agent_executor_kwargs: Optional additional arguments for the agent executor. + kwargs: Additional arguments for the agent. + + Returns: + The agent executor. + """ + from langchain_classic.agents.agent import AgentExecutor + from langchain_classic.agents.mrkl.base import ZeroShotAgent + from langchain_classic.chains.llm import LLMChain + + tools = toolkit.get_tools() + prompt_params = ( + {"format_instructions": format_instructions} + if format_instructions is not None + else {} + ) + prompt = ZeroShotAgent.create_prompt( + tools, + prefix=prefix, + suffix=suffix, + input_variables=input_variables, + **prompt_params, + ) + llm_chain = LLMChain( + llm=llm, + prompt=prompt, + callback_manager=callback_manager, + ) + tool_names = [tool.name for tool in tools] + agent = ZeroShotAgent(llm_chain=llm_chain, allowed_tools=tool_names, **kwargs) + return AgentExecutor.from_agent_and_tools( + agent=agent, + tools=tools, + callback_manager=callback_manager, + verbose=verbose, + **(agent_executor_kwargs or {}), + ) diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/json/prompt.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/json/prompt.py new file mode 100644 index 0000000000000000000000000000000000000000..a3b7584aca222a88b2035af48657a7d00558b5e5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/json/prompt.py @@ -0,0 +1,25 @@ +# flake8: noqa + +JSON_PREFIX = """You are an agent designed to interact with JSON. +Your goal is to return a final answer by interacting with the JSON. +You have access to the following tools which help you learn more about the JSON you are interacting with. +Only use the below tools. Only use the information returned by the below tools to construct your final answer. +Do not make up any information that is not contained in the JSON. +Your input to the tools should be in the form of `data["key"][0]` where `data` is the JSON blob you are interacting with, and the syntax used is Python. +You should only use keys that you know for a fact exist. You must validate that a key exists by seeing it previously when calling `json_spec_list_keys`. +If you have not seen a key in one of those responses, you cannot use it. +You should only add one key at a time to the path. You cannot add multiple keys at once. +If you encounter a "KeyError", go back to the previous key, look at the available keys, and try again. + +If the question does not seem to be related to the JSON, just return "I don't know" as the answer. +Always begin your interaction with the `json_spec_list_keys` tool with input "data" to see what keys exist in the JSON. + +Note that sometimes the value at a given path is large. In this case, you will get an error "Value is a large dictionary, should explore its keys directly". +In this case, you should ALWAYS follow up by using the `json_spec_list_keys` tool to see what keys exist at that path. +Do not simply refer the user to the JSON or a section of the JSON, as this is not a valid answer. Keep digging until you find the answer and explicitly return it. +""" +JSON_SUFFIX = """Begin!" + +Question: {input} +Thought: I should look at the keys that exist in data to see what I have access to +{agent_scratchpad}""" diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/json/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/json/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..a6a9849831219a86f74235aca8ddd21a0d716302 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/json/toolkit.py @@ -0,0 +1,29 @@ +from __future__ import annotations + +from typing import List + +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit + +from langchain_community.tools.json.tool import ( + JsonGetValueTool, + JsonListKeysTool, + JsonSpec, +) + + +class JsonToolkit(BaseToolkit): + """Toolkit for interacting with a JSON spec. + + Parameters: + spec: The JSON spec. + """ + + spec: JsonSpec + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + return [ + JsonListKeysTool(spec=self.spec), + JsonGetValueTool(spec=self.spec), + ] diff --git a/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/multion/toolkit.py b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/multion/toolkit.py new file mode 100644 index 0000000000000000000000000000000000000000..5a67cb13f112161b154df683415c823939ae657f --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/agent_toolkits/multion/toolkit.py @@ -0,0 +1,35 @@ +"""MultiOn agent.""" + +from __future__ import annotations + +from typing import List + +from langchain_core.tools import BaseTool +from langchain_core.tools.base import BaseToolkit +from pydantic import ConfigDict + +from langchain_community.tools.multion.close_session import MultionCloseSession +from langchain_community.tools.multion.create_session import MultionCreateSession +from langchain_community.tools.multion.update_session import MultionUpdateSession + + +class MultionToolkit(BaseToolkit): + """Toolkit for interacting with the Browser Agent. + + **Security Note**: This toolkit contains tools that interact with the + user's browser via the multion API which grants an agent + access to the user's browser. + + Please review the documentation for the multion API to understand + the security implications of using this toolkit. + + See https://python.langchain.com/docs/security for more information. + """ + + model_config = ConfigDict( + arbitrary_types_allowed=True, + ) + + def get_tools(self) -> List[BaseTool]: + """Get the tools in the toolkit.""" + return [MultionCreateSession(), MultionUpdateSession(), MultionCloseSession()] diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d547d786fec74683b6a1d3ed828ed49792beb36 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/aim_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/aim_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6598f3f1ed4a2da679e5dac15b4ea7c7368e6078 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/aim_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/argilla_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/argilla_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e52abf4f6d4cb6c574f5c88ad4e3f461292f96e1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/argilla_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/arize_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/arize_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dd6d912ce8116727f7deb2d3f8695cc6285294a3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/arize_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/arthur_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/arthur_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a1ebc0671987778ba23eb0a4bf9dc115359118cf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/arthur_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/bedrock_anthropic_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/bedrock_anthropic_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c8e2db6dcaaca98a15e7160aa75c15b119f8ae18 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/bedrock_anthropic_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/clearml_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/clearml_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2be075febeda07f37f145121e0b50a740fb546a1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/clearml_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/comet_ml_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/comet_ml_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..485d7203109e3092dbba5ee2c24abfadee04bd51 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/comet_ml_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/confident_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/confident_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..453f46cbb6431e246ec9edf2c5bf9df0c4c57db2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/confident_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/context_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/context_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..659a30517c1d85fa6d2a1c2b70d0461cf7f5a181 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/context_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/fiddler_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/fiddler_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..31a7008bc9ff78e93995394a5a67b74014e0295e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/fiddler_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/flyte_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/flyte_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..35d429b8a2318a91d8b45482f690ac92d0afdd4e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/flyte_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/human.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/human.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f238a4fe6c54186c490bc4e3878990ce3e7f005b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/human.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/infino_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/infino_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..acbeb233cba2679f508184cfc11334b669770eb0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/infino_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/labelstudio_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/labelstudio_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3a59601af5e40c2972fec9216b28e8d182e49776 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/labelstudio_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/llmonitor_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/llmonitor_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..88c9566a0e41b1b73be6694f00c70fddd2f4e4e4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/llmonitor_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/manager.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/manager.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..59a97298c52cc0ca7b6bd50425d931a68e63a5f6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/manager.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/mlflow_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/mlflow_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7dcdc2fd526f76e097ef8844a72b7955d3f95c02 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/mlflow_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/openai_info.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/openai_info.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2eff5580d00f1906d3a2da4fbc7515d6c6b619a3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/openai_info.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/promptlayer_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/promptlayer_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..db0bcec5e130a9c8f42fb021a264257aaaf1087d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/promptlayer_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/sagemaker_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/sagemaker_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8a67420c04465c7d4a1e4998d552d01047df0a36 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/sagemaker_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/trubrics_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/trubrics_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09fbaff73564b3fd1ab789584a4d2dcee0c5d3f8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/trubrics_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/upstash_ratelimit_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/upstash_ratelimit_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..78fcfec9b4c1626b0917b97091ba669e3ae49d3f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/upstash_ratelimit_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/uptrain_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/uptrain_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4118d7b23cc44ebdb747c7e39c61efc07175d0df Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/uptrain_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68c86f738438d294b9c124a4c3f042a1cedbe6c6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/wandb_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/wandb_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c18b312794698e7e6f1504459555b7a4aefd9254 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/wandb_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/whylabs_callback.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/whylabs_callback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b896bdd496bcea71ca5beb7f25681dbee02ce5f4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/__pycache__/whylabs_callback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4ee2ea5a9fb2deed660fc6409d97e66fc88b0bf2 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/__init__.py @@ -0,0 +1,82 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Optional + +from langchain_core.callbacks import BaseCallbackHandler + +from langchain_community.callbacks.streamlit.streamlit_callback_handler import ( + LLMThoughtLabeler as LLMThoughtLabeler, +) +from langchain_community.callbacks.streamlit.streamlit_callback_handler import ( + StreamlitCallbackHandler as _InternalStreamlitCallbackHandler, +) + +if TYPE_CHECKING: + from streamlit.delta_generator import DeltaGenerator + + +def StreamlitCallbackHandler( + parent_container: DeltaGenerator, + *, + max_thought_containers: int = 4, + expand_new_thoughts: bool = True, + collapse_completed_thoughts: bool = True, + thought_labeler: Optional[LLMThoughtLabeler] = None, +) -> BaseCallbackHandler: + """Callback Handler that writes to a Streamlit app. + + This CallbackHandler is geared towards + use with a LangChain Agent; it displays the Agent's LLM and tool-usage "thoughts" + inside a series of Streamlit expanders. + + Parameters + ---------- + parent_container + The `st.container` that will contain all the Streamlit elements that the + Handler creates. + max_thought_containers + The max number of completed LLM thought containers to show at once. When this + threshold is reached, a new thought will cause the oldest thoughts to be + collapsed into a "History" expander. Defaults to 4. + expand_new_thoughts + Each LLM "thought" gets its own `st.expander`. This param controls whether that + expander is expanded by default. Defaults to True. + collapse_completed_thoughts + If True, LLM thought expanders will be collapsed when completed. + Defaults to True. + thought_labeler + An optional custom LLMThoughtLabeler instance. If unspecified, the handler + will use the default thought labeling logic. Defaults to None. + + Returns + ------- + A new StreamlitCallbackHandler instance. + + Note that this is an "auto-updating" API: if the installed version of Streamlit + has a more recent StreamlitCallbackHandler implementation, an instance of that class + will be used. + + """ + # If we're using a version of Streamlit that implements StreamlitCallbackHandler, + # delegate to it instead of using our built-in handler. The official handler is + # guaranteed to support the same set of kwargs. + try: + from streamlit.external.langchain import ( + StreamlitCallbackHandler as OfficialStreamlitCallbackHandler, + ) + + return OfficialStreamlitCallbackHandler( + parent_container, + max_thought_containers=max_thought_containers, + expand_new_thoughts=expand_new_thoughts, + collapse_completed_thoughts=collapse_completed_thoughts, + thought_labeler=thought_labeler, + ) + except ImportError: + return _InternalStreamlitCallbackHandler( + parent_container, + max_thought_containers=max_thought_containers, + expand_new_thoughts=expand_new_thoughts, + collapse_completed_thoughts=collapse_completed_thoughts, + thought_labeler=thought_labeler, + ) diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aa3b29ab36ec0ef2d2e93de345b002eec7aaf0c1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/__pycache__/mutable_expander.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/__pycache__/mutable_expander.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9b605dc89d181676fd1e0129584d2eaf43823998 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/__pycache__/mutable_expander.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/__pycache__/streamlit_callback_handler.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/__pycache__/streamlit_callback_handler.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c7d4f9dd8a588107fd00c15b3c4ed77b42a8e935 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/__pycache__/streamlit_callback_handler.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/mutable_expander.py b/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/mutable_expander.py new file mode 100644 index 0000000000000000000000000000000000000000..9870e472242e8868f7a9f3b70bf6146323470464 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/mutable_expander.py @@ -0,0 +1,156 @@ +from __future__ import annotations + +from enum import Enum +from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional + +if TYPE_CHECKING: + from streamlit.delta_generator import DeltaGenerator + from streamlit.type_util import SupportsStr + + +class ChildType(Enum): + """Enumerator of the child type.""" + + MARKDOWN = "MARKDOWN" + EXCEPTION = "EXCEPTION" + + +class ChildRecord(NamedTuple): + """Child record as a NamedTuple.""" + + type: ChildType + kwargs: Dict[str, Any] + dg: DeltaGenerator + + +class MutableExpander: + """Streamlit expander that can be renamed and dynamically expanded/collapsed.""" + + def __init__(self, parent_container: DeltaGenerator, label: str, expanded: bool): + """Create a new MutableExpander. + + Parameters + ---------- + parent_container + The `st.container` that the expander will be created inside. + + The expander transparently deletes and recreates its underlying + `st.expander` instance when its label changes, and it uses + `parent_container` to ensure it recreates this underlying expander in the + same location onscreen. + label + The expander's initial label. + expanded + The expander's initial `expanded` value. + """ + self._label = label + self._expanded = expanded + self._parent_cursor = parent_container.empty() + self._container = self._parent_cursor.expander(label, expanded) + self._child_records: List[ChildRecord] = [] + + @property + def label(self) -> str: + """Expander's label string.""" + return self._label + + @property + def expanded(self) -> bool: + """True if the expander was created with `expanded=True`.""" + return self._expanded + + def clear(self) -> None: + """Remove the container and its contents entirely. A cleared container can't + be reused. + """ + self._container = self._parent_cursor.empty() + self._child_records.clear() + + def append_copy(self, other: MutableExpander) -> None: + """Append a copy of another MutableExpander's children to this + MutableExpander. + """ + other_records = other._child_records.copy() + for record in other_records: + self._create_child(record.type, record.kwargs) + + def update( + self, *, new_label: Optional[str] = None, new_expanded: Optional[bool] = None + ) -> None: + """Change the expander's label and expanded state""" + if new_label is None: + new_label = self._label + if new_expanded is None: + new_expanded = self._expanded + + if self._label == new_label and self._expanded == new_expanded: + # No change! + return + + self._label = new_label + self._expanded = new_expanded + self._container = self._parent_cursor.expander(new_label, new_expanded) + + prev_records = self._child_records + self._child_records = [] + + # Replay all children into the new container + for record in prev_records: + self._create_child(record.type, record.kwargs) + + def markdown( + self, + body: SupportsStr, + unsafe_allow_html: bool = False, + *, + help: Optional[str] = None, + index: Optional[int] = None, + ) -> int: + """Add a Markdown element to the container and return its index.""" + kwargs = {"body": body, "unsafe_allow_html": unsafe_allow_html, "help": help} + new_dg = self._get_dg(index).markdown(**kwargs) + record = ChildRecord(ChildType.MARKDOWN, kwargs, new_dg) + return self._add_record(record, index) + + def exception( + self, exception: BaseException, *, index: Optional[int] = None + ) -> int: + """Add an Exception element to the container and return its index.""" + kwargs = {"exception": exception} + new_dg = self._get_dg(index).exception(**kwargs) + record = ChildRecord(ChildType.EXCEPTION, kwargs, new_dg) + return self._add_record(record, index) + + def _create_child(self, type: ChildType, kwargs: Dict[str, Any]) -> None: + """Create a new child with the given params""" + if type == ChildType.MARKDOWN: + self.markdown(**kwargs) + elif type == ChildType.EXCEPTION: + self.exception(**kwargs) + else: + raise RuntimeError(f"Unexpected child type {type}") + + def _add_record(self, record: ChildRecord, index: Optional[int]) -> int: + """Add a ChildRecord to self._children. If `index` is specified, replace + the existing record at that index. Otherwise, append the record to the + end of the list. + + Return the index of the added record. + """ + if index is not None: + # Replace existing child + self._child_records[index] = record + return index + + # Append new child + self._child_records.append(record) + return len(self._child_records) - 1 + + def _get_dg(self, index: Optional[int]) -> DeltaGenerator: + if index is not None: + # Existing index: reuse child's DeltaGenerator + assert 0 <= index < len(self._child_records), f"Bad index: {index}" + return self._child_records[index].dg + + # No index: use container's DeltaGenerator + return self._container diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/streamlit_callback_handler.py b/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/streamlit_callback_handler.py new file mode 100644 index 0000000000000000000000000000000000000000..4747bfc2f690d674d3f4a709ca438c512527bcb7 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/callbacks/streamlit/streamlit_callback_handler.py @@ -0,0 +1,419 @@ +"""Callback Handler that prints to streamlit.""" + +from __future__ import annotations + +from enum import Enum +from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional + +from langchain_core.agents import AgentAction, AgentFinish +from langchain_core.callbacks import BaseCallbackHandler +from langchain_core.outputs import LLMResult + +from langchain_community.callbacks.streamlit.mutable_expander import MutableExpander + +if TYPE_CHECKING: + from streamlit.delta_generator import DeltaGenerator + + +def _convert_newlines(text: str) -> str: + """Convert newline characters to markdown newline sequences + (space, space, newline). + """ + return text.replace("\n", " \n") + + +CHECKMARK_EMOJI = "✅" +THINKING_EMOJI = ":thinking_face:" +HISTORY_EMOJI = ":books:" +EXCEPTION_EMOJI = "⚠️" + + +class LLMThoughtState(Enum): + """Enumerator of the LLMThought state.""" + + # The LLM is thinking about what to do next. We don't know which tool we'll run. + THINKING = "THINKING" + # The LLM has decided to run a tool. We don't have results from the tool yet. + RUNNING_TOOL = "RUNNING_TOOL" + # We have results from the tool. + COMPLETE = "COMPLETE" + + +class ToolRecord(NamedTuple): + """Tool record as a NamedTuple.""" + + name: str + input_str: str + + +class LLMThoughtLabeler: + """ + Generates markdown labels for LLMThought containers. Pass a custom + subclass of this to StreamlitCallbackHandler to override its default + labeling logic. + """ + + @staticmethod + def get_initial_label() -> str: + """Return the markdown label for a new LLMThought that doesn't have + an associated tool yet. + """ + return f"{THINKING_EMOJI} **Thinking...**" + + @staticmethod + def get_tool_label(tool: ToolRecord, is_complete: bool) -> str: + """Return the label for an LLMThought that has an associated + tool. + + Parameters + ---------- + tool + The tool's ToolRecord + + is_complete + True if the thought is complete; False if the thought + is still receiving input. + + Returns + ------- + The markdown label for the thought's container. + + """ + input = tool.input_str + name = tool.name + emoji = CHECKMARK_EMOJI if is_complete else THINKING_EMOJI + if name == "_Exception": + emoji = EXCEPTION_EMOJI + name = "Parsing error" + idx = min([60, len(input)]) + input = input[0:idx] + if len(tool.input_str) > idx: + input = input + "..." + input = input.replace("\n", " ") + label = f"{emoji} **{name}:** {input}" + return label + + @staticmethod + def get_history_label() -> str: + """Return a markdown label for the special 'history' container + that contains overflow thoughts. + """ + return f"{HISTORY_EMOJI} **History**" + + @staticmethod + def get_final_agent_thought_label() -> str: + """Return the markdown label for the agent's final thought - + the "Now I have the answer" thought, that doesn't involve + a tool. + """ + return f"{CHECKMARK_EMOJI} **Complete!**" + + +class LLMThought: + """A thought in the LLM's thought stream.""" + + def __init__( + self, + parent_container: DeltaGenerator, + labeler: LLMThoughtLabeler, + expanded: bool, + collapse_on_complete: bool, + ): + """Initialize the LLMThought. + + Args: + parent_container: The container we're writing into. + labeler: The labeler to use for this thought. + expanded: Whether the thought should be expanded by default. + collapse_on_complete: Whether the thought should be collapsed. + """ + self._container = MutableExpander( + parent_container=parent_container, + label=labeler.get_initial_label(), + expanded=expanded, + ) + self._state = LLMThoughtState.THINKING + self._llm_token_stream = "" + self._llm_token_writer_idx: Optional[int] = None + self._last_tool: Optional[ToolRecord] = None + self._collapse_on_complete = collapse_on_complete + self._labeler = labeler + + @property + def container(self) -> MutableExpander: + """The container we're writing into.""" + return self._container + + @property + def last_tool(self) -> Optional[ToolRecord]: + """The last tool executed by this thought""" + return self._last_tool + + def _reset_llm_token_stream(self) -> None: + self._llm_token_stream = "" + self._llm_token_writer_idx = None + + def on_llm_start(self, serialized: Dict[str, Any], prompts: List[str]) -> None: + self._reset_llm_token_stream() + + def on_llm_new_token(self, token: str, **kwargs: Any) -> None: + # This is only called when the LLM is initialized with `streaming=True` + self._llm_token_stream += _convert_newlines(token) + self._llm_token_writer_idx = self._container.markdown( + self._llm_token_stream, index=self._llm_token_writer_idx + ) + + def on_llm_end(self, response: LLMResult, **kwargs: Any) -> None: + # `response` is the concatenation of all the tokens received by the LLM. + # If we're receiving streaming tokens from `on_llm_new_token`, this response + # data is redundant + self._reset_llm_token_stream() + + def on_llm_error(self, error: BaseException, **kwargs: Any) -> None: + self._container.markdown("**LLM encountered an error...**") + self._container.exception(error) + + def on_tool_start( + self, serialized: Dict[str, Any], input_str: str, **kwargs: Any + ) -> None: + # Called with the name of the tool we're about to run (in `serialized[name]`), + # and its input. We change our container's label to be the tool name. + self._state = LLMThoughtState.RUNNING_TOOL + tool_name = serialized["name"] + self._last_tool = ToolRecord(name=tool_name, input_str=input_str) + self._container.update( + new_label=self._labeler.get_tool_label(self._last_tool, is_complete=False) + ) + + def on_tool_end( + self, + output: Any, + color: Optional[str] = None, + observation_prefix: Optional[str] = None, + llm_prefix: Optional[str] = None, + **kwargs: Any, + ) -> None: + self._container.markdown(f"**{str(output)}**") + + def on_tool_error(self, error: BaseException, **kwargs: Any) -> None: + self._container.markdown("**Tool encountered an error...**") + self._container.exception(error) + + def on_agent_action( + self, action: AgentAction, color: Optional[str] = None, **kwargs: Any + ) -> Any: + # Called when we're about to kick off a new tool. The `action` data + # tells us the tool we're about to use, and the input we'll give it. + # We don't output anything here, because we'll receive this same data + # when `on_tool_start` is called immediately after. + pass + + def complete(self, final_label: Optional[str] = None) -> None: + """Finish the thought.""" + if final_label is None and self._state == LLMThoughtState.RUNNING_TOOL: + assert self._last_tool is not None, ( + "_last_tool should never be null when _state == RUNNING_TOOL" + ) + final_label = self._labeler.get_tool_label( + self._last_tool, is_complete=True + ) + self._state = LLMThoughtState.COMPLETE + if self._collapse_on_complete: + self._container.update(new_label=final_label, new_expanded=False) + else: + self._container.update(new_label=final_label) + + def clear(self) -> None: + """Remove the thought from the screen. A cleared thought can't be reused.""" + self._container.clear() + + +class StreamlitCallbackHandler(BaseCallbackHandler): + """Callback handler that writes to a Streamlit app.""" + + def __init__( + self, + parent_container: DeltaGenerator, + *, + max_thought_containers: int = 4, + expand_new_thoughts: bool = True, + collapse_completed_thoughts: bool = True, + thought_labeler: Optional[LLMThoughtLabeler] = None, + ): + """Create a StreamlitCallbackHandler instance. + + Parameters + ---------- + parent_container + The `st.container` that will contain all the Streamlit elements that the + Handler creates. + max_thought_containers + The max number of completed LLM thought containers to show at once. When + this threshold is reached, a new thought will cause the oldest thoughts to + be collapsed into a "History" expander. Defaults to 4. + expand_new_thoughts + Each LLM "thought" gets its own `st.expander`. This param controls whether + that expander is expanded by default. Defaults to True. + collapse_completed_thoughts + If True, LLM thought expanders will be collapsed when completed. + Defaults to True. + thought_labeler + An optional custom LLMThoughtLabeler instance. If unspecified, the handler + will use the default thought labeling logic. Defaults to None. + """ + self._parent_container = parent_container + self._history_parent = parent_container.container() + self._history_container: Optional[MutableExpander] = None + self._current_thought: Optional[LLMThought] = None + self._completed_thoughts: List[LLMThought] = [] + self._max_thought_containers = max(max_thought_containers, 1) + self._expand_new_thoughts = expand_new_thoughts + self._collapse_completed_thoughts = collapse_completed_thoughts + self._thought_labeler = thought_labeler or LLMThoughtLabeler() + + def _require_current_thought(self) -> LLMThought: + """Return our current LLMThought. Raise an error if we have no current + thought. + """ + if self._current_thought is None: + raise RuntimeError("Current LLMThought is unexpectedly None!") + return self._current_thought + + def _get_last_completed_thought(self) -> Optional[LLMThought]: + """Return our most recent completed LLMThought, or None if we don't have one.""" + if len(self._completed_thoughts) > 0: + return self._completed_thoughts[len(self._completed_thoughts) - 1] + return None + + @property + def _num_thought_containers(self) -> int: + """The number of 'thought containers' we're currently showing: the + number of completed thought containers, the history container (if it exists), + and the current thought container (if it exists). + """ + count = len(self._completed_thoughts) + if self._history_container is not None: + count += 1 + if self._current_thought is not None: + count += 1 + return count + + def _complete_current_thought(self, final_label: Optional[str] = None) -> None: + """Complete the current thought, optionally assigning it a new label. + Add it to our _completed_thoughts list. + """ + thought = self._require_current_thought() + thought.complete(final_label) + self._completed_thoughts.append(thought) + self._current_thought = None + + def _prune_old_thought_containers(self) -> None: + """If we have too many thoughts onscreen, move older thoughts to the + 'history container.' + """ + while ( + self._num_thought_containers > self._max_thought_containers + and len(self._completed_thoughts) > 0 + ): + # Create our history container if it doesn't exist, and if + # max_thought_containers is > 1. (if max_thought_containers is 1, we don't + # have room to show history.) + if self._history_container is None and self._max_thought_containers > 1: + self._history_container = MutableExpander( + self._history_parent, + label=self._thought_labeler.get_history_label(), + expanded=False, + ) + + oldest_thought = self._completed_thoughts.pop(0) + if self._history_container is not None: + self._history_container.markdown(oldest_thought.container.label) + self._history_container.append_copy(oldest_thought.container) + oldest_thought.clear() + + def on_llm_start( + self, serialized: Dict[str, Any], prompts: List[str], **kwargs: Any + ) -> None: + if self._current_thought is None: + self._current_thought = LLMThought( + parent_container=self._parent_container, + expanded=self._expand_new_thoughts, + collapse_on_complete=self._collapse_completed_thoughts, + labeler=self._thought_labeler, + ) + + self._current_thought.on_llm_start(serialized, prompts) + + # We don't prune_old_thought_containers here, because our container won't + # be visible until it has a child. + + def on_llm_new_token(self, token: str, **kwargs: Any) -> None: + self._require_current_thought().on_llm_new_token(token, **kwargs) + self._prune_old_thought_containers() + + def on_llm_end(self, response: LLMResult, **kwargs: Any) -> None: + self._require_current_thought().on_llm_end(response, **kwargs) + self._prune_old_thought_containers() + + def on_llm_error(self, error: BaseException, **kwargs: Any) -> None: + self._require_current_thought().on_llm_error(error, **kwargs) + self._prune_old_thought_containers() + + def on_tool_start( + self, serialized: Dict[str, Any], input_str: str, **kwargs: Any + ) -> None: + self._require_current_thought().on_tool_start(serialized, input_str, **kwargs) + self._prune_old_thought_containers() + + def on_tool_end( + self, + output: Any, + color: Optional[str] = None, + observation_prefix: Optional[str] = None, + llm_prefix: Optional[str] = None, + **kwargs: Any, + ) -> None: + output = str(output) + self._require_current_thought().on_tool_end( + output, color, observation_prefix, llm_prefix, **kwargs + ) + self._complete_current_thought() + + def on_tool_error(self, error: BaseException, **kwargs: Any) -> None: + self._require_current_thought().on_tool_error(error, **kwargs) + self._prune_old_thought_containers() + + def on_text( + self, + text: str, + color: Optional[str] = None, + end: str = "", + **kwargs: Any, + ) -> None: + pass + + def on_chain_start( + self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any + ) -> None: + pass + + def on_chain_end(self, outputs: Dict[str, Any], **kwargs: Any) -> None: + pass + + def on_chain_error(self, error: BaseException, **kwargs: Any) -> None: + pass + + def on_agent_action( + self, action: AgentAction, color: Optional[str] = None, **kwargs: Any + ) -> Any: + self._require_current_thought().on_agent_action(action, color, **kwargs) + self._prune_old_thought_containers() + + def on_agent_finish( + self, finish: AgentFinish, color: Optional[str] = None, **kwargs: Any + ) -> None: + if self._current_thought is not None: + self._current_thought.complete( + self._thought_labeler.get_final_agent_thought_label() + ) + self._current_thought = None diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6cbed4ac5db4ff8290912d887f7d0278ce714d3d --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/__init__.py @@ -0,0 +1,16 @@ +"""Tracers that record execution of LangChain runs.""" + +from langchain_core.tracers.langchain import LangChainTracer +from langchain_core.tracers.stdout import ( + ConsoleCallbackHandler, + FunctionCallbackHandler, +) + +from langchain_community.callbacks.tracers.wandb import WandbTracer + +__all__ = [ + "ConsoleCallbackHandler", + "FunctionCallbackHandler", + "LangChainTracer", + "WandbTracer", +] diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..be585ec5daec2ca82eeff885c15ef988b372a5fd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/__pycache__/comet.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/__pycache__/comet.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bdd6c127c2e293d27b9ad765684346dd6b5ef556 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/__pycache__/comet.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/__pycache__/wandb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/__pycache__/wandb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81f55bca8ec4b4dd6d9551d99438f9468f03b3b6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/__pycache__/wandb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/comet.py b/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/comet.py new file mode 100644 index 0000000000000000000000000000000000000000..099f39f82bf03dff6d1162ec7a82c08da2debdba --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/comet.py @@ -0,0 +1,135 @@ +from types import ModuleType, SimpleNamespace +from typing import TYPE_CHECKING, Any, Callable, Dict + +from langchain_core.tracers import BaseTracer +from langchain_core.utils import guard_import + +if TYPE_CHECKING: + from uuid import UUID + + from comet_llm import Span + from comet_llm.chains.chain import Chain + + from langchain_community.callbacks.tracers.schemas import Run + + +def _get_run_type(run: "Run") -> str: + if isinstance(run.run_type, str): + return run.run_type + elif hasattr(run.run_type, "value"): + return run.run_type.value + else: + return str(run.run_type) + + +def import_comet_llm_api() -> SimpleNamespace: + """Import comet_llm api and raise an error if it is not installed.""" + comet_llm = guard_import("comet_llm") + comet_llm_chains = guard_import("comet_llm.chains") + + return SimpleNamespace( + chain=comet_llm_chains.chain, + span=comet_llm_chains.span, + chain_api=comet_llm_chains.api, + experiment_info=comet_llm.experiment_info, + flush=comet_llm.flush, + ) + + +class CometTracer(BaseTracer): + """Comet Tracer.""" + + def __init__(self, **kwargs: Any) -> None: + """Initialize the Comet Tracer.""" + super().__init__(**kwargs) + self._span_map: Dict["UUID", "Span"] = {} + """Map from run id to span.""" + self._chains_map: Dict["UUID", "Chain"] = {} + """Map from run id to chain.""" + self._initialize_comet_modules() + + def _initialize_comet_modules(self) -> None: + comet_llm_api = import_comet_llm_api() + self._chain: ModuleType = comet_llm_api.chain + self._span: ModuleType = comet_llm_api.span + self._chain_api: ModuleType = comet_llm_api.chain_api + self._experiment_info: ModuleType = comet_llm_api.experiment_info + self._flush: Callable[[], None] = comet_llm_api.flush + + def _persist_run(self, run: "Run") -> None: + run_dict: Dict[str, Any] = run.dict() + chain_ = self._chains_map[run.id] + chain_.set_outputs(outputs=run_dict["outputs"]) + self._chain_api.log_chain(chain_) + + def _process_start_trace(self, run: "Run") -> None: + run_dict: Dict[str, Any] = run.dict() + if not run.parent_run_id: + # This is the first run, which maps to a chain + metadata = run_dict["extra"].get("metadata", None) + + chain_: "Chain" = self._chain.Chain( + inputs=run_dict["inputs"], + metadata=metadata, + experiment_info=self._experiment_info.get(), + ) + self._chains_map[run.id] = chain_ + else: + span: "Span" = self._span.Span( + inputs=run_dict["inputs"], + category=_get_run_type(run), + metadata=run_dict["extra"], + name=run.name, + ) + span.__api__start__(self._chains_map[run.parent_run_id]) + self._chains_map[run.id] = self._chains_map[run.parent_run_id] + self._span_map[run.id] = span + + def _process_end_trace(self, run: "Run") -> None: + run_dict: Dict[str, Any] = run.dict() + if not run.parent_run_id: + pass + # Langchain will call _persist_run for us + else: + span = self._span_map[run.id] + span.set_outputs(outputs=run_dict["outputs"]) + span.__api__end__() + + def flush(self) -> None: + self._flush() + + def _on_llm_start(self, run: "Run") -> None: + """Process the LLM Run upon start.""" + self._process_start_trace(run) + + def _on_llm_end(self, run: "Run") -> None: + """Process the LLM Run.""" + self._process_end_trace(run) + + def _on_llm_error(self, run: "Run") -> None: + """Process the LLM Run upon error.""" + self._process_end_trace(run) + + def _on_chain_start(self, run: "Run") -> None: + """Process the Chain Run upon start.""" + self._process_start_trace(run) + + def _on_chain_end(self, run: "Run") -> None: + """Process the Chain Run.""" + self._process_end_trace(run) + + def _on_chain_error(self, run: "Run") -> None: + """Process the Chain Run upon error.""" + self._process_end_trace(run) + + def _on_tool_start(self, run: "Run") -> None: + """Process the Tool Run upon start.""" + self._process_start_trace(run) + + def _on_tool_end(self, run: "Run") -> None: + """Process the Tool Run.""" + self._process_end_trace(run) + + def _on_tool_error(self, run: "Run") -> None: + """Process the Tool Run upon error.""" + self._process_end_trace(run) diff --git a/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/wandb.py b/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/wandb.py new file mode 100644 index 0000000000000000000000000000000000000000..f552d37b4b554d0d4ad7a750508083155ecd2fcb --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/callbacks/tracers/wandb.py @@ -0,0 +1,507 @@ +"""A Tracer Implementation that records activity to Weights & Biases.""" + +from __future__ import annotations + +import json +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Dict, + List, + Optional, + Sequence, + Tuple, + TypedDict, + Union, +) + +from langchain_core._api import warn_deprecated +from langchain_core.output_parsers.pydantic import PydanticBaseModel +from langchain_core.tracers.base import BaseTracer +from langchain_core.tracers.schemas import Run + +if TYPE_CHECKING: + from wandb import Settings as WBSettings + from wandb.sdk.data_types.trace_tree import Trace + from wandb.sdk.lib.paths import StrPath + from wandb.wandb_run import Run as WBRun + +PRINT_WARNINGS = True + + +def _serialize_io(run_io: Optional[dict]) -> dict: + """Utility to serialize the input and output of a run to store in wandb. + Currently, supports serializing pydantic models and protobuf messages. + + :param run_io: The inputs and outputs of the run. + :return: The serialized inputs and outputs. + + + """ + if not run_io: + return {} + from google.protobuf.json_format import MessageToJson + from google.protobuf.message import Message + + serialized_inputs = {} + for key, value in run_io.items(): + if isinstance(value, Message): + serialized_inputs[key] = MessageToJson(value) + + elif isinstance(value, PydanticBaseModel): + serialized_inputs[key] = ( + value.model_dump_json() + if hasattr(value, "model_dump_json") + else value.json() + ) + + elif key == "input_documents": + serialized_inputs.update( + {f"input_document_{i}": doc.json() for i, doc in enumerate(value)} + ) + else: + serialized_inputs[key] = value + return serialized_inputs + + +def flatten_run(run: Dict[str, Any]) -> List[Dict[str, Any]]: + """Utility to flatten a nest run object into a list of runs. + :param run: The base run to flatten. + :return: The flattened list of runs. + """ + + def flatten(child_runs: List[Dict[str, Any]]) -> List[Dict[str, Any]]: + """Utility to recursively flatten a list of child runs in a run. + :param child_runs: The list of child runs to flatten. + :return: The flattened list of runs. + """ + if child_runs is None: + return [] + + result = [] + for item in child_runs: + child_runs = item.pop("child_runs", []) + result.append(item) + result.extend(flatten(child_runs)) + + return result + + return flatten([run]) + + +def truncate_run_iterative( + runs: List[Dict[str, Any]], keep_keys: Tuple[str, ...] = () +) -> List[Dict[str, Any]]: + """Utility to truncate a list of runs dictionaries to only keep the specified + keys in each run. + :param runs: The list of runs to truncate. + :param keep_keys: The keys to keep in each run. + :return: The truncated list of runs. + """ + + def truncate_single(run: Dict[str, Any]) -> Dict[str, Any]: + """Utility to truncate a single run dictionary to only keep the specified + keys. + :param run: The run dictionary to truncate. + :return: The truncated run dictionary + """ + new_dict = {} + for key in run: + if key in keep_keys: + new_dict[key] = run.get(key) + return new_dict + + return list(map(truncate_single, runs)) + + +def modify_serialized_iterative( + runs: List[Dict[str, Any]], + exact_keys: Tuple[str, ...] = (), + partial_keys: Tuple[str, ...] = (), +) -> List[Dict[str, Any]]: + """Utility to modify the serialized field of a list of runs dictionaries. + removes any keys that match the exact_keys and any keys that contain any of the + partial_keys. + recursively moves the dictionaries under the kwargs key to the top level. + changes the "id" field to a string "_kind" field that tells WBTraceTree how to + visualize the run. promotes the "serialized" field to the top level. + :param runs: The list of runs to modify. + :param exact_keys: A tuple of keys to remove from the serialized field. + :param partial_keys: A tuple of partial keys to remove from the serialized + field. + :return: The modified list of runs. + """ + + def remove_exact_and_partial_keys(obj: Dict[str, Any]) -> Dict[str, Any]: + """Recursively removes exact and partial keys from a dictionary. + :param obj: The dictionary to remove keys from. + :return: The modified dictionary. + """ + if isinstance(obj, dict): + obj = { + k: v + for k, v in obj.items() + if k not in exact_keys + and not any(partial in k for partial in partial_keys) + } + for k, v in obj.items(): + obj[k] = remove_exact_and_partial_keys(v) + elif isinstance(obj, list): + obj = [remove_exact_and_partial_keys(x) for x in obj] + return obj + + def handle_id_and_kwargs(obj: Dict[str, Any], root: bool = False) -> Dict[str, Any]: + """Recursively handles the id and kwargs fields of a dictionary. + changes the id field to a string "_kind" field that tells WBTraceTree how + to visualize the run. recursively moves the dictionaries under the kwargs + key to the top level. + :param obj: a run dictionary with id and kwargs fields. + :param root: whether this is the root dictionary or the serialized + dictionary. + :return: The modified dictionary. + """ + if isinstance(obj, dict): + if "data" in obj and isinstance(obj["data"], dict): + obj = obj["data"] + if ("id" in obj or "name" in obj) and not root: + _kind = obj.get("id") + if not _kind: + _kind = [obj.get("name")] + if isinstance(_kind, list): + obj["_kind"] = _kind[-1] + obj.pop("id", None) + obj.pop("name", None) + if "kwargs" in obj: + kwargs = obj.pop("kwargs") + for k, v in kwargs.items(): + obj[k] = v + for k, v in obj.items(): + obj[k] = handle_id_and_kwargs(v) + elif isinstance(obj, list): + obj = [handle_id_and_kwargs(x) for x in obj] + return obj + + def transform_serialized(serialized: Dict[str, Any]) -> Dict[str, Any]: + """Transforms the serialized field of a run dictionary to be compatible + with WBTraceTree. + :param serialized: The serialized field of a run dictionary. + :return: The transformed serialized field. + """ + serialized = handle_id_and_kwargs(serialized, root=True) + serialized = remove_exact_and_partial_keys(serialized) + return serialized + + def transform_run(run: Dict[str, Any]) -> Dict[str, Any]: + """Transforms a run dictionary to be compatible with WBTraceTree. + :param run: The run dictionary to transform. + :return: The transformed run dictionary. + """ + transformed_dict = transform_serialized(run) + + serialized = transformed_dict.pop("serialized") + for k, v in serialized.items(): + transformed_dict[k] = v + + _kind = transformed_dict.get("_kind", None) + name = transformed_dict.pop("name", None) + + if not name: + name = _kind + + output_dict = { + f"{name}": transformed_dict, + } + return output_dict + + return list(map(transform_run, runs)) + + +def build_tree(runs: List[Dict[str, Any]]) -> Dict[str, Any]: + """Builds a nested dictionary from a list of runs. + :param runs: The list of runs to build the tree from. + :return: The nested dictionary representing the langchain Run in a tree + structure compatible with WBTraceTree. + """ + id_to_data = {} + child_to_parent = {} + + for entity in runs: + for key, data in entity.items(): + id_val = data.pop("id", None) + parent_run_id = data.pop("parent_run_id", None) + id_to_data[id_val] = {key: data} + if parent_run_id: + child_to_parent[id_val] = parent_run_id + + for child_id, parent_id in child_to_parent.items(): + parent_dict = id_to_data[parent_id] + parent_dict[next(iter(parent_dict))][next(iter(id_to_data[child_id]))] = ( + id_to_data[child_id][next(iter(id_to_data[child_id]))] + ) + + root_dict = next( + data for id_val, data in id_to_data.items() if id_val not in child_to_parent + ) + + return root_dict + + +class WandbRunArgs(TypedDict): + """Arguments for the WandbTracer.""" + + job_type: Optional[str] + dir: Optional[StrPath] + config: Union[Dict, str, None] + project: Optional[str] + entity: Optional[str] + reinit: Optional[bool] + tags: Optional[Sequence] + group: Optional[str] + name: Optional[str] + notes: Optional[str] + magic: Optional[Union[dict, str, bool]] + config_exclude_keys: Optional[List[str]] + config_include_keys: Optional[List[str]] + anonymous: Optional[str] + mode: Optional[str] + allow_val_change: Optional[bool] + resume: Optional[Union[bool, str]] + force: Optional[bool] + tensorboard: Optional[bool] + sync_tensorboard: Optional[bool] + monitor_gym: Optional[bool] + save_code: Optional[bool] + id: Optional[str] + settings: Union[WBSettings, Dict[str, Any], None] + + +class WandbTracer(BaseTracer): + """Callback Handler that logs to Weights and Biases. + + This handler will log the model architecture and run traces to Weights and Biases. + This will ensure that all LangChain activity is logged to W&B. + """ + + _run: Optional[WBRun] = None + _run_args: Optional[WandbRunArgs] = None + + def __init__( + self, + run_args: Optional[WandbRunArgs] = None, + io_serializer: Callable = _serialize_io, + **kwargs: Any, + ) -> None: + """Initializes the WandbTracer. + + Parameters: + run_args: (dict, optional) Arguments to pass to `wandb.init()`. If not + provided, `wandb.init()` will be called with no arguments. Please + refer to the `wandb.init` for more details. + io_serializer: callable A function that serializes the input and outputs + of a run to store in wandb. Defaults to "_serialize_io" + + To use W&B to monitor all LangChain activity, add this tracer like any other + LangChain callback: + ``` + from wandb.integration.langchain import WandbTracer + + tracer = WandbTracer() + chain = LLMChain(llm, callbacks=[tracer]) + # ...end of notebook / script: + tracer.finish() + ``` + """ + super().__init__(**kwargs) + try: + import wandb + from wandb.sdk.data_types import trace_tree + except ImportError as e: + raise ImportError( + "Could not import wandb python package." + "Please install it with `pip install -U wandb`." + ) from e + self._wandb = wandb + self._trace_tree = trace_tree + self._run_args = run_args + self._ensure_run(should_print_url=(wandb.run is None)) + self._io_serializer = io_serializer + warn_deprecated( + "0.3.8", + pending=False, + message=( + "Please use the `WeaveTracer` from the `weave` package instead of this." + "The `WeaveTracer` is a more flexible and powerful tool for logging " + "and tracing your LangChain callables." + "Find more information at https://weave-docs.wandb.ai/guides/integrations/langchain" + ), + alternative=( + "Please instantiate the WeaveTracer from " + "`weave.integrations.langchain import WeaveTracer` ." + "For autologging simply use `weave.init()` and log all traces " + "from your LangChain callables." + ), + ) + + def finish(self) -> None: + """Waits for all asynchronous processes to finish and data to upload. + + Proxy for `wandb.finish()`. + """ + self._wandb.finish() + + def _ensure_run(self, should_print_url: bool = False) -> None: + """Ensures an active W&B run exists. + + If not, will start a new run with the provided run_args. + """ + if self._wandb.run is None: + run_args: Dict = {**(self._run_args or {})} + + if "settings" not in run_args: + run_args["settings"] = {"silent": True} + + self._wandb.init(**run_args) + if self._wandb.run is not None: + if should_print_url: + run_url = self._wandb.run.settings.run_url + self._wandb.termlog( + f"Streaming LangChain activity to W&B at {run_url}\n" + "`WandbTracer` is currently in beta.\n" + "Please report any issues to " + "https://github.com/wandb/wandb/issues with the tag " + "`langchain`." + ) + + self._wandb.run._label(repo="langchain") + + def process_model_dict(self, run: Run) -> Optional[Dict[str, Any]]: + """Utility to process a run for wandb model_dict serialization. + :param run: The run to process. + :return: The convert model_dict to pass to WBTraceTree. + """ + try: + data = json.loads(run.json()) + processed = flatten_run(data) + keep_keys = ( + "id", + "name", + "serialized", + "parent_run_id", + ) + processed = truncate_run_iterative(processed, keep_keys=keep_keys) + exact_keys, partial_keys = ( + ("lc", "type", "graph"), + ( + "api_key", + "input", + "output", + ), + ) + processed = modify_serialized_iterative( + processed, exact_keys=exact_keys, partial_keys=partial_keys + ) + output = build_tree(processed) + return output + except Exception as e: + if PRINT_WARNINGS: + self._wandb.termerror(f"WARNING: Failed to serialize model: {e}") + return None + + def _log_trace_from_run(self, run: Run) -> None: + """Logs a LangChain Run to W*B as a W&B Trace.""" + self._ensure_run() + + def create_trace( + run: "Run", parent: Optional["Trace"] = None + ) -> Optional["Trace"]: + """ + Create a trace for a given run and its child runs. + + Args: + run (Run): The run for which to create a trace. + parent (Optional[Trace]): The parent trace. + If provided, the created trace is added as a child to the parent trace. + + Returns: + The created trace. If an error occurs during the creation of the trace, + None is returned. + + Raises: + Exception: If an error occurs during the creation of the trace, + no exception is raised and a warning is printed. + """ + + def get_metadata_dict(r: "Run") -> Dict[str, Any]: + """ + Extract metadata from a given run. + + This function extracts metadata from a given run + and returns it as a dictionary. + + Args: + r (Run): The run from which to extract metadata. + + Returns: + `dict` containing the extracted metadata. + """ + run_dict = json.loads(r.json()) + metadata_dict = run_dict.get("metadata", {}) + metadata_dict["run_id"] = run_dict.get("id") + metadata_dict["parent_run_id"] = run_dict.get("parent_run_id") + metadata_dict["tags"] = run_dict.get("tags") + metadata_dict["execution_order"] = run_dict.get( + "dotted_order", "" + ).count(".") + return metadata_dict + + try: + if run.run_type in ["llm", "tool"]: + run_type = run.run_type + elif run.run_type == "chain": + run_type = "agent" if "agent" in run.name.lower() else "chain" + else: + run_type = None + + metadata = get_metadata_dict(run) + trace_tree = self._trace_tree.Trace( + name=run.name, + kind=run_type, + status_code="error" if run.error else "success", + start_time_ms=int(run.start_time.timestamp() * 1000) + if run.start_time is not None + else None, + end_time_ms=int(run.end_time.timestamp() * 1000) + if run.end_time is not None + else None, + metadata=metadata, + inputs=self._io_serializer(run.inputs), + outputs=self._io_serializer(run.outputs), + ) + + # If the run has child runs, recursively create traces for them + for child_run in run.child_runs: + create_trace(child_run, trace_tree) + + if parent is None: + return trace_tree + else: + parent.add_child(trace_tree) + return parent + except Exception as e: + if PRINT_WARNINGS: + self._wandb.termwarn( + f"WARNING: Failed to serialize trace for run due to: {e}" + ) + return None + + run_trace = create_trace(run) + model_dict = self.process_model_dict(run) + if model_dict is not None and run_trace is not None: + run_trace._model_dict = model_dict + if self._wandb.run is not None and run_trace is not None: + run_trace.log("langchain_trace") + + def _persist_run(self, run: "Run") -> None: + """Persist a run.""" + self._log_trace_from_run(run) diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c1904b334f068dba0671a43cd330ccb1655a7f70 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/__pycache__/llm_requests.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/__pycache__/llm_requests.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2326065d5bee9dfe0fedb22f2cafef63b775d08d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/__pycache__/llm_requests.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/ernie_functions/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/chains/ernie_functions/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..28e91d12dccd217aa48cf3f7163e91da3f78549e --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/ernie_functions/__init__.py @@ -0,0 +1,17 @@ +from langchain_classic.chains.ernie_functions.base import ( + convert_to_ernie_function, + create_ernie_fn_chain, + create_ernie_fn_runnable, + create_structured_output_chain, + create_structured_output_runnable, + get_ernie_output_parser, +) + +__all__ = [ + "convert_to_ernie_function", + "create_structured_output_chain", + "create_ernie_fn_chain", + "create_structured_output_runnable", + "create_ernie_fn_runnable", + "get_ernie_output_parser", +] diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/ernie_functions/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/ernie_functions/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2cca6683aeee0f95413c6fcdee2a5ca610e39c92 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/ernie_functions/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/ernie_functions/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/ernie_functions/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4bd15c5c076102a91bc7d21900cd1615ae4f7ca6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/ernie_functions/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/ernie_functions/base.py b/python/user_packages/Python313/site-packages/langchain_community/chains/ernie_functions/base.py new file mode 100644 index 0000000000000000000000000000000000000000..e80b70268763f99d13aa128ddede0203453f7e80 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/ernie_functions/base.py @@ -0,0 +1,553 @@ +"""Methods for creating chains that use Ernie function-calling APIs.""" + +import inspect +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) + +from langchain_classic.chains import LLMChain +from langchain_core.language_models import BaseLanguageModel +from langchain_core.output_parsers import ( + BaseGenerationOutputParser, + BaseLLMOutputParser, + BaseOutputParser, +) +from langchain_core.prompts import BasePromptTemplate +from langchain_core.runnables import Runnable +from langchain_core.utils.pydantic import is_basemodel_subclass +from pydantic import BaseModel + +from langchain_community.output_parsers.ernie_functions import ( + JsonOutputFunctionsParser, + PydanticAttrOutputFunctionsParser, + PydanticOutputFunctionsParser, +) +from langchain_community.utils.ernie_functions import convert_pydantic_to_ernie_function + +PYTHON_TO_JSON_TYPES = { + "str": "string", + "int": "number", + "float": "number", + "bool": "boolean", +} + + +def _get_python_function_name(function: Callable) -> str: + """Get the name of a Python function.""" + return function.__name__ + + +def _parse_python_function_docstring(function: Callable) -> Tuple[str, dict]: + """Parse the function and argument descriptions from the docstring of a function. + + Assumes the function docstring follows Google Python style guide. + """ + docstring = inspect.getdoc(function) + if docstring: + docstring_blocks = docstring.split("\n\n") + descriptors = [] + args_block = None + past_descriptors = False + for block in docstring_blocks: + if block.startswith("Args:"): + args_block = block + break + elif block.startswith("Returns:") or block.startswith("Example:"): + # Don't break in case Args come after + past_descriptors = True + elif not past_descriptors: + descriptors.append(block) + else: + continue + description = " ".join(descriptors) + else: + description = "" + args_block = None + arg_descriptions = {} + if args_block: + arg = None + for line in args_block.split("\n")[1:]: + if ":" in line: + arg, desc = line.split(":") + arg_descriptions[arg.strip()] = desc.strip() + elif arg: + arg_descriptions[arg.strip()] += " " + line.strip() + return description, arg_descriptions + + +def _get_python_function_arguments(function: Callable, arg_descriptions: dict) -> dict: + """Get JsonSchema describing a Python functions arguments. + + Assumes all function arguments are of primitive types (int, float, str, bool) or + are subclasses of pydantic.BaseModel. + """ + properties = {} + annotations = inspect.getfullargspec(function).annotations + for arg, arg_type in annotations.items(): + if arg == "return": + continue + if isinstance(arg_type, type) and is_basemodel_subclass(arg_type): + # Mypy error: + # "type" has no attribute "schema" + properties[arg] = arg_type.schema() # type: ignore[attr-defined] + elif arg_type.__name__ in PYTHON_TO_JSON_TYPES: + properties[arg] = {"type": PYTHON_TO_JSON_TYPES[arg_type.__name__]} + if arg in arg_descriptions: + if arg not in properties: + properties[arg] = {} + properties[arg]["description"] = arg_descriptions[arg] + return properties + + +def _get_python_function_required_args(function: Callable) -> List[str]: + """Get the required arguments for a Python function.""" + spec = inspect.getfullargspec(function) + required = spec.args[: -len(spec.defaults)] if spec.defaults else spec.args + required += [k for k in spec.kwonlyargs if k not in (spec.kwonlydefaults or {})] + + is_class = type(function) is type + if is_class and required[0] == "self": + required = required[1:] + return required + + +def convert_python_function_to_ernie_function( + function: Callable, +) -> Dict[str, Any]: + """Convert a Python function to an Ernie function-calling API compatible dict. + + Assumes the Python function has type hints and a docstring with a description. If + the docstring has Google Python style argument descriptions, these will be + included as well. + """ + description, arg_descriptions = _parse_python_function_docstring(function) + return { + "name": _get_python_function_name(function), + "description": description, + "parameters": { + "type": "object", + "properties": _get_python_function_arguments(function, arg_descriptions), + "required": _get_python_function_required_args(function), + }, + } + + +def convert_to_ernie_function( + function: Union[Dict[str, Any], Type[BaseModel], Callable], +) -> Dict[str, Any]: + """Convert a raw function/class to an Ernie function. + + Args: + function: Either a dictionary, a pydantic.BaseModel class, or a Python function. + If a dictionary is passed in, it is assumed to already be a valid Ernie + function. + + Returns: + A dict version of the passed in function which is compatible with the + Ernie function-calling API. + """ + if isinstance(function, dict): + return function + elif isinstance(function, type) and is_basemodel_subclass(function): + return cast(Dict, convert_pydantic_to_ernie_function(function)) + elif callable(function): + return convert_python_function_to_ernie_function(function) + + else: + raise ValueError( + f"Unsupported function type {type(function)}. Functions must be passed in" + f" as Dict, pydantic.BaseModel, or Callable." + ) + + +def get_ernie_output_parser( + functions: Sequence[Union[Dict[str, Any], Type[BaseModel], Callable]], +) -> Union[BaseOutputParser, BaseGenerationOutputParser]: + """Get the appropriate function output parser given the user functions. + + Args: + functions: Sequence where element is a dictionary, a pydantic.BaseModel class, + or a Python function. If a dictionary is passed in, it is assumed to + already be a valid Ernie function. + + Returns: + A PydanticOutputFunctionsParser if functions are Pydantic classes, otherwise + a JsonOutputFunctionsParser. If there's only one function and it is + not a Pydantic class, then the output parser will automatically extract + only the function arguments and not the function name. + """ + function_names = [convert_to_ernie_function(f)["name"] for f in functions] + if isinstance(functions[0], type) and is_basemodel_subclass(functions[0]): + if len(functions) > 1: + pydantic_schema: Union[Dict, Type[BaseModel]] = { + name: fn for name, fn in zip(function_names, functions) + } + else: + pydantic_schema = functions[0] + output_parser: Union[BaseOutputParser, BaseGenerationOutputParser] = ( + PydanticOutputFunctionsParser(pydantic_schema=pydantic_schema) + ) + else: + output_parser = JsonOutputFunctionsParser(args_only=len(functions) <= 1) + return output_parser + + +def create_ernie_fn_runnable( + functions: Sequence[Union[Dict[str, Any], Type[BaseModel], Callable]], + llm: Runnable, + prompt: BasePromptTemplate, + *, + output_parser: Optional[Union[BaseOutputParser, BaseGenerationOutputParser]] = None, + **kwargs: Any, +) -> Runnable: + """Create a runnable sequence that uses Ernie functions. + + Args: + functions: A sequence of either dictionaries, pydantic.BaseModels classes, or + Python functions. If dictionaries are passed in, they are assumed to + already be a valid Ernie functions. If only a single + function is passed in, then it will be enforced that the model use that + function. pydantic.BaseModels and Python functions should have docstrings + describing what the function does. For best results, pydantic.BaseModels + should have descriptions of the parameters and Python functions should have + Google Python style args descriptions in the docstring. Additionally, + Python functions should only use primitive types (str, int, float, bool) or + pydantic.BaseModels for arguments. + llm: Language model to use, assumed to support the Ernie function-calling API. + prompt: BasePromptTemplate to pass to the model. + output_parser: BaseLLMOutputParser to use for parsing model outputs. By default + will be inferred from the function types. If pydantic.BaseModels are passed + in, then the OutputParser will try to parse outputs using those. Otherwise + model outputs will simply be parsed as JSON. If multiple functions are + passed in and they are not pydantic.BaseModels, the chain output will + include both the name of the function that was returned and the arguments + to pass to the function. + + Returns: + A runnable sequence that will pass in the given functions to the model when run. + + Example: + .. code-block:: python + + from typing import Optional + + from langchain_classic.chains.ernie_functions import create_ernie_fn_chain + from langchain_community.chat_models import ErnieBotChat + from langchain_core.prompts import ChatPromptTemplate + from pydantic import BaseModel, Field + + + class RecordPerson(BaseModel): + \"\"\"Record some identifying information about a person.\"\"\" + + name: str = Field(..., description="The person's name") + age: int = Field(..., description="The person's age") + fav_food: Optional[str] = Field(None, description="The person's favorite food") + + + class RecordDog(BaseModel): + \"\"\"Record some identifying information about a dog.\"\"\" + + name: str = Field(..., description="The dog's name") + color: str = Field(..., description="The dog's color") + fav_food: Optional[str] = Field(None, description="The dog's favorite food") + + + llm = ErnieBotChat(model_name="ERNIE-Bot-4") + prompt = ChatPromptTemplate.from_messages( + [ + ("user", "Make calls to the relevant function to record the entities in the following input: {input}"), + ("assistant", "OK!"), + ("user", "Tip: Make sure to answer in the correct format"), + ] + ) + chain = create_ernie_fn_runnable([RecordPerson, RecordDog], llm, prompt) + chain.invoke({"input": "Harry was a chubby brown beagle who loved chicken"}) + # -> RecordDog(name="Harry", color="brown", fav_food="chicken") + """ # noqa: E501 + if not functions: + raise ValueError("Need to pass in at least one function. Received zero.") + ernie_functions = [convert_to_ernie_function(f) for f in functions] + llm_kwargs: Dict[str, Any] = {"functions": ernie_functions, **kwargs} + if len(ernie_functions) == 1: + llm_kwargs["function_call"] = {"name": ernie_functions[0]["name"]} + output_parser = output_parser or get_ernie_output_parser(functions) + return prompt | llm.bind(**llm_kwargs) | output_parser + + +def create_structured_output_runnable( + output_schema: Union[Dict[str, Any], Type[BaseModel]], + llm: Runnable, + prompt: BasePromptTemplate, + *, + output_parser: Optional[Union[BaseOutputParser, BaseGenerationOutputParser]] = None, + **kwargs: Any, +) -> Runnable: + """Create a runnable that uses an Ernie function to get a structured output. + + Args: + output_schema: Either a dictionary or pydantic.BaseModel class. If a dictionary + is passed in, it's assumed to already be a valid JsonSchema. + For best results, pydantic.BaseModels should have docstrings describing what + the schema represents and descriptions for the parameters. + llm: Language model to use, assumed to support the Ernie function-calling API. + prompt: BasePromptTemplate to pass to the model. + output_parser: BaseLLMOutputParser to use for parsing model outputs. By default + will be inferred from the function types. If pydantic.BaseModels are passed + in, then the OutputParser will try to parse outputs using those. Otherwise + model outputs will simply be parsed as JSON. + + Returns: + A runnable sequence that will pass the given function to the model when run. + + Example: + .. code-block:: python + + from typing import Optional + + from langchain_classic.chains.ernie_functions import create_structured_output_chain + from langchain_community.chat_models import ErnieBotChat + from langchain_core.prompts import ChatPromptTemplate + from pydantic import BaseModel, Field + + class Dog(BaseModel): + \"\"\"Identifying information about a dog.\"\"\" + + name: str = Field(..., description="The dog's name") + color: str = Field(..., description="The dog's color") + fav_food: Optional[str] = Field(None, description="The dog's favorite food") + + llm = ErnieBotChat(model_name="ERNIE-Bot-4") + prompt = ChatPromptTemplate.from_messages( + [ + ("user", "Use the given format to extract information from the following input: {input}"), + ("assistant", "OK!"), + ("user", "Tip: Make sure to answer in the correct format"), + ] + ) + chain = create_structured_output_chain(Dog, llm, prompt) + chain.invoke({"input": "Harry was a chubby brown beagle who loved chicken"}) + # -> Dog(name="Harry", color="brown", fav_food="chicken") + """ # noqa: E501 + if isinstance(output_schema, dict): + function: Any = { + "name": "output_formatter", + "description": ( + "Output formatter. Should always be used to format your response to the" + " user." + ), + "parameters": output_schema, + } + else: + + class _OutputFormatter(BaseModel): + """Output formatter. Should always be used to format your response to the user.""" # noqa: E501 + + output: output_schema # type: ignore[valid-type] + + function = _OutputFormatter + output_parser = output_parser or PydanticAttrOutputFunctionsParser( + pydantic_schema=_OutputFormatter, attr_name="output" + ) + return create_ernie_fn_runnable( + [function], + llm, + prompt, + output_parser=output_parser, + **kwargs, + ) + + +""" --- Legacy --- """ + + +def create_ernie_fn_chain( + functions: Sequence[Union[Dict[str, Any], Type[BaseModel], Callable]], + llm: BaseLanguageModel, + prompt: BasePromptTemplate, + *, + output_key: str = "function", + output_parser: Optional[BaseLLMOutputParser] = None, + **kwargs: Any, +) -> LLMChain: + """[Legacy] Create an LLM chain that uses Ernie functions. + + Args: + functions: A sequence of either dictionaries, pydantic.BaseModels classes, or + Python functions. If dictionaries are passed in, they are assumed to + already be a valid Ernie functions. If only a single + function is passed in, then it will be enforced that the model use that + function. pydantic.BaseModels and Python functions should have docstrings + describing what the function does. For best results, pydantic.BaseModels + should have descriptions of the parameters and Python functions should have + Google Python style args descriptions in the docstring. Additionally, + Python functions should only use primitive types (str, int, float, bool) or + pydantic.BaseModels for arguments. + llm: Language model to use, assumed to support the Ernie function-calling API. + prompt: BasePromptTemplate to pass to the model. + output_key: The key to use when returning the output in LLMChain.__call__. + output_parser: BaseLLMOutputParser to use for parsing model outputs. By default + will be inferred from the function types. If pydantic.BaseModels are passed + in, then the OutputParser will try to parse outputs using those. Otherwise + model outputs will simply be parsed as JSON. If multiple functions are + passed in and they are not pydantic.BaseModels, the chain output will + include both the name of the function that was returned and the arguments + to pass to the function. + + Returns: + An LLMChain that will pass in the given functions to the model when run. + + Example: + .. code-block:: python + + from typing import Optional + + from langchain_classic.chains.ernie_functions import create_ernie_fn_chain + from langchain_community.chat_models import ErnieBotChat + from langchain_core.prompts import ChatPromptTemplate + + from pydantic import BaseModel, Field + + + class RecordPerson(BaseModel): + \"\"\"Record some identifying information about a person.\"\"\" + + name: str = Field(..., description="The person's name") + age: int = Field(..., description="The person's age") + fav_food: Optional[str] = Field(None, description="The person's favorite food") + + + class RecordDog(BaseModel): + \"\"\"Record some identifying information about a dog.\"\"\" + + name: str = Field(..., description="The dog's name") + color: str = Field(..., description="The dog's color") + fav_food: Optional[str] = Field(None, description="The dog's favorite food") + + + llm = ErnieBotChat(model_name="ERNIE-Bot-4") + prompt = ChatPromptTemplate.from_messages( + [ + ("user", "Make calls to the relevant function to record the entities in the following input: {input}"), + ("assistant", "OK!"), + ("user", "Tip: Make sure to answer in the correct format"), + ] + ) + chain = create_ernie_fn_chain([RecordPerson, RecordDog], llm, prompt) + chain.run("Harry was a chubby brown beagle who loved chicken") + # -> RecordDog(name="Harry", color="brown", fav_food="chicken") + """ # noqa: E501 + if not functions: + raise ValueError("Need to pass in at least one function. Received zero.") + ernie_functions = [convert_to_ernie_function(f) for f in functions] + output_parser = output_parser or get_ernie_output_parser(functions) + llm_kwargs: Dict[str, Any] = { + "functions": ernie_functions, + } + if len(ernie_functions) == 1: + llm_kwargs["function_call"] = {"name": ernie_functions[0]["name"]} + llm_chain = LLMChain( + llm=llm, + prompt=prompt, + output_parser=output_parser, + llm_kwargs=llm_kwargs, + output_key=output_key, + **kwargs, + ) + return llm_chain + + +def create_structured_output_chain( + output_schema: Union[Dict[str, Any], Type[BaseModel]], + llm: BaseLanguageModel, + prompt: BasePromptTemplate, + *, + output_key: str = "function", + output_parser: Optional[BaseLLMOutputParser] = None, + **kwargs: Any, +) -> LLMChain: + """[Legacy] Create an LLMChain that uses an Ernie function to get a structured output. + + Args: + output_schema: Either a dictionary or pydantic.BaseModel class. If a dictionary + is passed in, it's assumed to already be a valid JsonSchema. + For best results, pydantic.BaseModels should have docstrings describing what + the schema represents and descriptions for the parameters. + llm: Language model to use, assumed to support the Ernie function-calling API. + prompt: BasePromptTemplate to pass to the model. + output_key: The key to use when returning the output in LLMChain.__call__. + output_parser: BaseLLMOutputParser to use for parsing model outputs. By default + will be inferred from the function types. If pydantic.BaseModels are passed + in, then the OutputParser will try to parse outputs using those. Otherwise + model outputs will simply be parsed as JSON. + + Returns: + An LLMChain that will pass the given function to the model. + + Example: + .. code-block:: python + + from typing import Optional + + from langchain_classic.chains.ernie_functions import create_structured_output_chain + from langchain_community.chat_models import ErnieBotChat + from langchain_core.prompts import ChatPromptTemplate + + from pydantic import BaseModel, Field + + class Dog(BaseModel): + \"\"\"Identifying information about a dog.\"\"\" + + name: str = Field(..., description="The dog's name") + color: str = Field(..., description="The dog's color") + fav_food: Optional[str] = Field(None, description="The dog's favorite food") + + llm = ErnieBotChat(model_name="ERNIE-Bot-4") + prompt = ChatPromptTemplate.from_messages( + [ + ("user", "Use the given format to extract information from the following input: {input}"), + ("assistant", "OK!"), + ("user", "Tip: Make sure to answer in the correct format"), + ] + ) + chain = create_structured_output_chain(Dog, llm, prompt) + chain.run("Harry was a chubby brown beagle who loved chicken") + # -> Dog(name="Harry", color="brown", fav_food="chicken") + """ # noqa: E501 + if isinstance(output_schema, dict): + function: Any = { + "name": "output_formatter", + "description": ( + "Output formatter. Should always be used to format your response to the" + " user." + ), + "parameters": output_schema, + } + else: + + class _OutputFormatter(BaseModel): + """Output formatter. Should always be used to format your response to the user.""" # noqa: E501 + + output: output_schema # type: ignore[valid-type] + + function = _OutputFormatter + output_parser = output_parser or PydanticAttrOutputFunctionsParser( + pydantic_schema=_OutputFormatter, attr_name="output" + ) + return create_ernie_fn_chain( + [function], + llm, + prompt, + output_key=output_key, + output_parser=output_parser, + **kwargs, + ) diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f3bc55efbca8efd011ea4a5aa5fbd25bb5b4c457 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__init__.py @@ -0,0 +1 @@ +"""Question answering over a knowledge graph.""" diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ff743db5a62b8fa4ae7b24849f315c5d49242327 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/arangodb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/arangodb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..471fbab01ab5e25cbeb1d906563c2e5cfab3cfff Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/arangodb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3f52bd185bd6e5e3e4b58124ea306b0f736d0acc Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/cypher.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/cypher.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e5a6e3469e0876b8be3dbc6901dadaaf97c99ceb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/cypher.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/cypher_utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/cypher_utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b9bfa1db98a69a7768da6ba884c76e9a987b6062 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/cypher_utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/falkordb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/falkordb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6179fe86a3a8b940adbf9af742a0d864ec6aa316 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/falkordb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/gremlin.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/gremlin.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1ec36871571fb7b58fa2dc0e2509667910b94cb9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/gremlin.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/hugegraph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/hugegraph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6a26ce37816fe5a96ceb45344040b37fa4a52861 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/hugegraph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/kuzu.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/kuzu.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..64726fa1ea47d054953d39335b25a564274f4ff0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/kuzu.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/memgraph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/memgraph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b1ac068a1032703d948a2837a122ed707bb479ed Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/memgraph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/nebulagraph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/nebulagraph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ac2a63846ea1a68fccc1677aeb7c61dbbcb212b0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/nebulagraph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/neptune_cypher.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/neptune_cypher.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b7d9cdd4ef3a3fce00ab71a17c1c5be0f7fbaa8d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/neptune_cypher.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/neptune_sparql.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/neptune_sparql.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f10dc25237591ccacebce9398567b11e615e586b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/neptune_sparql.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/ontotext_graphdb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/ontotext_graphdb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a5958d9e81193928e22cc3d4234ed19dd6758c28 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/ontotext_graphdb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/prompts.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/prompts.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..960900b9d98e58d5a69030331b88ba2c003495f0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/prompts.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/sparql.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/sparql.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..49010626e159a41ddd9522c0aeef4b2ff6a97ca9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/__pycache__/sparql.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/arangodb.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/arangodb.py new file mode 100644 index 0000000000000000000000000000000000000000..42a3d362b840a083e731d0c49ed4c0e226403739 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/arangodb.py @@ -0,0 +1,273 @@ +"""Question answering over a graph.""" + +from __future__ import annotations + +import re +from typing import Any, Dict, List, Optional + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_core.callbacks import CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.prompts import BasePromptTemplate +from pydantic import Field + +from langchain_community.chains.graph_qa.prompts import ( + AQL_FIX_PROMPT, + AQL_GENERATION_PROMPT, + AQL_QA_PROMPT, +) +from langchain_community.graphs.arangodb_graph import ArangoGraph + + +class ArangoGraphQAChain(Chain): + """Chain for question-answering against a graph by generating AQL statements. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + graph: ArangoGraph = Field(exclude=True) + aql_generation_chain: LLMChain + aql_fix_chain: LLMChain + qa_chain: LLMChain + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + + # Specifies the maximum number of AQL Query Results to return + top_k: int = 10 + + # Specifies the set of AQL Query Examples that promote few-shot-learning + aql_examples: str = "" + + # Specify whether to return the AQL Query in the output dictionary + return_aql_query: bool = False + + # Specify whether to return the AQL JSON Result in the output dictionary + return_aql_result: bool = False + + # Specify the maximum amount of AQL Generation attempts that should be made + max_aql_generation_attempts: int = 3 + + allow_dangerous_requests: bool = False + """Forced user opt-in to acknowledge that the chain can make dangerous requests. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize the chain.""" + super().__init__(**kwargs) + if self.allow_dangerous_requests is not True: + raise ValueError( + "In order to use this chain, you must acknowledge that it can make " + "dangerous requests by setting `allow_dangerous_requests` to `True`." + "You must narrowly scope the permissions of the database connection " + "to only include necessary permissions. Failure to do so may result " + "in data corruption or loss or reading sensitive data if such data is " + "present in the database." + "Only use this chain if you understand the risks and have taken the " + "necessary precautions. " + "See https://python.langchain.com/docs/security for more information." + ) + + @property + def input_keys(self) -> List[str]: + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + return [self.output_key] + + @property + def _chain_type(self) -> str: + return "graph_aql_chain" + + @classmethod + def from_llm( + cls, + llm: BaseLanguageModel, + *, + qa_prompt: BasePromptTemplate = AQL_QA_PROMPT, + aql_generation_prompt: BasePromptTemplate = AQL_GENERATION_PROMPT, + aql_fix_prompt: BasePromptTemplate = AQL_FIX_PROMPT, + **kwargs: Any, + ) -> ArangoGraphQAChain: + """Initialize from LLM.""" + qa_chain = LLMChain(llm=llm, prompt=qa_prompt) + aql_generation_chain = LLMChain(llm=llm, prompt=aql_generation_prompt) + aql_fix_chain = LLMChain(llm=llm, prompt=aql_fix_prompt) + + return cls( + qa_chain=qa_chain, + aql_generation_chain=aql_generation_chain, + aql_fix_chain=aql_fix_chain, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, Any]: + """ + Generate an AQL statement from user input, use it retrieve a response + from an ArangoDB Database instance, and respond to the user input + in natural language. + + Users can modify the following ArangoGraphQAChain Class Variables: + + :var top_k: The maximum number of AQL Query Results to return + :type top_k: int + + :var aql_examples: A set of AQL Query Examples that are passed to + the AQL Generation Prompt Template to promote few-shot-learning. + Defaults to an empty string. + :type aql_examples: str + + :var return_aql_query: Whether to return the AQL Query in the + output dictionary. Defaults to False. + :type return_aql_query: bool + + :var return_aql_result: Whether to return the AQL Query in the + output dictionary. Defaults to False + :type return_aql_result: bool + + :var max_aql_generation_attempts: The maximum amount of AQL + Generation attempts to be made prior to raising the last + AQL Query Execution Error. Defaults to 3. + :type max_aql_generation_attempts: int + """ + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + callbacks = _run_manager.get_child() + user_input = inputs[self.input_key] + + ######################### + # Generate AQL Query # + aql_generation_output = self.aql_generation_chain.run( + { + "adb_schema": self.graph.schema, + "aql_examples": self.aql_examples, + "user_input": user_input, + }, + callbacks=callbacks, + ) + ######################### + + aql_query = "" + aql_error = "" + aql_result = None + aql_generation_attempt = 1 + + while ( + aql_result is None + and aql_generation_attempt < self.max_aql_generation_attempts + 1 + ): + ##################### + # Extract AQL Query # + pattern = r"```(?i:aql)?(.*?)```" + matches = re.findall(pattern, aql_generation_output, re.DOTALL) + if not matches: + _run_manager.on_text( + "Invalid Response: ", end="\n", verbose=self.verbose + ) + _run_manager.on_text( + aql_generation_output, color="red", end="\n", verbose=self.verbose + ) + raise ValueError(f"Response is Invalid: {aql_generation_output}") + + aql_query = matches[0] + ##################### + + _run_manager.on_text( + f"AQL Query ({aql_generation_attempt}):", verbose=self.verbose + ) + _run_manager.on_text( + aql_query, color="green", end="\n", verbose=self.verbose + ) + + ##################### + # Execute AQL Query # + from arango import AQLQueryExecuteError + + try: + aql_result = self.graph.query(aql_query, self.top_k) + except AQLQueryExecuteError as e: + aql_error = e.error_message + + _run_manager.on_text( + "AQL Query Execution Error: ", end="\n", verbose=self.verbose + ) + _run_manager.on_text( + aql_error, color="yellow", end="\n\n", verbose=self.verbose + ) + + ######################## + # Retry AQL Generation # + aql_generation_output = self.aql_fix_chain.run( + { + "adb_schema": self.graph.schema, + "aql_query": aql_query, + "aql_error": aql_error, + }, + callbacks=callbacks, + ) + ######################## + + ##################### + + aql_generation_attempt += 1 + + if aql_result is None: + m = f""" + Maximum amount of AQL Query Generation attempts reached. + Unable to execute the AQL Query due to the following error: + {aql_error} + """ + raise ValueError(m) + + _run_manager.on_text("AQL Result:", end="\n", verbose=self.verbose) + _run_manager.on_text( + str(aql_result), color="green", end="\n", verbose=self.verbose + ) + + ######################## + # Interpret AQL Result # + result = self.qa_chain( + { + "adb_schema": self.graph.schema, + "user_input": user_input, + "aql_query": aql_query, + "aql_result": aql_result, + }, + callbacks=callbacks, + ) + ######################## + + # Return results # + result = {self.output_key: result[self.qa_chain.output_key]} + + if self.return_aql_query: + result["aql_query"] = aql_query + + if self.return_aql_result: + result["aql_result"] = aql_result + + return result diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/base.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/base.py new file mode 100644 index 0000000000000000000000000000000000000000..f3e31af96a896b1545065a8d108c89c7e9d2f840 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/base.py @@ -0,0 +1,104 @@ +"""Question answering over a graph.""" + +from __future__ import annotations + +from typing import Any, Dict, List, Optional + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_core.callbacks.manager import CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.prompts import BasePromptTemplate +from pydantic import Field + +from langchain_community.chains.graph_qa.prompts import ( + ENTITY_EXTRACTION_PROMPT, + GRAPH_QA_PROMPT, +) +from langchain_community.graphs.networkx_graph import NetworkxEntityGraph, get_entities + + +class GraphQAChain(Chain): + """Chain for question-answering against a graph. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + graph: NetworkxEntityGraph = Field(exclude=True) + entity_extraction_chain: LLMChain + qa_chain: LLMChain + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + + @property + def input_keys(self) -> List[str]: + """Input keys. + + :meta private: + """ + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + """Output keys. + + :meta private: + """ + _output_keys = [self.output_key] + return _output_keys + + @classmethod + def from_llm( + cls, + llm: BaseLanguageModel, + qa_prompt: BasePromptTemplate = GRAPH_QA_PROMPT, + entity_prompt: BasePromptTemplate = ENTITY_EXTRACTION_PROMPT, + **kwargs: Any, + ) -> GraphQAChain: + """Initialize from LLM.""" + qa_chain = LLMChain(llm=llm, prompt=qa_prompt) + entity_chain = LLMChain(llm=llm, prompt=entity_prompt) + + return cls( + qa_chain=qa_chain, + entity_extraction_chain=entity_chain, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, str]: + """Extract entities, look up info and answer question.""" + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + question = inputs[self.input_key] + + entity_string = self.entity_extraction_chain.run(question) + + _run_manager.on_text("Entities Extracted:", end="\n", verbose=self.verbose) + _run_manager.on_text( + entity_string, color="green", end="\n", verbose=self.verbose + ) + entities = get_entities(entity_string) + context = "" + all_triplets = [] + for entity in entities: + all_triplets.extend(self.graph.get_entity_knowledge(entity)) + context = "\n".join(all_triplets) + _run_manager.on_text("Full Context:", end="\n", verbose=self.verbose) + _run_manager.on_text(context, color="green", end="\n", verbose=self.verbose) + result = self.qa_chain( + {"question": question, "context": context}, + callbacks=_run_manager.get_child(), + ) + return {self.output_key: result[self.qa_chain.output_key]} diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/cypher.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/cypher.py new file mode 100644 index 0000000000000000000000000000000000000000..925be36d5480dc29afc9774765edbe78a66207d9 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/cypher.py @@ -0,0 +1,421 @@ +"""Question answering over a graph.""" + +from __future__ import annotations + +import re +from typing import Any, Dict, List, Optional, Union + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_core._api.deprecation import deprecated +from langchain_core.callbacks import CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.messages import ( + AIMessage, + BaseMessage, + SystemMessage, + ToolMessage, +) +from langchain_core.output_parsers import StrOutputParser +from langchain_core.prompts import ( + BasePromptTemplate, + ChatPromptTemplate, + HumanMessagePromptTemplate, + MessagesPlaceholder, +) +from langchain_core.runnables import Runnable +from pydantic import Field + +from langchain_community.chains.graph_qa.cypher_utils import ( + CypherQueryCorrector, + Schema, +) +from langchain_community.chains.graph_qa.prompts import ( + CYPHER_GENERATION_PROMPT, + CYPHER_QA_PROMPT, +) +from langchain_community.graphs.graph_store import GraphStore + +INTERMEDIATE_STEPS_KEY = "intermediate_steps" + +FUNCTION_RESPONSE_SYSTEM = """You are an assistant that helps to form nice and human +understandable answers based on the provided information from tools. +Do not add any other information that wasn't present in the tools, and use +very concise style in interpreting results! +""" + + +@deprecated( + since="0.3.8", + removal="1.0", + alternative_import="langchain_neo4j.chains.graph_qa.cypher.extract_cypher", +) +def extract_cypher(text: str) -> str: + """Extract Cypher code from a text. + + Args: + text: Text to extract Cypher code from. + + Returns: + Cypher code extracted from the text. + """ + # The pattern to find Cypher code enclosed in triple backticks + pattern = r"```(.*?)```" + + # Find all matches in the input text + matches = re.findall(pattern, text, re.DOTALL) + + return matches[0] if matches else text + + +@deprecated( + since="0.3.8", + removal="1.0", + alternative_import="langchain_neo4j.chains.graph_qa.cypher.construct_schema", +) +def construct_schema( + structured_schema: Dict[str, Any], + include_types: List[str], + exclude_types: List[str], +) -> str: + """Filter the schema based on included or excluded types""" + + def filter_func(x: str) -> bool: + return x in include_types if include_types else x not in exclude_types + + filtered_schema: Dict[str, Any] = { + "node_props": { + k: v + for k, v in structured_schema.get("node_props", {}).items() + if filter_func(k) + }, + "rel_props": { + k: v + for k, v in structured_schema.get("rel_props", {}).items() + if filter_func(k) + }, + "relationships": [ + r + for r in structured_schema.get("relationships", []) + if all(filter_func(r[t]) for t in ["start", "end", "type"]) + ], + } + + # Format node properties + formatted_node_props = [] + for label, properties in filtered_schema["node_props"].items(): + props_str = ", ".join( + [f"{prop['property']}: {prop['type']}" for prop in properties] + ) + formatted_node_props.append(f"{label} {{{props_str}}}") + + # Format relationship properties + formatted_rel_props = [] + for rel_type, properties in filtered_schema["rel_props"].items(): + props_str = ", ".join( + [f"{prop['property']}: {prop['type']}" for prop in properties] + ) + formatted_rel_props.append(f"{rel_type} {{{props_str}}}") + + # Format relationships + formatted_rels = [ + f"(:{el['start']})-[:{el['type']}]->(:{el['end']})" + for el in filtered_schema["relationships"] + ] + + return "\n".join( + [ + "Node properties are the following:", + ",".join(formatted_node_props), + "Relationship properties are the following:", + ",".join(formatted_rel_props), + "The relationships are the following:", + ",".join(formatted_rels), + ] + ) + + +@deprecated( + since="0.3.8", + removal="1.0", + alternative_import="langchain_neo4j.chains.graph_qa.cypher.get_function_response", +) +def get_function_response( + question: str, context: List[Dict[str, Any]] +) -> List[BaseMessage]: + TOOL_ID = "call_H7fABDuzEau48T10Qn0Lsh0D" + messages = [ + AIMessage( + content="", + additional_kwargs={ + "tool_calls": [ + { + "id": TOOL_ID, + "function": { + "arguments": '{"question":"' + question + '"}', + "name": "GetInformation", + }, + "type": "function", + } + ] + }, + ), + ToolMessage(content=str(context), tool_call_id=TOOL_ID), + ] + return messages + + +@deprecated( + since="0.3.8", + removal="1.0", + alternative_import="langchain_neo4j.GraphCypherQAChain", +) +class GraphCypherQAChain(Chain): + """Chain for question-answering against a graph by generating Cypher statements. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + graph: GraphStore = Field(exclude=True) + cypher_generation_chain: LLMChain + qa_chain: Union[LLMChain, Runnable] + graph_schema: str + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + top_k: int = 10 + """Number of results to return from the query""" + return_intermediate_steps: bool = False + """Whether or not to return the intermediate steps along with the final answer.""" + return_direct: bool = False + """Whether or not to return the result of querying the graph directly.""" + cypher_query_corrector: Optional[CypherQueryCorrector] = None + """Optional cypher validation tool""" + use_function_response: bool = False + """Whether to wrap the database context as tool/function response""" + allow_dangerous_requests: bool = False + """Forced user opt-in to acknowledge that the chain can make dangerous requests. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize the chain.""" + super().__init__(**kwargs) + if self.allow_dangerous_requests is not True: + raise ValueError( + "In order to use this chain, you must acknowledge that it can make " + "dangerous requests by setting `allow_dangerous_requests` to `True`." + "You must narrowly scope the permissions of the database connection " + "to only include necessary permissions. Failure to do so may result " + "in data corruption or loss or reading sensitive data if such data is " + "present in the database." + "Only use this chain if you understand the risks and have taken the " + "necessary precautions. " + "See https://python.langchain.com/docs/security for more information." + ) + + @property + def input_keys(self) -> List[str]: + """Return the input keys. + + :meta private: + """ + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + """Return the output keys. + + :meta private: + """ + _output_keys = [self.output_key] + return _output_keys + + @property + def _chain_type(self) -> str: + return "graph_cypher_chain" + + @classmethod + def from_llm( + cls, + llm: Optional[BaseLanguageModel] = None, + *, + qa_prompt: Optional[BasePromptTemplate] = None, + cypher_prompt: Optional[BasePromptTemplate] = None, + cypher_llm: Optional[BaseLanguageModel] = None, + qa_llm: Optional[Union[BaseLanguageModel, Any]] = None, + exclude_types: List[str] = [], + include_types: List[str] = [], + validate_cypher: bool = False, + qa_llm_kwargs: Optional[Dict[str, Any]] = None, + cypher_llm_kwargs: Optional[Dict[str, Any]] = None, + use_function_response: bool = False, + function_response_system: str = FUNCTION_RESPONSE_SYSTEM, + **kwargs: Any, + ) -> GraphCypherQAChain: + """Initialize from LLM.""" + + if not cypher_llm and not llm: + raise ValueError("Either `llm` or `cypher_llm` parameters must be provided") + if not qa_llm and not llm: + raise ValueError("Either `llm` or `qa_llm` parameters must be provided") + if cypher_llm and qa_llm and llm: + raise ValueError( + "You can specify up to two of 'cypher_llm', 'qa_llm'" + ", and 'llm', but not all three simultaneously." + ) + if cypher_prompt and cypher_llm_kwargs: + raise ValueError( + "Specifying cypher_prompt and cypher_llm_kwargs together is" + " not allowed. Please pass prompt via cypher_llm_kwargs." + ) + if qa_prompt and qa_llm_kwargs: + raise ValueError( + "Specifying qa_prompt and qa_llm_kwargs together is" + " not allowed. Please pass prompt via qa_llm_kwargs." + ) + use_qa_llm_kwargs = qa_llm_kwargs if qa_llm_kwargs is not None else {} + use_cypher_llm_kwargs = ( + cypher_llm_kwargs if cypher_llm_kwargs is not None else {} + ) + if "prompt" not in use_qa_llm_kwargs: + use_qa_llm_kwargs["prompt"] = ( + qa_prompt if qa_prompt is not None else CYPHER_QA_PROMPT + ) + if "prompt" not in use_cypher_llm_kwargs: + use_cypher_llm_kwargs["prompt"] = ( + cypher_prompt if cypher_prompt is not None else CYPHER_GENERATION_PROMPT + ) + + qa_llm = qa_llm or llm + if use_function_response: + try: + qa_llm.bind_tools({}) # type: ignore[union-attr] + response_prompt = ChatPromptTemplate.from_messages( + [ + SystemMessage(content=function_response_system), + HumanMessagePromptTemplate.from_template("{question}"), + MessagesPlaceholder(variable_name="function_response"), + ] + ) + qa_chain = response_prompt | qa_llm | StrOutputParser() # type: ignore[operator] + except (NotImplementedError, AttributeError): + raise ValueError("Provided LLM does not support native tools/functions") + else: + qa_chain = LLMChain(llm=qa_llm, **use_qa_llm_kwargs) # type: ignore[arg-type] + + cypher_generation_chain = LLMChain( + llm=cypher_llm or llm, # type: ignore[arg-type] + **use_cypher_llm_kwargs, + ) + + if exclude_types and include_types: + raise ValueError( + "Either `exclude_types` or `include_types` " + "can be provided, but not both" + ) + graph_schema = construct_schema( + kwargs["graph"].get_structured_schema, include_types, exclude_types + ) + + cypher_query_corrector = None + if validate_cypher: + corrector_schema = [ + Schema(el["start"], el["type"], el["end"]) + for el in kwargs["graph"].structured_schema.get("relationships") + ] + cypher_query_corrector = CypherQueryCorrector(corrector_schema) + + return cls( + graph_schema=graph_schema, + qa_chain=qa_chain, + cypher_generation_chain=cypher_generation_chain, + cypher_query_corrector=cypher_query_corrector, + use_function_response=use_function_response, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, Any]: + """Generate Cypher statement, use it to look up in db and answer question.""" + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + callbacks = _run_manager.get_child() + question = inputs[self.input_key] + args = { + "question": question, + "schema": self.graph_schema, + } + args.update(inputs) + + intermediate_steps: List = [] + + generated_cypher = self.cypher_generation_chain.run(args, callbacks=callbacks) + + # Extract Cypher code if it is wrapped in backticks + generated_cypher = extract_cypher(generated_cypher) + + # Correct Cypher query if enabled + if self.cypher_query_corrector: + generated_cypher = self.cypher_query_corrector(generated_cypher) + + _run_manager.on_text("Generated Cypher:", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_cypher, color="green", end="\n", verbose=self.verbose + ) + + intermediate_steps.append({"query": generated_cypher}) + + # Retrieve and limit the number of results + # Generated Cypher be null if query corrector identifies invalid schema + if generated_cypher: + context = self.graph.query(generated_cypher)[: self.top_k] + else: + context = [] + + if self.return_direct: + final_result = context + else: + _run_manager.on_text("Full Context:", end="\n", verbose=self.verbose) + _run_manager.on_text( + str(context), color="green", end="\n", verbose=self.verbose + ) + + intermediate_steps.append({"context": context}) + if self.use_function_response: + function_response = get_function_response(question, context) + final_result = self.qa_chain.invoke( # type: ignore[assignment] + {"question": question, "function_response": function_response}, + ) + else: + result = self.qa_chain.invoke( + {"question": question, "context": context}, + callbacks=callbacks, + ) + final_result = result[self.qa_chain.output_key] # type: ignore[union-attr] + + chain_result: Dict[str, Any] = {self.output_key: final_result} + if self.return_intermediate_steps: + chain_result[INTERMEDIATE_STEPS_KEY] = intermediate_steps + + return chain_result diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/cypher_utils.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/cypher_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..4d8c7c45572fb7a0645cf613fd3c58d5bed809a4 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/cypher_utils.py @@ -0,0 +1,267 @@ +import re +from collections import namedtuple +from typing import Any, Dict, List, Optional, Tuple + +from langchain_core._api.deprecation import deprecated + +Schema = namedtuple("Schema", ["left_node", "relation", "right_node"]) + + +@deprecated( + since="0.3.8", + removal="1.0", + alternative_import="langchain_neo4j.chains.graph_qa.cypher_utils.CypherQueryCorrector", +) +class CypherQueryCorrector: + """ + Used to correct relationship direction in generated Cypher statements. + This code is copied from the winner's submission to the Cypher competition: + https://github.com/sakusaku-rich/cypher-direction-competition + """ + + property_pattern = re.compile(r"\{.+?\}") + node_pattern = re.compile(r"\(.+?\)") + path_pattern = re.compile( + r"(\([^\,\(\)]*?(\{.+\})?[^\,\(\)]*?\))(?)(\([^\,\(\)]*?(\{.+\})?[^\,\(\)]*?\))" + ) + node_relation_node_pattern = re.compile( + r"(\()+(?P[^()]*?)\)(?P.*?)\((?P[^()]*?)(\))+" + ) + relation_type_pattern = re.compile(r":(?P.+?)?(\{.+\})?]") + + def __init__(self, schemas: List[Schema]): + """ + Args: + schemas: list of schemas + """ + self.schemas = schemas + + def clean_node(self, node: str) -> str: + """ + Args: + node: node in string format + + """ + node = re.sub(self.property_pattern, "", node) + node = node.replace("(", "") + node = node.replace(")", "") + node = node.strip() + return node + + def detect_node_variables(self, query: str) -> Dict[str, List[str]]: + """ + Args: + query: cypher query + """ + nodes = re.findall(self.node_pattern, query) + nodes = [self.clean_node(node) for node in nodes] + res: Dict[str, Any] = {} + for node in nodes: + parts = node.split(":") + if parts == "": + continue + variable = parts[0] + if variable not in res: + res[variable] = [] + res[variable] += parts[1:] + return res + + def extract_paths(self, query: str) -> "List[str]": + """ + Args: + query: cypher query + """ + paths = [] + idx = 0 + while matched := self.path_pattern.findall(query[idx:]): + matched = matched[0] + matched = [ + m for i, m in enumerate(matched) if i not in [1, len(matched) - 1] + ] + path = "".join(matched) + idx = query.find(path) + len(path) - len(matched[-1]) + paths.append(path) + return paths + + def judge_direction(self, relation: str) -> str: + """ + Args: + relation: relation in string format + """ + direction = "BIDIRECTIONAL" + if relation[0] == "<": + direction = "INCOMING" + if relation[-1] == ">": + direction = "OUTGOING" + return direction + + def extract_node_variable(self, part: str) -> Optional[str]: + """ + Args: + part: node in string format + """ + part = part.lstrip("(").rstrip(")") + idx = part.find(":") + if idx != -1: + part = part[:idx] + return None if part == "" else part + + def detect_labels( + self, str_node: str, node_variable_dict: Dict[str, Any] + ) -> List[str]: + """ + Args: + str_node: node in string format + node_variable_dict: dictionary of node variables + """ + splitted_node = str_node.split(":") + variable = splitted_node[0] + labels = [] + if variable in node_variable_dict: + labels = node_variable_dict[variable] + elif variable == "" and len(splitted_node) > 1: + labels = splitted_node[1:] + return labels + + def verify_schema( + self, + from_node_labels: List[str], + relation_types: List[str], + to_node_labels: List[str], + ) -> bool: + """ + Args: + from_node_labels: labels of the from node + relation_type: type of the relation + to_node_labels: labels of the to node + """ + valid_schemas = self.schemas + if from_node_labels != []: + from_node_labels = [label.strip("`") for label in from_node_labels] + valid_schemas = [ + schema for schema in valid_schemas if schema[0] in from_node_labels + ] + if to_node_labels != []: + to_node_labels = [label.strip("`") for label in to_node_labels] + valid_schemas = [ + schema for schema in valid_schemas if schema[2] in to_node_labels + ] + if relation_types != []: + relation_types = [type.strip("`") for type in relation_types] + valid_schemas = [ + schema for schema in valid_schemas if schema[1] in relation_types + ] + return valid_schemas != [] + + def detect_relation_types(self, str_relation: str) -> Tuple[str, List[str]]: + """ + Args: + str_relation: relation in string format + """ + relation_direction = self.judge_direction(str_relation) + relation_type = self.relation_type_pattern.search(str_relation) + if relation_type is None or relation_type.group("relation_type") is None: + return relation_direction, [] + relation_types = [ + t.strip().strip("!") + for t in relation_type.group("relation_type").split("|") + ] + return relation_direction, relation_types + + def correct_query(self, query: str) -> str: + """ + Args: + query: cypher query + """ + node_variable_dict = self.detect_node_variables(query) + paths = self.extract_paths(query) + for path in paths: + original_path = path + start_idx = 0 + while start_idx < len(path): + match_res = re.match(self.node_relation_node_pattern, path[start_idx:]) + if match_res is None: + break + start_idx += match_res.start() + match_dict = match_res.groupdict() + left_node_labels = self.detect_labels( + match_dict["left_node"], node_variable_dict + ) + right_node_labels = self.detect_labels( + match_dict["right_node"], node_variable_dict + ) + end_idx = ( + start_idx + + 4 + + len(match_dict["left_node"]) + + len(match_dict["relation"]) + + len(match_dict["right_node"]) + ) + original_partial_path = original_path[start_idx : end_idx + 1] + relation_direction, relation_types = self.detect_relation_types( + match_dict["relation"] + ) + + if relation_types != [] and "".join(relation_types).find("*") != -1: + start_idx += ( + len(match_dict["left_node"]) + len(match_dict["relation"]) + 2 + ) + continue + + if relation_direction == "OUTGOING": + is_legal = self.verify_schema( + left_node_labels, relation_types, right_node_labels + ) + if not is_legal: + is_legal = self.verify_schema( + right_node_labels, relation_types, left_node_labels + ) + if is_legal: + corrected_relation = "<" + match_dict["relation"][:-1] + corrected_partial_path = original_partial_path.replace( + match_dict["relation"], corrected_relation + ) + query = query.replace( + original_partial_path, corrected_partial_path + ) + else: + return "" + elif relation_direction == "INCOMING": + is_legal = self.verify_schema( + right_node_labels, relation_types, left_node_labels + ) + if not is_legal: + is_legal = self.verify_schema( + left_node_labels, relation_types, right_node_labels + ) + if is_legal: + corrected_relation = match_dict["relation"][1:] + ">" + corrected_partial_path = original_partial_path.replace( + match_dict["relation"], corrected_relation + ) + query = query.replace( + original_partial_path, corrected_partial_path + ) + else: + return "" + else: + is_legal = self.verify_schema( + left_node_labels, relation_types, right_node_labels + ) + is_legal |= self.verify_schema( + right_node_labels, relation_types, left_node_labels + ) + if not is_legal: + return "" + + start_idx += ( + len(match_dict["left_node"]) + len(match_dict["relation"]) + 2 + ) + return query + + def __call__(self, query: str) -> str: + """Correct the query to make it valid. If + Args: + query: cypher query + """ + return self.correct_query(query) diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/falkordb.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/falkordb.py new file mode 100644 index 0000000000000000000000000000000000000000..1f47fb561665576751bfc83feb1a34d96aafcb0a --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/falkordb.py @@ -0,0 +1,189 @@ +"""Question answering over a graph.""" + +from __future__ import annotations + +import re +from typing import Any, Dict, List, Optional + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_core.callbacks import CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.prompts import BasePromptTemplate +from pydantic import Field + +from langchain_community.chains.graph_qa.prompts import ( + CYPHER_GENERATION_PROMPT, + CYPHER_QA_PROMPT, +) +from langchain_community.graphs import FalkorDBGraph + +INTERMEDIATE_STEPS_KEY = "intermediate_steps" + + +def extract_cypher(text: str) -> str: + """ + Extract Cypher code from a text. + Args: + text: Text to extract Cypher code from. + + Returns: + Cypher code extracted from the text. + """ + # The pattern to find Cypher code enclosed in triple backticks + pattern = r"```(.*?)```" + + # Find all matches in the input text + matches = re.findall(pattern, text, re.DOTALL) + + return matches[0] if matches else text + + +class FalkorDBQAChain(Chain): + """Chain for question-answering against a graph by generating Cypher statements. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + graph: FalkorDBGraph = Field(exclude=True) + cypher_generation_chain: LLMChain + qa_chain: LLMChain + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + top_k: int = 10 + """Number of results to return from the query""" + return_intermediate_steps: bool = False + """Whether or not to return the intermediate steps along with the final answer.""" + return_direct: bool = False + """Whether or not to return the result of querying the graph directly.""" + + allow_dangerous_requests: bool = False + """Forced user opt-in to acknowledge that the chain can make dangerous requests. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize the chain.""" + super().__init__(**kwargs) + if self.allow_dangerous_requests is not True: + raise ValueError( + "In order to use this chain, you must acknowledge that it can make " + "dangerous requests by setting `allow_dangerous_requests` to `True`." + "You must narrowly scope the permissions of the database connection " + "to only include necessary permissions. Failure to do so may result " + "in data corruption or loss or reading sensitive data if such data is " + "present in the database." + "Only use this chain if you understand the risks and have taken the " + "necessary precautions. " + "See https://python.langchain.com/docs/security for more information." + ) + + @property + def input_keys(self) -> List[str]: + """Return the input keys. + + :meta private: + """ + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + """Return the output keys. + + :meta private: + """ + _output_keys = [self.output_key] + return _output_keys + + @property + def _chain_type(self) -> str: + return "graph_cypher_chain" + + @classmethod + def from_llm( + cls, + llm: BaseLanguageModel, + *, + qa_prompt: BasePromptTemplate = CYPHER_QA_PROMPT, + cypher_prompt: BasePromptTemplate = CYPHER_GENERATION_PROMPT, + **kwargs: Any, + ) -> FalkorDBQAChain: + """Initialize from LLM.""" + qa_chain = LLMChain(llm=llm, prompt=qa_prompt) + cypher_generation_chain = LLMChain(llm=llm, prompt=cypher_prompt) + + return cls( + qa_chain=qa_chain, + cypher_generation_chain=cypher_generation_chain, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, Any]: + """Generate Cypher statement, use it to look up in db and answer question.""" + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + callbacks = _run_manager.get_child() + question = inputs[self.input_key] + + intermediate_steps: List = [] + + generated_cypher = self.cypher_generation_chain.run( + {"question": question, "schema": self.graph.schema}, callbacks=callbacks + ) + + # Extract Cypher code if it is wrapped in backticks + generated_cypher = extract_cypher(generated_cypher) + + _run_manager.on_text("Generated Cypher:", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_cypher, color="green", end="\n", verbose=self.verbose + ) + + intermediate_steps.append({"query": generated_cypher}) + + # Retrieve and limit the number of results + context = self.graph.query(generated_cypher)[: self.top_k] + + if self.return_direct: + final_result = context + else: + _run_manager.on_text("Full Context:", end="\n", verbose=self.verbose) + _run_manager.on_text( + str(context), color="green", end="\n", verbose=self.verbose + ) + + intermediate_steps.append({"context": context}) + + result = self.qa_chain( + {"question": question, "context": context}, + callbacks=callbacks, + ) + final_result = result[self.qa_chain.output_key] + + chain_result: Dict[str, Any] = {self.output_key: final_result} + if self.return_intermediate_steps: + chain_result[INTERMEDIATE_STEPS_KEY] = intermediate_steps + + return chain_result diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/gremlin.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/gremlin.py new file mode 100644 index 0000000000000000000000000000000000000000..1680bd8f4c16f3e2984544f692d0df9bb6cfc7e1 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/gremlin.py @@ -0,0 +1,253 @@ +"""Question answering over a graph.""" + +from __future__ import annotations + +from typing import Any, Dict, List, Optional + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_core.callbacks.manager import CallbackManager, CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.prompts import BasePromptTemplate +from langchain_core.prompts.prompt import PromptTemplate +from pydantic import Field + +from langchain_community.chains.graph_qa.prompts import ( + CYPHER_QA_PROMPT, + GRAPHDB_SPARQL_FIX_TEMPLATE, + GREMLIN_GENERATION_PROMPT, +) +from langchain_community.graphs import GremlinGraph + +INTERMEDIATE_STEPS_KEY = "intermediate_steps" + + +def extract_gremlin(text: str) -> str: + """Extract Gremlin code from a text. + + Args: + text: Text to extract Gremlin code from. + + Returns: + Gremlin code extracted from the text. + """ + text = text.replace("`", "") + if text.startswith("gremlin"): + text = text[len("gremlin") :] + return text.replace("\n", "") + + +class GremlinQAChain(Chain): + """Chain for question-answering against a graph by generating gremlin statements. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + graph: GremlinGraph = Field(exclude=True) + gremlin_generation_chain: LLMChain + qa_chain: LLMChain + gremlin_fix_chain: LLMChain + max_fix_retries: int = 3 + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + top_k: int = 100 + return_direct: bool = False + return_intermediate_steps: bool = False + + allow_dangerous_requests: bool = False + """Forced user opt-in to acknowledge that the chain can make dangerous requests. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize the chain.""" + super().__init__(**kwargs) + if self.allow_dangerous_requests is not True: + raise ValueError( + "In order to use this chain, you must acknowledge that it can make " + "dangerous requests by setting `allow_dangerous_requests` to `True`." + "You must narrowly scope the permissions of the database connection " + "to only include necessary permissions. Failure to do so may result " + "in data corruption or loss or reading sensitive data if such data is " + "present in the database." + "Only use this chain if you understand the risks and have taken the " + "necessary precautions. " + "See https://python.langchain.com/docs/security for more information." + ) + + @property + def input_keys(self) -> List[str]: + """Input keys. + + :meta private: + """ + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + """Output keys. + + :meta private: + """ + _output_keys = [self.output_key] + return _output_keys + + @classmethod + def from_llm( + cls, + llm: BaseLanguageModel, + *, + gremlin_fix_prompt: BasePromptTemplate = PromptTemplate( + input_variables=["error_message", "generated_sparql", "schema"], + template=GRAPHDB_SPARQL_FIX_TEMPLATE.replace("SPARQL", "Gremlin").replace( + "in Turtle format", "" + ), + ), + qa_prompt: BasePromptTemplate = CYPHER_QA_PROMPT, + gremlin_prompt: BasePromptTemplate = GREMLIN_GENERATION_PROMPT, + **kwargs: Any, + ) -> GremlinQAChain: + """Initialize from LLM.""" + qa_chain = LLMChain(llm=llm, prompt=qa_prompt) + gremlin_generation_chain = LLMChain(llm=llm, prompt=gremlin_prompt) + gremlinl_fix_chain = LLMChain(llm=llm, prompt=gremlin_fix_prompt) + return cls( + qa_chain=qa_chain, + gremlin_generation_chain=gremlin_generation_chain, + gremlin_fix_chain=gremlinl_fix_chain, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, str]: + """Generate gremlin statement, use it to look up in db and answer question.""" + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + callbacks = _run_manager.get_child() + question = inputs[self.input_key] + + intermediate_steps: List = [] + + chain_response = self.gremlin_generation_chain.invoke( + {"question": question, "schema": self.graph.get_schema}, callbacks=callbacks + ) + + generated_gremlin = extract_gremlin( + chain_response[self.gremlin_generation_chain.output_key] + ) + + _run_manager.on_text("Generated gremlin:", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_gremlin, color="green", end="\n", verbose=self.verbose + ) + + intermediate_steps.append({"query": generated_gremlin}) + + if generated_gremlin: + context = self.execute_with_retry( + _run_manager, callbacks, generated_gremlin + )[: self.top_k] + else: + context = [] + + if self.return_direct: + final_result = context + else: + _run_manager.on_text("Full Context:", end="\n", verbose=self.verbose) + _run_manager.on_text( + str(context), color="green", end="\n", verbose=self.verbose + ) + + intermediate_steps.append({"context": context}) + + result = self.qa_chain.invoke( + {"question": question, "context": context}, + callbacks=callbacks, + ) + final_result = result[self.qa_chain.output_key] + + chain_result: Dict[str, Any] = {self.output_key: final_result} + if self.return_intermediate_steps: + chain_result[INTERMEDIATE_STEPS_KEY] = intermediate_steps + + return chain_result + + def execute_query(self, query: str) -> List[Any]: + try: + return self.graph.query(query) + except Exception as e: + if hasattr(e, "status_message"): + raise ValueError(e.status_message) + else: + raise ValueError(str(e)) + + def execute_with_retry( + self, + _run_manager: CallbackManagerForChainRun, + callbacks: CallbackManager, + generated_gremlin: str, + ) -> List[Any]: + try: + return self.execute_query(generated_gremlin) + except Exception as e: + retries = 0 + error_message = str(e) + self.log_invalid_query(_run_manager, generated_gremlin, error_message) + + while retries < self.max_fix_retries: + try: + fix_chain_result = self.gremlin_fix_chain.invoke( + { + "error_message": error_message, + # we are borrowing template from sparql + "generated_sparql": generated_gremlin, + "schema": self.schema, + }, + callbacks=callbacks, + ) + fixed_gremlin = fix_chain_result[self.gremlin_fix_chain.output_key] + return self.execute_query(fixed_gremlin) + except Exception as e: + retries += 1 + parse_exception = str(e) + self.log_invalid_query(_run_manager, fixed_gremlin, parse_exception) + + raise ValueError("The generated Gremlin query is invalid.") + + def log_invalid_query( + self, + _run_manager: CallbackManagerForChainRun, + generated_query: str, + error_message: str, + ) -> None: + _run_manager.on_text("Invalid Gremlin query: ", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_query, color="red", end="\n", verbose=self.verbose + ) + _run_manager.on_text( + "Gremlin Query Parse Error: ", end="\n", verbose=self.verbose + ) + _run_manager.on_text( + error_message, color="red", end="\n\n", verbose=self.verbose + ) diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/hugegraph.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/hugegraph.py new file mode 100644 index 0000000000000000000000000000000000000000..206e26df3836f3254239996f5b66ce08a57ce000 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/hugegraph.py @@ -0,0 +1,138 @@ +"""Question answering over a graph.""" + +from __future__ import annotations + +from typing import Any, Dict, List, Optional + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_core.callbacks import CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.prompts import BasePromptTemplate +from pydantic import Field + +from langchain_community.chains.graph_qa.prompts import ( + CYPHER_QA_PROMPT, + GREMLIN_GENERATION_PROMPT, +) +from langchain_community.graphs.hugegraph import HugeGraph + + +class HugeGraphQAChain(Chain): + """Chain for question-answering against a graph by generating gremlin statements. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + graph: HugeGraph = Field(exclude=True) + gremlin_generation_chain: LLMChain + qa_chain: LLMChain + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + + allow_dangerous_requests: bool = False + """Forced user opt-in to acknowledge that the chain can make dangerous requests. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize the chain.""" + super().__init__(**kwargs) + if self.allow_dangerous_requests is not True: + raise ValueError( + "In order to use this chain, you must acknowledge that it can make " + "dangerous requests by setting `allow_dangerous_requests` to `True`." + "You must narrowly scope the permissions of the database connection " + "to only include necessary permissions. Failure to do so may result " + "in data corruption or loss or reading sensitive data if such data is " + "present in the database." + "Only use this chain if you understand the risks and have taken the " + "necessary precautions. " + "See https://python.langchain.com/docs/security for more information." + ) + + @property + def input_keys(self) -> List[str]: + """Input keys. + + :meta private: + """ + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + """Output keys. + + :meta private: + """ + _output_keys = [self.output_key] + return _output_keys + + @classmethod + def from_llm( + cls, + llm: BaseLanguageModel, + *, + qa_prompt: BasePromptTemplate = CYPHER_QA_PROMPT, + gremlin_prompt: BasePromptTemplate = GREMLIN_GENERATION_PROMPT, + **kwargs: Any, + ) -> HugeGraphQAChain: + """Initialize from LLM.""" + qa_chain = LLMChain(llm=llm, prompt=qa_prompt) + gremlin_generation_chain = LLMChain(llm=llm, prompt=gremlin_prompt) + + return cls( + qa_chain=qa_chain, + gremlin_generation_chain=gremlin_generation_chain, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, str]: + """Generate gremlin statement, use it to look up in db and answer question.""" + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + callbacks = _run_manager.get_child() + question = inputs[self.input_key] + + generated_gremlin = self.gremlin_generation_chain.run( + {"question": question, "schema": self.graph.get_schema}, callbacks=callbacks + ) + + _run_manager.on_text("Generated gremlin:", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_gremlin, color="green", end="\n", verbose=self.verbose + ) + context = self.graph.query(generated_gremlin) + + _run_manager.on_text("Full Context:", end="\n", verbose=self.verbose) + _run_manager.on_text( + str(context), color="green", end="\n", verbose=self.verbose + ) + + result = self.qa_chain( + {"question": question, "context": context}, + callbacks=callbacks, + ) + return {self.output_key: result[self.qa_chain.output_key]} diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/kuzu.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/kuzu.py new file mode 100644 index 0000000000000000000000000000000000000000..c4da7b5dcdd29f9104b030ebb203f264b27ed7f5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/kuzu.py @@ -0,0 +1,196 @@ +"""Question answering over a graph.""" + +from __future__ import annotations + +import re +from typing import Any, Dict, List, Optional + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_core.callbacks import CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.prompts import BasePromptTemplate +from pydantic import Field + +from langchain_community.chains.graph_qa.prompts import ( + CYPHER_QA_PROMPT, + KUZU_GENERATION_PROMPT, +) +from langchain_community.graphs.kuzu_graph import KuzuGraph + + +def remove_prefix(text: str, prefix: str) -> str: + """Remove a prefix from a text. + + Args: + text: Text to remove the prefix from. + prefix: Prefix to remove from the text. + + Returns: + Text with the prefix removed. + """ + if text.startswith(prefix): + return text[len(prefix) :] + return text + + +def extract_cypher(text: str) -> str: + """Extract Cypher code from a text. + + Args: + text: Text to extract Cypher code from. + + Returns: + Cypher code extracted from the text. + """ + # The pattern to find Cypher code enclosed in triple backticks + pattern = r"```(.*?)```" + + # Find all matches in the input text + matches = re.findall(pattern, text, re.DOTALL) + + return matches[0] if matches else text + + +class KuzuQAChain(Chain): + """Question-answering against a graph by generating Cypher statements for Kùzu. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + graph: KuzuGraph = Field(exclude=True) + cypher_generation_chain: LLMChain + qa_chain: LLMChain + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + + allow_dangerous_requests: bool = False + """Forced user opt-in to acknowledge that the chain can make dangerous requests. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize the chain.""" + super().__init__(**kwargs) + if self.allow_dangerous_requests is not True: + raise ValueError( + "In order to use this chain, you must acknowledge that it can make " + "dangerous requests by setting `allow_dangerous_requests` to `True`." + "You must narrowly scope the permissions of the database connection " + "to only include necessary permissions. Failure to do so may result " + "in data corruption or loss or reading sensitive data if such data is " + "present in the database." + "Only use this chain if you understand the risks and have taken the " + "necessary precautions. " + "See https://python.langchain.com/docs/security for more information." + ) + + @property + def input_keys(self) -> List[str]: + """Return the input keys. + + :meta private: + """ + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + """Return the output keys. + + :meta private: + """ + _output_keys = [self.output_key] + return _output_keys + + @classmethod + def from_llm( + cls, + llm: Optional[BaseLanguageModel] = None, + *, + qa_prompt: BasePromptTemplate = CYPHER_QA_PROMPT, + cypher_prompt: BasePromptTemplate = KUZU_GENERATION_PROMPT, + cypher_llm: Optional[BaseLanguageModel] = None, + qa_llm: Optional[BaseLanguageModel] = None, + **kwargs: Any, + ) -> KuzuQAChain: + """Initialize from LLM.""" + if not cypher_llm and not llm: + raise ValueError("Either `llm` or `cypher_llm` parameters must be provided") + if not qa_llm and not llm: + raise ValueError( + "Either `llm` or `qa_llm` parameters must be provided along with" + " `cypher_llm`" + ) + if cypher_llm and qa_llm and llm: + raise ValueError( + "You can specify up to two of 'cypher_llm', 'qa_llm'" + ", and 'llm', but not all three simultaneously." + ) + + qa_chain = LLMChain( + llm=qa_llm or llm, # type: ignore[arg-type] + prompt=qa_prompt, + ) + cypher_generation_chain = LLMChain( + llm=cypher_llm or llm, # type: ignore[arg-type] + prompt=cypher_prompt, + ) + + return cls( + qa_chain=qa_chain, + cypher_generation_chain=cypher_generation_chain, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, str]: + """Generate Cypher statement, use it to look up in db and answer question.""" + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + callbacks = _run_manager.get_child() + question = inputs[self.input_key] + + generated_cypher = self.cypher_generation_chain.run( + {"question": question, "schema": self.graph.get_schema}, callbacks=callbacks + ) + # Extract Cypher code if it is wrapped in triple backticks + # with the language marker "cypher" + generated_cypher = remove_prefix(extract_cypher(generated_cypher), "cypher") + + _run_manager.on_text("Generated Cypher:", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_cypher, color="green", end="\n", verbose=self.verbose + ) + context = self.graph.query(generated_cypher) + + _run_manager.on_text("Full Context:", end="\n", verbose=self.verbose) + _run_manager.on_text( + str(context), color="green", end="\n", verbose=self.verbose + ) + + result = self.qa_chain( + {"question": question, "context": context}, + callbacks=callbacks, + ) + return {self.output_key: result[self.qa_chain.output_key]} diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/memgraph.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/memgraph.py new file mode 100644 index 0000000000000000000000000000000000000000..349bdf67d2c45a208268918df03e3be0fedeb279 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/memgraph.py @@ -0,0 +1,316 @@ +"""Question answering over a graph.""" + +from __future__ import annotations + +import re +from typing import Any, Dict, List, Optional, Union + +from langchain_classic.chains.base import Chain +from langchain_core.callbacks import CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.messages import ( + AIMessage, + BaseMessage, + SystemMessage, + ToolMessage, +) +from langchain_core.output_parsers import StrOutputParser +from langchain_core.prompts import ( + BasePromptTemplate, + ChatPromptTemplate, + HumanMessagePromptTemplate, + MessagesPlaceholder, +) +from langchain_core.runnables import Runnable +from pydantic import Field + +from langchain_community.chains.graph_qa.prompts import ( + MEMGRAPH_GENERATION_PROMPT, + MEMGRAPH_QA_PROMPT, +) +from langchain_community.graphs.memgraph_graph import MemgraphGraph + +INTERMEDIATE_STEPS_KEY = "intermediate_steps" + +FUNCTION_RESPONSE_SYSTEM = """You are an assistant that helps to form nice and human +understandable answers based on the provided information from tools. +Do not add any other information that wasn't present in the tools, and use +very concise style in interpreting results! +""" + + +def extract_cypher(text: str) -> str: + """Extract Cypher code from a text. + + Args: + text: Text to extract Cypher code from. + + Returns: + Cypher code extracted from the text. + """ + # The pattern to find Cypher code enclosed in triple backticks + pattern = r"```(.*?)```" + + # Find all matches in the input text + matches = re.findall(pattern, text, re.DOTALL) + + return matches[0] if matches else text + + +def get_function_response( + question: str, context: List[Dict[str, Any]] +) -> List[BaseMessage]: + TOOL_ID = "call_H7fABDuzEau48T10Qn0Lsh0D" + messages = [ + AIMessage( + content="", + additional_kwargs={ + "tool_calls": [ + { + "id": TOOL_ID, + "function": { + "arguments": '{"question":"' + question + '"}', + "name": "GetInformation", + }, + "type": "function", + } + ] + }, + ), + ToolMessage(content=str(context), tool_call_id=TOOL_ID), + ] + return messages + + +class MemgraphQAChain(Chain): + """Chain for question-answering against a graph by generating Cypher statements. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + graph: MemgraphGraph = Field(exclude=True) + cypher_generation_chain: Runnable + qa_chain: Runnable + graph_schema: str + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + top_k: int = 10 + """Number of results to return from the query""" + return_intermediate_steps: bool = False + """Whether or not to return the intermediate steps along with the final answer.""" + return_direct: bool = False + """Optional cypher validation tool""" + use_function_response: bool = False + """Whether to wrap the database context as tool/function response""" + allow_dangerous_requests: bool = False + """Forced user opt-in to acknowledge that the chain can make dangerous requests. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize the chain.""" + super().__init__(**kwargs) + if self.allow_dangerous_requests is not True: + raise ValueError( + "In order to use this chain, you must acknowledge that it can make " + "dangerous requests by setting `allow_dangerous_requests` to `True`." + "You must narrowly scope the permissions of the database connection " + "to only include necessary permissions. Failure to do so may result " + "in data corruption or loss or reading sensitive data if such data is " + "present in the database." + "Only use this chain if you understand the risks and have taken the " + "necessary precautions. " + "See https://python.langchain.com/docs/security for more information." + ) + + @property + def input_keys(self) -> List[str]: + """Return the input keys. + + :meta private: + """ + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + """Return the output keys. + + :meta private: + """ + _output_keys = [self.output_key] + return _output_keys + + @property + def _chain_type(self) -> str: + return "graph_cypher_chain" + + @classmethod + def from_llm( + cls, + llm: Optional[BaseLanguageModel] = None, + *, + qa_prompt: Optional[BasePromptTemplate] = None, + cypher_prompt: Optional[BasePromptTemplate] = None, + cypher_llm: Optional[BaseLanguageModel] = None, + qa_llm: Optional[Union[BaseLanguageModel, Any]] = None, + qa_llm_kwargs: Optional[Dict[str, Any]] = None, + cypher_llm_kwargs: Optional[Dict[str, Any]] = None, + use_function_response: bool = False, + function_response_system: str = FUNCTION_RESPONSE_SYSTEM, + **kwargs: Any, + ) -> MemgraphQAChain: + """Initialize from LLM.""" + + if not cypher_llm and not llm: + raise ValueError("Either `llm` or `cypher_llm` parameters must be provided") + if not qa_llm and not llm: + raise ValueError("Either `llm` or `qa_llm` parameters must be provided") + if cypher_llm and qa_llm and llm: + raise ValueError( + "You can specify up to two of 'cypher_llm', 'qa_llm'" + ", and 'llm', but not all three simultaneously." + ) + if cypher_prompt and cypher_llm_kwargs: + raise ValueError( + "Specifying cypher_prompt and cypher_llm_kwargs together is" + " not allowed. Please pass prompt via cypher_llm_kwargs." + ) + if qa_prompt and qa_llm_kwargs: + raise ValueError( + "Specifying qa_prompt and qa_llm_kwargs together is" + " not allowed. Please pass prompt via qa_llm_kwargs." + ) + use_qa_llm_kwargs = qa_llm_kwargs if qa_llm_kwargs is not None else {} + use_cypher_llm_kwargs = ( + cypher_llm_kwargs if cypher_llm_kwargs is not None else {} + ) + if "prompt" not in use_qa_llm_kwargs: + use_qa_llm_kwargs["prompt"] = ( + qa_prompt if qa_prompt is not None else MEMGRAPH_QA_PROMPT + ) + if "prompt" not in use_cypher_llm_kwargs: + use_cypher_llm_kwargs["prompt"] = ( + cypher_prompt + if cypher_prompt is not None + else MEMGRAPH_GENERATION_PROMPT + ) + + qa_llm = qa_llm or llm + if use_function_response: + try: + qa_llm.bind_tools({}) # type: ignore[union-attr] + response_prompt = ChatPromptTemplate.from_messages( + [ + SystemMessage(content=function_response_system), + HumanMessagePromptTemplate.from_template("{question}"), + MessagesPlaceholder(variable_name="function_response"), + ] + ) + qa_chain = response_prompt | qa_llm | StrOutputParser() # type: ignore[operator] + except (NotImplementedError, AttributeError): + raise ValueError("Provided LLM does not support native tools/functions") + else: + qa_chain = use_qa_llm_kwargs["prompt"] | qa_llm | StrOutputParser() + + prompt = use_cypher_llm_kwargs["prompt"] + llm_to_use = cypher_llm if cypher_llm is not None else llm + + if prompt is not None and llm_to_use is not None: + cypher_generation_chain = prompt | llm_to_use | StrOutputParser() + else: + raise ValueError( + "Missing required components for the cypher generation chain: " + "'prompt' or 'llm'" + ) + + graph_schema = kwargs["graph"].get_schema + + return cls( + graph_schema=graph_schema, + qa_chain=qa_chain, + cypher_generation_chain=cypher_generation_chain, + use_function_response=use_function_response, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, Any]: + """Generate Cypher statement, use it to look up in db and answer question.""" + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + callbacks = _run_manager.get_child() + question = inputs[self.input_key] + args = { + "question": question, + "schema": self.graph_schema, + } + args.update(inputs) + + intermediate_steps: List = [] + + generated_cypher = self.cypher_generation_chain.invoke( + args, callbacks=callbacks + ) + # Extract Cypher code if it is wrapped in backticks + generated_cypher = extract_cypher(generated_cypher) + + _run_manager.on_text("Generated Cypher:", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_cypher, color="green", end="\n", verbose=self.verbose + ) + + intermediate_steps.append({"query": generated_cypher}) + + # Retrieve and limit the number of results + # Generated Cypher be null if query corrector identifies invalid schema + if generated_cypher: + context = self.graph.query(generated_cypher)[: self.top_k] + else: + context = [] + + if self.return_direct: + result = context + else: + _run_manager.on_text("Full Context:", end="\n", verbose=self.verbose) + _run_manager.on_text( + str(context), color="green", end="\n", verbose=self.verbose + ) + + intermediate_steps.append({"context": context}) + if self.use_function_response: + function_response = get_function_response(question, context) + result = self.qa_chain.invoke( + {"question": question, "function_response": function_response}, + ) + else: + result = self.qa_chain.invoke( + {"question": question, "context": context}, + callbacks=callbacks, + ) + + chain_result: Dict[str, Any] = {"result": result} + if self.return_intermediate_steps: + chain_result[INTERMEDIATE_STEPS_KEY] = intermediate_steps + + return chain_result diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/nebulagraph.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/nebulagraph.py new file mode 100644 index 0000000000000000000000000000000000000000..48326b508d65d19a280f2f5759c9f1c5603c43e3 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/nebulagraph.py @@ -0,0 +1,138 @@ +"""Question answering over a graph.""" + +from __future__ import annotations + +from typing import Any, Dict, List, Optional + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_core.callbacks import CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.prompts import BasePromptTemplate +from pydantic import Field + +from langchain_community.chains.graph_qa.prompts import ( + CYPHER_QA_PROMPT, + NGQL_GENERATION_PROMPT, +) +from langchain_community.graphs.nebula_graph import NebulaGraph + + +class NebulaGraphQAChain(Chain): + """Chain for question-answering against a graph by generating nGQL statements. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + graph: NebulaGraph = Field(exclude=True) + ngql_generation_chain: LLMChain + qa_chain: LLMChain + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + + allow_dangerous_requests: bool = False + """Forced user opt-in to acknowledge that the chain can make dangerous requests. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize the chain.""" + super().__init__(**kwargs) + if self.allow_dangerous_requests is not True: + raise ValueError( + "In order to use this chain, you must acknowledge that it can make " + "dangerous requests by setting `allow_dangerous_requests` to `True`." + "You must narrowly scope the permissions of the database connection " + "to only include necessary permissions. Failure to do so may result " + "in data corruption or loss or reading sensitive data if such data is " + "present in the database." + "Only use this chain if you understand the risks and have taken the " + "necessary precautions. " + "See https://python.langchain.com/docs/security for more information." + ) + + @property + def input_keys(self) -> List[str]: + """Return the input keys. + + :meta private: + """ + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + """Return the output keys. + + :meta private: + """ + _output_keys = [self.output_key] + return _output_keys + + @classmethod + def from_llm( + cls, + llm: BaseLanguageModel, + *, + qa_prompt: BasePromptTemplate = CYPHER_QA_PROMPT, + ngql_prompt: BasePromptTemplate = NGQL_GENERATION_PROMPT, + **kwargs: Any, + ) -> NebulaGraphQAChain: + """Initialize from LLM.""" + qa_chain = LLMChain(llm=llm, prompt=qa_prompt) + ngql_generation_chain = LLMChain(llm=llm, prompt=ngql_prompt) + + return cls( + qa_chain=qa_chain, + ngql_generation_chain=ngql_generation_chain, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, str]: + """Generate nGQL statement, use it to look up in db and answer question.""" + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + callbacks = _run_manager.get_child() + question = inputs[self.input_key] + + generated_ngql = self.ngql_generation_chain.run( + {"question": question, "schema": self.graph.get_schema}, callbacks=callbacks + ) + + _run_manager.on_text("Generated nGQL:", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_ngql, color="green", end="\n", verbose=self.verbose + ) + context = self.graph.query(generated_ngql) + + _run_manager.on_text("Full Context:", end="\n", verbose=self.verbose) + _run_manager.on_text( + str(context), color="green", end="\n", verbose=self.verbose + ) + + result = self.qa_chain( + {"question": question, "context": context}, + callbacks=callbacks, + ) + return {self.output_key: result[self.qa_chain.output_key]} diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/neptune_cypher.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/neptune_cypher.py new file mode 100644 index 0000000000000000000000000000000000000000..7318962b620c297764a36d879b8689daead07898 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/neptune_cypher.py @@ -0,0 +1,254 @@ +from __future__ import annotations + +import re +from typing import Any, Dict, List, Optional + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_classic.chains.prompt_selector import ConditionalPromptSelector +from langchain_core._api.deprecation import deprecated +from langchain_core.callbacks import CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.prompts.base import BasePromptTemplate +from pydantic import Field + +from langchain_community.chains.graph_qa.prompts import ( + CYPHER_QA_PROMPT, + NEPTUNE_OPENCYPHER_GENERATION_PROMPT, + NEPTUNE_OPENCYPHER_GENERATION_SIMPLE_PROMPT, +) +from langchain_community.graphs import BaseNeptuneGraph + +INTERMEDIATE_STEPS_KEY = "intermediate_steps" + + +def trim_query(query: str) -> str: + """Trim the query to only include Cypher keywords.""" + keywords = ( + "CALL", + "CREATE", + "DELETE", + "DETACH", + "LIMIT", + "MATCH", + "MERGE", + "OPTIONAL", + "ORDER", + "REMOVE", + "RETURN", + "SET", + "SKIP", + "UNWIND", + "WITH", + "WHERE", + "//", + ) + + lines = query.split("\n") + new_query = "" + + for line in lines: + if line.strip().upper().startswith(keywords): + new_query += line + "\n" + + return new_query + + +def extract_cypher(text: str) -> str: + """Extract Cypher code from text using Regex.""" + # The pattern to find Cypher code enclosed in triple backticks + pattern = r"```(.*?)```" + + # Find all matches in the input text + matches = re.findall(pattern, text, re.DOTALL) + + return matches[0] if matches else text + + +def use_simple_prompt(llm: BaseLanguageModel) -> bool: + """Decides whether to use the simple prompt""" + if llm._llm_type and "anthropic" in llm._llm_type: # type: ignore[attr-defined] + return True + + # Bedrock anthropic + if hasattr(llm, "model_id") and "anthropic" in llm.model_id: + return True + + return False + + +PROMPT_SELECTOR = ConditionalPromptSelector( + default_prompt=NEPTUNE_OPENCYPHER_GENERATION_PROMPT, + conditionals=[(use_simple_prompt, NEPTUNE_OPENCYPHER_GENERATION_SIMPLE_PROMPT)], +) + + +@deprecated( + since="0.3.15", + removal="1.0", + alternative_import="langchain_aws.create_neptune_opencypher_qa_chain", +) +class NeptuneOpenCypherQAChain(Chain): + """Chain for question-answering against a Neptune graph + by generating openCypher statements. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + + Example: + .. code-block:: python + + chain = NeptuneOpenCypherQAChain.from_llm( + llm=llm, + graph=graph + ) + response = chain.run(query) + """ + + graph: BaseNeptuneGraph = Field(exclude=True) + cypher_generation_chain: LLMChain + qa_chain: LLMChain + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + top_k: int = 10 + return_intermediate_steps: bool = False + """Whether or not to return the intermediate steps along with the final answer.""" + return_direct: bool = False + """Whether or not to return the result of querying the graph directly.""" + extra_instructions: Optional[str] = None + """Extra instructions by the appended to the query generation prompt.""" + + allow_dangerous_requests: bool = False + """Forced user opt-in to acknowledge that the chain can make dangerous requests. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize the chain.""" + super().__init__(**kwargs) + if self.allow_dangerous_requests is not True: + raise ValueError( + "In order to use this chain, you must acknowledge that it can make " + "dangerous requests by setting `allow_dangerous_requests` to `True`." + "You must narrowly scope the permissions of the database connection " + "to only include necessary permissions. Failure to do so may result " + "in data corruption or loss or reading sensitive data if such data is " + "present in the database." + "Only use this chain if you understand the risks and have taken the " + "necessary precautions. " + "See https://python.langchain.com/docs/security for more information." + ) + + @property + def input_keys(self) -> List[str]: + """Return the input keys. + + :meta private: + """ + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + """Return the output keys. + + :meta private: + """ + _output_keys = [self.output_key] + return _output_keys + + @classmethod + def from_llm( + cls, + llm: BaseLanguageModel, + *, + qa_prompt: BasePromptTemplate = CYPHER_QA_PROMPT, + cypher_prompt: Optional[BasePromptTemplate] = None, + extra_instructions: Optional[str] = None, + **kwargs: Any, + ) -> NeptuneOpenCypherQAChain: + """Initialize from LLM.""" + qa_chain = LLMChain(llm=llm, prompt=qa_prompt) + + _cypher_prompt = cypher_prompt or PROMPT_SELECTOR.get_prompt(llm) + cypher_generation_chain = LLMChain(llm=llm, prompt=_cypher_prompt) + + return cls( + qa_chain=qa_chain, + cypher_generation_chain=cypher_generation_chain, + extra_instructions=extra_instructions, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, Any]: + """Generate Cypher statement, use it to look up in db and answer question.""" + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + callbacks = _run_manager.get_child() + question = inputs[self.input_key] + + intermediate_steps: List = [] + + generated_cypher = self.cypher_generation_chain.run( + { + "question": question, + "schema": self.graph.get_schema, + "extra_instructions": self.extra_instructions or "", + }, + callbacks=callbacks, + ) + + # Extract Cypher code if it is wrapped in backticks + generated_cypher = extract_cypher(generated_cypher) + generated_cypher = trim_query(generated_cypher) + + _run_manager.on_text("Generated Cypher:", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_cypher, color="green", end="\n", verbose=self.verbose + ) + + intermediate_steps.append({"query": generated_cypher}) + + context = self.graph.query(generated_cypher) + + if self.return_direct: + final_result = context + else: + _run_manager.on_text("Full Context:", end="\n", verbose=self.verbose) + _run_manager.on_text( + str(context), color="green", end="\n", verbose=self.verbose + ) + + intermediate_steps.append({"context": context}) + + result = self.qa_chain( + {"question": question, "context": context}, + callbacks=callbacks, + ) + final_result = result[self.qa_chain.output_key] + + chain_result: Dict[str, Any] = {self.output_key: final_result} + if self.return_intermediate_steps: + chain_result[INTERMEDIATE_STEPS_KEY] = intermediate_steps + + return chain_result diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/neptune_sparql.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/neptune_sparql.py new file mode 100644 index 0000000000000000000000000000000000000000..60a35eab284aa90aee2703537ed77418c6f633d5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/neptune_sparql.py @@ -0,0 +1,242 @@ +""" +Question answering over an RDF or OWL graph using SPARQL. +""" + +from __future__ import annotations + +from typing import Any, Dict, List, Optional + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_core._api.deprecation import deprecated +from langchain_core.callbacks.manager import CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.prompts.base import BasePromptTemplate +from langchain_core.prompts.prompt import PromptTemplate +from pydantic import Field + +from langchain_community.chains.graph_qa.prompts import SPARQL_QA_PROMPT +from langchain_community.graphs import NeptuneRdfGraph + +INTERMEDIATE_STEPS_KEY = "intermediate_steps" + +SPARQL_GENERATION_TEMPLATE = """ +Task: Generate a SPARQL SELECT statement for querying a graph database. +For instance, to find all email addresses of John Doe, the following +query in backticks would be suitable: +``` +PREFIX foaf: +SELECT ?email +WHERE {{ + ?person foaf:name "John Doe" . + ?person foaf:mbox ?email . +}} +``` +Instructions: +Use only the node types and properties provided in the schema. +Do not use any node types and properties that are not explicitly provided. +Include all necessary prefixes. + +Examples: + +Schema: +{schema} +Note: Be as concise as possible. +Do not include any explanations or apologies in your responses. +Do not respond to any questions that ask for anything else than +for you to construct a SPARQL query. +Do not include any text except the SPARQL query generated. + +The question is: +{prompt}""" + +SPARQL_GENERATION_PROMPT = PromptTemplate( + input_variables=["schema", "prompt"], template=SPARQL_GENERATION_TEMPLATE +) + + +def extract_sparql(query: str) -> str: + """Extract SPARQL code from a text. + + Args: + query: Text to extract SPARQL code from. + + Returns: + SPARQL code extracted from the text. + """ + query = query.strip() + querytoks = query.split("```") + if len(querytoks) == 3: + query = querytoks[1] + + if query.startswith("sparql"): + query = query[6:] + elif query.startswith("") and query.endswith(""): + query = query[8:-9] + return query + + +@deprecated( + since="0.3.15", + removal="1.0", + alternative_import="langchain_aws.create_neptune_sparql_qa_chain", +) +class NeptuneSparqlQAChain(Chain): + """Chain for question-answering against a Neptune graph + by generating SPARQL statements. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + + Example: + .. code-block:: python + + chain = NeptuneSparqlQAChain.from_llm( + llm=llm, + graph=graph + ) + response = chain.invoke(query) + """ + + graph: NeptuneRdfGraph = Field(exclude=True) + sparql_generation_chain: LLMChain + qa_chain: LLMChain + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + top_k: int = 10 + return_intermediate_steps: bool = False + """Whether or not to return the intermediate steps along with the final answer.""" + return_direct: bool = False + """Whether or not to return the result of querying the graph directly.""" + extra_instructions: Optional[str] = None + """Extra instructions by the appended to the query generation prompt.""" + + allow_dangerous_requests: bool = False + """Forced user opt-in to acknowledge that the chain can make dangerous requests. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize the chain.""" + super().__init__(**kwargs) + if self.allow_dangerous_requests is not True: + raise ValueError( + "In order to use this chain, you must acknowledge that it can make " + "dangerous requests by setting `allow_dangerous_requests` to `True`." + "You must narrowly scope the permissions of the database connection " + "to only include necessary permissions. Failure to do so may result " + "in data corruption or loss or reading sensitive data if such data is " + "present in the database." + "Only use this chain if you understand the risks and have taken the " + "necessary precautions. " + "See https://python.langchain.com/docs/security for more information." + ) + + @property + def input_keys(self) -> List[str]: + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + _output_keys = [self.output_key] + return _output_keys + + @classmethod + def from_llm( + cls, + llm: BaseLanguageModel, + *, + qa_prompt: BasePromptTemplate = SPARQL_QA_PROMPT, + sparql_prompt: BasePromptTemplate = SPARQL_GENERATION_PROMPT, + examples: Optional[str] = None, + **kwargs: Any, + ) -> NeptuneSparqlQAChain: + """Initialize from LLM.""" + qa_chain = LLMChain(llm=llm, prompt=qa_prompt) + template_to_use = SPARQL_GENERATION_TEMPLATE + if examples: + template_to_use = template_to_use.replace( + "Examples:", "Examples: " + examples + ) + sparql_prompt = PromptTemplate( + input_variables=["schema", "prompt"], template=template_to_use + ) + sparql_generation_chain = LLMChain(llm=llm, prompt=sparql_prompt) + + return cls( + qa_chain=qa_chain, + sparql_generation_chain=sparql_generation_chain, + examples=examples, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, str]: + """ + Generate SPARQL query, use it to retrieve a response from the gdb and answer + the question. + """ + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + callbacks = _run_manager.get_child() + prompt = inputs[self.input_key] + + intermediate_steps: List = [] + + generated_sparql = self.sparql_generation_chain.run( + {"prompt": prompt, "schema": self.graph.get_schema}, callbacks=callbacks + ) + + # Extract SPARQL + generated_sparql = extract_sparql(generated_sparql) + + _run_manager.on_text("Generated SPARQL:", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_sparql, color="green", end="\n", verbose=self.verbose + ) + + intermediate_steps.append({"query": generated_sparql}) + + context = self.graph.query(generated_sparql) + + if self.return_direct: + final_result = context + else: + _run_manager.on_text("Full Context:", end="\n", verbose=self.verbose) + _run_manager.on_text( + str(context), color="green", end="\n", verbose=self.verbose + ) + + intermediate_steps.append({"context": context}) + + result = self.qa_chain( + {"prompt": prompt, "context": context}, + callbacks=callbacks, + ) + final_result = result[self.qa_chain.output_key] + + chain_result: Dict[str, Any] = {self.output_key: final_result} + if self.return_intermediate_steps: + chain_result[INTERMEDIATE_STEPS_KEY] = intermediate_steps + + return chain_result diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/ontotext_graphdb.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/ontotext_graphdb.py new file mode 100644 index 0000000000000000000000000000000000000000..613100a33ba265415bb3dd6985dda4e6ee638166 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/ontotext_graphdb.py @@ -0,0 +1,222 @@ +"""Question answering over a graph.""" + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Dict, List, Optional + +if TYPE_CHECKING: + import rdflib + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_core.callbacks.manager import CallbackManager, CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.prompts.base import BasePromptTemplate +from pydantic import Field + +from langchain_community.chains.graph_qa.prompts import ( + GRAPHDB_QA_PROMPT, + GRAPHDB_SPARQL_FIX_PROMPT, + GRAPHDB_SPARQL_GENERATION_PROMPT, +) +from langchain_community.graphs import OntotextGraphDBGraph + + +class OntotextGraphDBQAChain(Chain): + """Question-answering against Ontotext GraphDB + https://graphdb.ontotext.com/ by generating SPARQL queries. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + graph: OntotextGraphDBGraph = Field(exclude=True) + sparql_generation_chain: LLMChain + sparql_fix_chain: LLMChain + max_fix_retries: int + qa_chain: LLMChain + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + + allow_dangerous_requests: bool = False + """Forced user opt-in to acknowledge that the chain can make dangerous requests. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize the chain.""" + super().__init__(**kwargs) + if self.allow_dangerous_requests is not True: + raise ValueError( + "In order to use this chain, you must acknowledge that it can make " + "dangerous requests by setting `allow_dangerous_requests` to `True`." + "You must narrowly scope the permissions of the database connection " + "to only include necessary permissions. Failure to do so may result " + "in data corruption or loss or reading sensitive data if such data is " + "present in the database." + "Only use this chain if you understand the risks and have taken the " + "necessary precautions. " + "See https://python.langchain.com/docs/security for more information." + ) + + @property + def input_keys(self) -> List[str]: + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + _output_keys = [self.output_key] + return _output_keys + + @classmethod + def from_llm( + cls, + llm: BaseLanguageModel, + *, + sparql_generation_prompt: BasePromptTemplate = GRAPHDB_SPARQL_GENERATION_PROMPT, + sparql_fix_prompt: BasePromptTemplate = GRAPHDB_SPARQL_FIX_PROMPT, + max_fix_retries: int = 5, + qa_prompt: BasePromptTemplate = GRAPHDB_QA_PROMPT, + **kwargs: Any, + ) -> OntotextGraphDBQAChain: + """Initialize from LLM.""" + sparql_generation_chain = LLMChain(llm=llm, prompt=sparql_generation_prompt) + sparql_fix_chain = LLMChain(llm=llm, prompt=sparql_fix_prompt) + max_fix_retries = max_fix_retries + qa_chain = LLMChain(llm=llm, prompt=qa_prompt) + return cls( + qa_chain=qa_chain, + sparql_generation_chain=sparql_generation_chain, + sparql_fix_chain=sparql_fix_chain, + max_fix_retries=max_fix_retries, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, str]: + """ + Generate a SPARQL query, use it to retrieve a response from GraphDB and answer + the question. + """ + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + callbacks = _run_manager.get_child() + prompt = inputs[self.input_key] + ontology_schema = self.graph.get_schema + + sparql_generation_chain_result = self.sparql_generation_chain.invoke( + {"prompt": prompt, "schema": ontology_schema}, callbacks=callbacks + ) + generated_sparql = sparql_generation_chain_result[ + self.sparql_generation_chain.output_key + ] + + generated_sparql = self._get_prepared_sparql_query( + _run_manager, callbacks, generated_sparql, ontology_schema + ) + query_results = self._execute_query(generated_sparql) + + qa_chain_result = self.qa_chain.invoke( + {"prompt": prompt, "context": query_results}, callbacks=callbacks + ) + result = qa_chain_result[self.qa_chain.output_key] + return {self.output_key: result} + + def _get_prepared_sparql_query( + self, + _run_manager: CallbackManagerForChainRun, + callbacks: CallbackManager, + generated_sparql: str, + ontology_schema: str, + ) -> str: + try: + return self._prepare_sparql_query(_run_manager, generated_sparql) + except Exception as e: + retries = 0 + error_message = str(e) + self._log_invalid_sparql_query( + _run_manager, generated_sparql, error_message + ) + + while retries < self.max_fix_retries: + try: + sparql_fix_chain_result = self.sparql_fix_chain.invoke( + { + "error_message": error_message, + "generated_sparql": generated_sparql, + "schema": ontology_schema, + }, + callbacks=callbacks, + ) + generated_sparql = sparql_fix_chain_result[ + self.sparql_fix_chain.output_key + ] + return self._prepare_sparql_query(_run_manager, generated_sparql) + except Exception as e: + retries += 1 + parse_exception = str(e) + self._log_invalid_sparql_query( + _run_manager, generated_sparql, parse_exception + ) + + raise ValueError("The generated SPARQL query is invalid.") + + def _prepare_sparql_query( + self, _run_manager: CallbackManagerForChainRun, generated_sparql: str + ) -> str: + from rdflib.plugins.sparql import prepareQuery + + prepareQuery(generated_sparql) + self._log_prepared_sparql_query(_run_manager, generated_sparql) + return generated_sparql + + def _log_prepared_sparql_query( + self, _run_manager: CallbackManagerForChainRun, generated_query: str + ) -> None: + _run_manager.on_text("Generated SPARQL:", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_query, color="green", end="\n", verbose=self.verbose + ) + + def _log_invalid_sparql_query( + self, + _run_manager: CallbackManagerForChainRun, + generated_query: str, + error_message: str, + ) -> None: + _run_manager.on_text("Invalid SPARQL query: ", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_query, color="red", end="\n", verbose=self.verbose + ) + _run_manager.on_text( + "SPARQL Query Parse Error: ", end="\n", verbose=self.verbose + ) + _run_manager.on_text( + error_message, color="red", end="\n\n", verbose=self.verbose + ) + + def _execute_query(self, query: str) -> List[rdflib.query.ResultRow]: + try: + return self.graph.query(query) + except Exception: + raise ValueError("Failed to execute the generated SPARQL query.") diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/prompts.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/prompts.py new file mode 100644 index 0000000000000000000000000000000000000000..9077da3e00e3dc38dfce2a27bec4013756d9264f --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/prompts.py @@ -0,0 +1,468 @@ +# flake8: noqa +from langchain_core.prompts.prompt import PromptTemplate + +_DEFAULT_ENTITY_EXTRACTION_TEMPLATE = """Extract all entities from the following text. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places. + +Return the output as a single comma-separated list, or NONE if there is nothing of note to return. + +EXAMPLE +i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. +Output: Langchain +END OF EXAMPLE + +EXAMPLE +i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. I'm working with Sam. +Output: Langchain, Sam +END OF EXAMPLE + +Begin! + +{input} +Output:""" +ENTITY_EXTRACTION_PROMPT = PromptTemplate( + input_variables=["input"], template=_DEFAULT_ENTITY_EXTRACTION_TEMPLATE +) + +_DEFAULT_GRAPH_QA_TEMPLATE = """Use the following knowledge triplets to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. + +{context} + +Question: {question} +Helpful Answer:""" +GRAPH_QA_PROMPT = PromptTemplate( + template=_DEFAULT_GRAPH_QA_TEMPLATE, input_variables=["context", "question"] +) + +CYPHER_GENERATION_TEMPLATE = """Task:Generate Cypher statement to query a graph database. +Instructions: +Use only the provided relationship types and properties in the schema. +Do not use any other relationship types or properties that are not provided. +Schema: +{schema} +Note: Do not include any explanations or apologies in your responses. +Do not respond to any questions that might ask anything else than for you to construct a Cypher statement. +Do not include any text except the generated Cypher statement. + +The question is: +{question}""" +CYPHER_GENERATION_PROMPT = PromptTemplate( + input_variables=["schema", "question"], template=CYPHER_GENERATION_TEMPLATE +) + +NEBULAGRAPH_EXTRA_INSTRUCTIONS = """ +Instructions: + +First, generate cypher then convert it to NebulaGraph Cypher dialect(rather than standard): +1. it requires explicit label specification only when referring to node properties: v.`Foo`.name +2. note explicit label specification is not needed for edge properties, so it's e.name instead of e.`Bar`.name +3. it uses double equals sign for comparison: `==` rather than `=` +For instance: +```diff +< MATCH (p:person)-[e:directed]->(m:movie) WHERE m.name = 'The Godfather II' +< RETURN p.name, e.year, m.name; +--- +> MATCH (p:`person`)-[e:directed]->(m:`movie`) WHERE m.`movie`.`name` == 'The Godfather II' +> RETURN p.`person`.`name`, e.year, m.`movie`.`name`; +```\n""" + +NGQL_GENERATION_TEMPLATE = CYPHER_GENERATION_TEMPLATE.replace( + "Generate Cypher", "Generate NebulaGraph Cypher" +).replace("Instructions:", NEBULAGRAPH_EXTRA_INSTRUCTIONS) + +NGQL_GENERATION_PROMPT = PromptTemplate( + input_variables=["schema", "question"], template=NGQL_GENERATION_TEMPLATE +) + +KUZU_EXTRA_INSTRUCTIONS = """ +Instructions: +Generate the Kùzu dialect of Cypher with the following rules in mind: +1. Do not omit the relationship pattern. Always use `()-[]->()` instead of `()->()`. +2. Do not include triple backticks ``` in your response. Return only Cypher. +3. Do not return any notes or comments in your response. +\n""" + +KUZU_GENERATION_TEMPLATE = CYPHER_GENERATION_TEMPLATE.replace( + "Generate Cypher", "Generate Kùzu Cypher" +).replace("Instructions:", KUZU_EXTRA_INSTRUCTIONS) + +KUZU_GENERATION_PROMPT = PromptTemplate( + input_variables=["schema", "question"], template=KUZU_GENERATION_TEMPLATE +) + +GREMLIN_GENERATION_TEMPLATE = CYPHER_GENERATION_TEMPLATE.replace("Cypher", "Gremlin") + +GREMLIN_GENERATION_PROMPT = PromptTemplate( + input_variables=["schema", "question"], template=GREMLIN_GENERATION_TEMPLATE +) + +CYPHER_QA_TEMPLATE = """You are an assistant that helps to form nice and human understandable answers. +The information part contains the provided information that you must use to construct an answer. +The provided information is authoritative, you must never doubt it or try to use your internal knowledge to correct it. +Make the answer sound as a response to the question. Do not mention that you based the result on the given information. +Here is an example: + +Question: Which managers own Neo4j stocks? +Context:[manager:CTL LLC, manager:JANE STREET GROUP LLC] +Helpful Answer: CTL LLC, JANE STREET GROUP LLC owns Neo4j stocks. + +Follow this example when generating answers. +If the provided information is empty, say that you don't know the answer. +Information: +{context} + +Question: {question} +Helpful Answer:""" +CYPHER_QA_PROMPT = PromptTemplate( + input_variables=["context", "question"], template=CYPHER_QA_TEMPLATE +) + +SPARQL_INTENT_TEMPLATE = """Task: Identify the intent of a prompt and return the appropriate SPARQL query type. +You are an assistant that distinguishes different types of prompts and returns the corresponding SPARQL query types. +Consider only the following query types: +* SELECT: this query type corresponds to questions +* UPDATE: this query type corresponds to all requests for deleting, inserting, or changing triples +Note: Be as concise as possible. +Do not include any explanations or apologies in your responses. +Do not respond to any questions that ask for anything else than for you to identify a SPARQL query type. +Do not include any unnecessary whitespaces or any text except the query type, i.e., either return 'SELECT' or 'UPDATE'. + +The prompt is: +{prompt} +Helpful Answer:""" +SPARQL_INTENT_PROMPT = PromptTemplate( + input_variables=["prompt"], template=SPARQL_INTENT_TEMPLATE +) + +SPARQL_GENERATION_SELECT_TEMPLATE = """Task: Generate a SPARQL SELECT statement for querying a graph database. +For instance, to find all email addresses of John Doe, the following query in backticks would be suitable: +``` +PREFIX foaf: +SELECT ?email +WHERE {{ + ?person foaf:name "John Doe" . + ?person foaf:mbox ?email . +}} +``` +Instructions: +Use only the node types and properties provided in the schema. +Do not use any node types and properties that are not explicitly provided. +Include all necessary prefixes. +Schema: +{schema} +Note: Be as concise as possible. +Do not include any explanations or apologies in your responses. +Do not respond to any questions that ask for anything else than for you to construct a SPARQL query. +Do not include any text except the SPARQL query generated. + +The question is: +{prompt}""" +SPARQL_GENERATION_SELECT_PROMPT = PromptTemplate( + input_variables=["schema", "prompt"], template=SPARQL_GENERATION_SELECT_TEMPLATE +) + +SPARQL_GENERATION_UPDATE_TEMPLATE = """Task: Generate a SPARQL UPDATE statement for updating a graph database. +For instance, to add 'jane.doe@foo.bar' as a new email address for Jane Doe, the following query in backticks would be suitable: +``` +PREFIX foaf: +INSERT {{ + ?person foaf:mbox . +}} +WHERE {{ + ?person foaf:name "Jane Doe" . +}} +``` +Instructions: +Make the query as short as possible and avoid adding unnecessary triples. +Use only the node types and properties provided in the schema. +Do not use any node types and properties that are not explicitly provided. +Include all necessary prefixes. +Schema: +{schema} +Note: Be as concise as possible. +Do not include any explanations or apologies in your responses. +Do not respond to any questions that ask for anything else than for you to construct a SPARQL query. +Return only the generated SPARQL query, nothing else. + +The information to be inserted is: +{prompt}""" +SPARQL_GENERATION_UPDATE_PROMPT = PromptTemplate( + input_variables=["schema", "prompt"], template=SPARQL_GENERATION_UPDATE_TEMPLATE +) + +SPARQL_QA_TEMPLATE = """Task: Generate a natural language response from the results of a SPARQL query. +You are an assistant that creates well-written and human understandable answers. +The information part contains the information provided, which you can use to construct an answer. +The information provided is authoritative, you must never doubt it or try to use your internal knowledge to correct it. +Make your response sound like the information is coming from an AI assistant, but don't add any information. +Information: +{context} + +Question: {prompt} +Helpful Answer:""" +SPARQL_QA_PROMPT = PromptTemplate( + input_variables=["context", "prompt"], template=SPARQL_QA_TEMPLATE +) + +GRAPHDB_SPARQL_GENERATION_TEMPLATE = """ +Write a SPARQL SELECT query for querying a graph database. +The ontology schema delimited by triple backticks in Turtle format is: +``` +{schema} +``` +Use only the classes and properties provided in the schema to construct the SPARQL query. +Do not use any classes or properties that are not explicitly provided in the SPARQL query. +Include all necessary prefixes. +Do not include any explanations or apologies in your responses. +Do not wrap the query in backticks. +Do not include any text except the SPARQL query generated. +The question delimited by triple backticks is: +``` +{prompt} +``` +""" +GRAPHDB_SPARQL_GENERATION_PROMPT = PromptTemplate( + input_variables=["schema", "prompt"], + template=GRAPHDB_SPARQL_GENERATION_TEMPLATE, +) + +GRAPHDB_SPARQL_FIX_TEMPLATE = """ +This following SPARQL query delimited by triple backticks +``` +{generated_sparql} +``` +is not valid. +The error delimited by triple backticks is +``` +{error_message} +``` +Give me a correct version of the SPARQL query. +Do not change the logic of the query. +Do not include any explanations or apologies in your responses. +Do not wrap the query in backticks. +Do not include any text except the SPARQL query generated. +The ontology schema delimited by triple backticks in Turtle format is: +``` +{schema} +``` +""" + +GRAPHDB_SPARQL_FIX_PROMPT = PromptTemplate( + input_variables=["error_message", "generated_sparql", "schema"], + template=GRAPHDB_SPARQL_FIX_TEMPLATE, +) + +GRAPHDB_QA_TEMPLATE = """Task: Generate a natural language response from the results of a SPARQL query. +You are an assistant that creates well-written and human understandable answers. +The information part contains the information provided, which you can use to construct an answer. +The information provided is authoritative, you must never doubt it or try to use your internal knowledge to correct it. +Make your response sound like the information is coming from an AI assistant, but don't add any information. +Don't use internal knowledge to answer the question, just say you don't know if no information is available. +Information: +{context} + +Question: {prompt} +Helpful Answer:""" +GRAPHDB_QA_PROMPT = PromptTemplate( + input_variables=["context", "prompt"], template=GRAPHDB_QA_TEMPLATE +) + +AQL_GENERATION_TEMPLATE = """Task: Generate an ArangoDB Query Language (AQL) query from a User Input. + +You are an ArangoDB Query Language (AQL) expert responsible for translating a `User Input` into an ArangoDB Query Language (AQL) query. + +You are given an `ArangoDB Schema`. It is a JSON Object containing: +1. `Graph Schema`: Lists all Graphs within the ArangoDB Database Instance, along with their Edge Relationships. +2. `Collection Schema`: Lists all Collections within the ArangoDB Database Instance, along with their document/edge properties and a document/edge example. + +You may also be given a set of `AQL Query Examples` to help you create the `AQL Query`. If provided, the `AQL Query Examples` should be used as a reference, similar to how `ArangoDB Schema` should be used. + +Things you should do: +- Think step by step. +- Rely on `ArangoDB Schema` and `AQL Query Examples` (if provided) to generate the query. +- Begin the `AQL Query` by the `WITH` AQL keyword to specify all of the ArangoDB Collections required. +- Return the `AQL Query` wrapped in 3 backticks (```). +- Use only the provided relationship types and properties in the `ArangoDB Schema` and any `AQL Query Examples` queries. +- Only answer to requests related to generating an AQL Query. +- If a request is unrelated to generating AQL Query, say that you cannot help the user. + +Things you should not do: +- Do not use any properties/relationships that can't be inferred from the `ArangoDB Schema` or the `AQL Query Examples`. +- Do not include any text except the generated AQL Query. +- Do not provide explanations or apologies in your responses. +- Do not generate an AQL Query that removes or deletes any data. + +Under no circumstance should you generate an AQL Query that deletes any data whatsoever. + +ArangoDB Schema: +{adb_schema} + +AQL Query Examples (Optional): +{aql_examples} + +User Input: +{user_input} + +AQL Query: +""" + +AQL_GENERATION_PROMPT = PromptTemplate( + input_variables=["adb_schema", "aql_examples", "user_input"], + template=AQL_GENERATION_TEMPLATE, +) + +AQL_FIX_TEMPLATE = """Task: Address the ArangoDB Query Language (AQL) error message of an ArangoDB Query Language query. + +You are an ArangoDB Query Language (AQL) expert responsible for correcting the provided `AQL Query` based on the provided `AQL Error`. + +The `AQL Error` explains why the `AQL Query` could not be executed in the database. +The `AQL Error` may also contain the position of the error relative to the total number of lines of the `AQL Query`. +For example, 'error X at position 2:5' denotes that the error X occurs on line 2, column 5 of the `AQL Query`. + +You are also given the `ArangoDB Schema`. It is a JSON Object containing: +1. `Graph Schema`: Lists all Graphs within the ArangoDB Database Instance, along with their Edge Relationships. +2. `Collection Schema`: Lists all Collections within the ArangoDB Database Instance, along with their document/edge properties and a document/edge example. + +You will output the `Corrected AQL Query` wrapped in 3 backticks (```). Do not include any text except the Corrected AQL Query. + +Remember to think step by step. + +ArangoDB Schema: +{adb_schema} + +AQL Query: +{aql_query} + +AQL Error: +{aql_error} + +Corrected AQL Query: +""" + +AQL_FIX_PROMPT = PromptTemplate( + input_variables=[ + "adb_schema", + "aql_query", + "aql_error", + ], + template=AQL_FIX_TEMPLATE, +) + +AQL_QA_TEMPLATE = """Task: Generate a natural language `Summary` from the results of an ArangoDB Query Language query. + +You are an ArangoDB Query Language (AQL) expert responsible for creating a well-written `Summary` from the `User Input` and associated `AQL Result`. + +A user has executed an ArangoDB Query Language query, which has returned the AQL Result in JSON format. +You are responsible for creating an `Summary` based on the AQL Result. + +You are given the following information: +- `ArangoDB Schema`: contains a schema representation of the user's ArangoDB Database. +- `User Input`: the original question/request of the user, which has been translated into an AQL Query. +- `AQL Query`: the AQL equivalent of the `User Input`, translated by another AI Model. Should you deem it to be incorrect, suggest a different AQL Query. +- `AQL Result`: the JSON output returned by executing the `AQL Query` within the ArangoDB Database. + +Remember to think step by step. + +Your `Summary` should sound like it is a response to the `User Input`. +Your `Summary` should not include any mention of the `AQL Query` or the `AQL Result`. + +ArangoDB Schema: +{adb_schema} + +User Input: +{user_input} + +AQL Query: +{aql_query} + +AQL Result: +{aql_result} +""" +AQL_QA_PROMPT = PromptTemplate( + input_variables=["adb_schema", "user_input", "aql_query", "aql_result"], + template=AQL_QA_TEMPLATE, +) + + +NEPTUNE_OPENCYPHER_EXTRA_INSTRUCTIONS = """ +Instructions: +Generate the query in openCypher format and follow these rules: +Do not use `NONE`, `ALL` or `ANY` predicate functions, rather use list comprehensions. +Do not use `REDUCE` function. Rather use a combination of list comprehension and the `UNWIND` clause to achieve similar results. +Do not use `FOREACH` clause. Rather use a combination of `WITH` and `UNWIND` clauses to achieve similar results.{extra_instructions} +\n""" + +NEPTUNE_OPENCYPHER_GENERATION_TEMPLATE = CYPHER_GENERATION_TEMPLATE.replace( + "Instructions:", NEPTUNE_OPENCYPHER_EXTRA_INSTRUCTIONS +) + +NEPTUNE_OPENCYPHER_GENERATION_PROMPT = PromptTemplate( + input_variables=["schema", "question", "extra_instructions"], + template=NEPTUNE_OPENCYPHER_GENERATION_TEMPLATE, +) + +NEPTUNE_OPENCYPHER_GENERATION_SIMPLE_TEMPLATE = """ +Write an openCypher query to answer the following question. Do not explain the answer. Only return the query.{extra_instructions} +Question: "{question}". +Here is the property graph schema: +{schema} +\n""" + +NEPTUNE_OPENCYPHER_GENERATION_SIMPLE_PROMPT = PromptTemplate( + input_variables=["schema", "question", "extra_instructions"], + template=NEPTUNE_OPENCYPHER_GENERATION_SIMPLE_TEMPLATE, +) + +MEMGRAPH_GENERATION_TEMPLATE = """Your task is to directly translate natural language inquiry into precise and executable Cypher query for Memgraph database. +You will utilize a provided database schema to understand the structure, nodes and relationships within the Memgraph database. +Instructions: +- Use provided node and relationship labels and property names from the +schema which describes the database's structure. Upon receiving a user +question, synthesize the schema to craft a precise Cypher query that +directly corresponds to the user's intent. +- Generate valid executable Cypher queries on top of Memgraph database. +Any explanation, context, or additional information that is not a part +of the Cypher query syntax should be omitted entirely. +- Use Memgraph MAGE procedures instead of Neo4j APOC procedures. +- Do not include any explanations or apologies in your responses. +- Do not include any text except the generated Cypher statement. +- For queries that ask for information or functionalities outside the direct +generation of Cypher queries, use the Cypher query format to communicate +limitations or capabilities. For example: RETURN "I am designed to generate +Cypher queries based on the provided schema only." +Schema: +{schema} + +With all the above information and instructions, generate Cypher query for the +user question. + +The question is: +{question}""" + +MEMGRAPH_GENERATION_PROMPT = PromptTemplate( + input_variables=["schema", "question"], template=MEMGRAPH_GENERATION_TEMPLATE +) + + +MEMGRAPH_QA_TEMPLATE = """Your task is to form nice and human +understandable answers. The information part contains the provided +information that you must use to construct an answer. +The provided information is authoritative, you must never doubt it or try to +use your internal knowledge to correct it. Make the answer sound as a +response to the question. Do not mention that you based the result on the +given information. Here is an example: + +Question: Which managers own Neo4j stocks? +Context:[manager:CTL LLC, manager:JANE STREET GROUP LLC] +Helpful Answer: CTL LLC, JANE STREET GROUP LLC owns Neo4j stocks. + +Follow this example when generating answers. If the provided information is +empty, say that you don't know the answer. + +Information: +{context} + +Question: {question} +Helpful Answer:""" +MEMGRAPH_QA_PROMPT = PromptTemplate( + input_variables=["context", "question"], template=MEMGRAPH_QA_TEMPLATE +) diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/sparql.py b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/sparql.py new file mode 100644 index 0000000000000000000000000000000000000000..56ed5cc9b57364c6891f9b61d41b0a8c2a471c59 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/graph_qa/sparql.py @@ -0,0 +1,184 @@ +""" +Question answering over an RDF or OWL graph using SPARQL. +""" + +from __future__ import annotations + +from typing import Any, Dict, List, Optional + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_core.callbacks import CallbackManagerForChainRun +from langchain_core.language_models import BaseLanguageModel +from langchain_core.prompts.base import BasePromptTemplate +from pydantic import Field + +from langchain_community.chains.graph_qa.prompts import ( + SPARQL_GENERATION_SELECT_PROMPT, + SPARQL_GENERATION_UPDATE_PROMPT, + SPARQL_INTENT_PROMPT, + SPARQL_QA_PROMPT, +) +from langchain_community.graphs.rdf_graph import RdfGraph + + +class GraphSparqlQAChain(Chain): + """Question-answering against an RDF or OWL graph by generating SPARQL statements. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + graph: RdfGraph = Field(exclude=True) + sparql_generation_select_chain: LLMChain + sparql_generation_update_chain: LLMChain + sparql_intent_chain: LLMChain + qa_chain: LLMChain + return_sparql_query: bool = False + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + sparql_query_key: str = "sparql_query" #: :meta private: + + allow_dangerous_requests: bool = False + """Forced user opt-in to acknowledge that the chain can make dangerous requests. + + *Security note*: Make sure that the database connection uses credentials + that are narrowly-scoped to only include necessary permissions. + Failure to do so may result in data corruption or loss, since the calling + code may attempt commands that would result in deletion, mutation + of data if appropriately prompted or reading sensitive data if such + data is present in the database. + The best way to guard against such negative outcomes is to (as appropriate) + limit the permissions granted to the credentials used with this tool. + + See https://python.langchain.com/docs/security for more information. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize the chain.""" + super().__init__(**kwargs) + if self.allow_dangerous_requests is not True: + raise ValueError( + "In order to use this chain, you must acknowledge that it can make " + "dangerous requests by setting `allow_dangerous_requests` to `True`." + "You must narrowly scope the permissions of the database connection " + "to only include necessary permissions. Failure to do so may result " + "in data corruption or loss or reading sensitive data if such data is " + "present in the database." + "Only use this chain if you understand the risks and have taken the " + "necessary precautions. " + "See https://python.langchain.com/docs/security for more information." + ) + + @property + def input_keys(self) -> List[str]: + """Return the input keys. + + :meta private: + """ + return [self.input_key] + + @property + def output_keys(self) -> List[str]: + """Return the output keys. + + :meta private: + """ + _output_keys = [self.output_key] + return _output_keys + + @classmethod + def from_llm( + cls, + llm: BaseLanguageModel, + *, + qa_prompt: BasePromptTemplate = SPARQL_QA_PROMPT, + sparql_select_prompt: BasePromptTemplate = SPARQL_GENERATION_SELECT_PROMPT, + sparql_update_prompt: BasePromptTemplate = SPARQL_GENERATION_UPDATE_PROMPT, + sparql_intent_prompt: BasePromptTemplate = SPARQL_INTENT_PROMPT, + **kwargs: Any, + ) -> GraphSparqlQAChain: + """Initialize from LLM.""" + qa_chain = LLMChain(llm=llm, prompt=qa_prompt) + sparql_generation_select_chain = LLMChain(llm=llm, prompt=sparql_select_prompt) + sparql_generation_update_chain = LLMChain(llm=llm, prompt=sparql_update_prompt) + sparql_intent_chain = LLMChain(llm=llm, prompt=sparql_intent_prompt) + + return cls( + qa_chain=qa_chain, + sparql_generation_select_chain=sparql_generation_select_chain, + sparql_generation_update_chain=sparql_generation_update_chain, + sparql_intent_chain=sparql_intent_chain, + **kwargs, + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, str]: + """ + Generate SPARQL query, use it to retrieve a response from the gdb and answer + the question. + """ + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + callbacks = _run_manager.get_child() + prompt = inputs[self.input_key] + + _intent = self.sparql_intent_chain.run({"prompt": prompt}, callbacks=callbacks) + intent = _intent.strip() + + if "SELECT" in intent and "UPDATE" not in intent: + sparql_generation_chain = self.sparql_generation_select_chain + intent = "SELECT" + elif "UPDATE" in intent and "SELECT" not in intent: + sparql_generation_chain = self.sparql_generation_update_chain + intent = "UPDATE" + else: + raise ValueError( + "I am sorry, but this prompt seems to fit none of the currently " + "supported SPARQL query types, i.e., SELECT and UPDATE." + ) + + _run_manager.on_text("Identified intent:", end="\n", verbose=self.verbose) + _run_manager.on_text(intent, color="green", end="\n", verbose=self.verbose) + + generated_sparql = sparql_generation_chain.run( + {"prompt": prompt, "schema": self.graph.get_schema}, callbacks=callbacks + ) + + _run_manager.on_text("Generated SPARQL:", end="\n", verbose=self.verbose) + _run_manager.on_text( + generated_sparql, color="green", end="\n", verbose=self.verbose + ) + + if intent == "SELECT": + context = self.graph.query(generated_sparql) + + _run_manager.on_text("Full Context:", end="\n", verbose=self.verbose) + _run_manager.on_text( + str(context), color="green", end="\n", verbose=self.verbose + ) + result = self.qa_chain( + {"prompt": prompt, "context": context}, + callbacks=callbacks, + ) + res = result[self.qa_chain.output_key] + elif intent == "UPDATE": + self.graph.update(generated_sparql) + res = "Successfully inserted triples into the graph." + else: + raise ValueError("Unsupported SPARQL query type.") + + chain_result: Dict[str, Any] = {self.output_key: res} + if self.return_sparql_query: + chain_result[self.sparql_query_key] = generated_sparql + return chain_result diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..aeec86f8bf21976881339ffa2546a4b88ea538e8 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__init__.py @@ -0,0 +1,8 @@ +"""Implement a GPT-3 driven browser. + +Heavily influenced from https://github.com/nat/natbot +""" + +from langchain_community.chains.natbot.base import NatBotChain + +__all__ = ["NatBotChain"] diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aadcc8314ccab2c872bed9a1439a02d948a60ccf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c115503f6c6583e8cd82a0581528715aea76920 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__pycache__/crawler.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__pycache__/crawler.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..87eaf1122a3d944b282a2fd48f1eb355d912acb1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__pycache__/crawler.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__pycache__/prompt.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__pycache__/prompt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e3245e795167e67fcea0b8f1820d89f7ae572cf9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/__pycache__/prompt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/base.py b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/base.py new file mode 100644 index 0000000000000000000000000000000000000000..609d5c281032a1f9edf5a61aebe53fe7f8d47b1c --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/base.py @@ -0,0 +1,3 @@ +from langchain_classic.chains import NatBotChain + +__all__ = ["NatBotChain"] diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/crawler.py b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/crawler.py new file mode 100644 index 0000000000000000000000000000000000000000..794ea0f69f922e6db5f652acb2686b150da397f9 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/crawler.py @@ -0,0 +1,7 @@ +from langchain_classic.chains.natbot.crawler import ( + Crawler, + ElementInViewPort, + black_listed_elements, +) + +__all__ = ["ElementInViewPort", "Crawler", "black_listed_elements"] diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/prompt.py b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/prompt.py new file mode 100644 index 0000000000000000000000000000000000000000..0147ee81f138ef2755713fba03ca0288afa02d5f --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/natbot/prompt.py @@ -0,0 +1,3 @@ +from langchain_classic.chains.natbot.prompt import PROMPT + +__all__ = ["PROMPT"] diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..698f148abcf583df95e0e2e85fdbc23ecca81bb9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/chain.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/chain.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..50b0fa175649ce9a02c8359e142a85ef22e5bae6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/chain.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/prompts.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/prompts.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a52cb1c63653205621af5f4bb82dd855a6b655f2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/prompts.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/requests_chain.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/requests_chain.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e39b64916e92ff248d697faad990a3da6e130035 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/requests_chain.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/response_chain.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/response_chain.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1d3252220051887bcc0d3485a98905c0aae22aa7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/__pycache__/response_chain.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/chain.py b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/chain.py new file mode 100644 index 0000000000000000000000000000000000000000..3b9ebe9a3678f13f3fd126cadf245e6187448a71 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/chain.py @@ -0,0 +1,230 @@ +"""Chain that makes API calls and summarizes the responses to answer a question.""" + +from __future__ import annotations + +import json +from typing import Any, Dict, List, NamedTuple, Optional, cast + +from langchain_classic.chains.api.openapi.requests_chain import APIRequesterChain +from langchain_classic.chains.api.openapi.response_chain import APIResponderChain +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain +from langchain_core.callbacks import CallbackManagerForChainRun, Callbacks +from langchain_core.language_models import BaseLanguageModel +from pydantic import BaseModel, Field +from requests import Response + +from langchain_community.tools.openapi.utils.api_models import APIOperation +from langchain_community.utilities.requests import Requests + + +class _ParamMapping(NamedTuple): + """Mapping from parameter name to parameter value.""" + + query_params: List[str] + body_params: List[str] + path_params: List[str] + + +class OpenAPIEndpointChain(Chain, BaseModel): + """Chain interacts with an OpenAPI endpoint using natural language.""" + + api_request_chain: LLMChain + api_response_chain: Optional[LLMChain] = None + api_operation: APIOperation + requests: Requests = Field(exclude=True, default_factory=Requests) + param_mapping: _ParamMapping = Field(alias="param_mapping") + return_intermediate_steps: bool = False + instructions_key: str = "instructions" #: :meta private: + output_key: str = "output" #: :meta private: + max_text_length: Optional[int] = Field(ge=0) #: :meta private: + + @property + def input_keys(self) -> List[str]: + """Expect input key. + + :meta private: + """ + return [self.instructions_key] + + @property + def output_keys(self) -> List[str]: + """Expect output key. + + :meta private: + """ + if not self.return_intermediate_steps: + return [self.output_key] + else: + return [self.output_key, "intermediate_steps"] + + def _construct_path(self, args: Dict[str, str]) -> str: + """Construct the path from the deserialized input.""" + path = self.api_operation.base_url + self.api_operation.path + for param in self.param_mapping.path_params: + path = path.replace(f"{{{param}}}", str(args.pop(param, ""))) + return path + + def _extract_query_params(self, args: Dict[str, str]) -> Dict[str, str]: + """Extract the query params from the deserialized input.""" + query_params = {} + for param in self.param_mapping.query_params: + if param in args: + query_params[param] = args.pop(param) + return query_params + + def _extract_body_params(self, args: Dict[str, str]) -> Optional[Dict[str, str]]: + """Extract the request body params from the deserialized input.""" + body_params = None + if self.param_mapping.body_params: + body_params = {} + for param in self.param_mapping.body_params: + if param in args: + body_params[param] = args.pop(param) + return body_params + + def deserialize_json_input(self, serialized_args: str) -> dict: + """Use the serialized typescript dictionary. + + Resolve the path, query params dict, and optional requestBody dict. + """ + args: dict = json.loads(serialized_args) + path = self._construct_path(args) + body_params = self._extract_body_params(args) + query_params = self._extract_query_params(args) + return { + "url": path, + "data": body_params, + "params": query_params, + } + + def _get_output(self, output: str, intermediate_steps: dict) -> dict: + """Return the output from the API call.""" + if self.return_intermediate_steps: + return { + self.output_key: output, + "intermediate_steps": intermediate_steps, + } + else: + return {self.output_key: output} + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, str]: + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + intermediate_steps = {} + instructions = inputs[self.instructions_key] + instructions = instructions[: self.max_text_length] + _api_arguments = self.api_request_chain.predict_and_parse( + instructions=instructions, callbacks=_run_manager.get_child() + ) + api_arguments = cast(str, _api_arguments) + intermediate_steps["request_args"] = api_arguments + _run_manager.on_text( + api_arguments, color="green", end="\n", verbose=self.verbose + ) + if api_arguments.startswith("ERROR"): + return self._get_output(api_arguments, intermediate_steps) + elif api_arguments.startswith("MESSAGE:"): + return self._get_output( + api_arguments[len("MESSAGE:") :], intermediate_steps + ) + try: + request_args = self.deserialize_json_input(api_arguments) + method = getattr(self.requests, self.api_operation.method.value) + api_response: Response = method(**request_args) + if api_response.status_code != 200: + method_str = str(self.api_operation.method.value) + response_text = ( + f"{api_response.status_code}: {api_response.reason}" + + f"\nFor {method_str.upper()} {request_args['url']}\n" + + f"Called with args: {request_args['params']}" + ) + else: + response_text = api_response.text + except Exception as e: + response_text = f"Error with message {str(e)}" + response_text = response_text[: self.max_text_length] + intermediate_steps["response_text"] = response_text + _run_manager.on_text( + response_text, color="blue", end="\n", verbose=self.verbose + ) + if self.api_response_chain is not None: + _answer = self.api_response_chain.predict_and_parse( + response=response_text, + instructions=instructions, + callbacks=_run_manager.get_child(), + ) + answer = cast(str, _answer) + _run_manager.on_text(answer, color="yellow", end="\n", verbose=self.verbose) + return self._get_output(answer, intermediate_steps) + else: + return self._get_output(response_text, intermediate_steps) + + @classmethod + def from_url_and_method( + cls, + spec_url: str, + path: str, + method: str, + llm: BaseLanguageModel, + requests: Optional[Requests] = None, + return_intermediate_steps: bool = False, + **kwargs: Any, + # TODO: Handle async + ) -> "OpenAPIEndpointChain": + """Create an OpenAPIEndpoint from a spec at the specified url.""" + operation = APIOperation.from_openapi_url(spec_url, path, method) + return cls.from_api_operation( + operation, + requests=requests, + llm=llm, + return_intermediate_steps=return_intermediate_steps, + **kwargs, + ) + + @classmethod + def from_api_operation( + cls, + operation: APIOperation, + llm: BaseLanguageModel, + requests: Optional[Requests] = None, + verbose: bool = False, + return_intermediate_steps: bool = False, + raw_response: bool = False, + callbacks: Callbacks = None, + **kwargs: Any, + # TODO: Handle async + ) -> "OpenAPIEndpointChain": + """Create an OpenAPIEndpointChain from an operation and a spec.""" + param_mapping = _ParamMapping( + query_params=operation.query_params, + body_params=operation.body_params, + path_params=operation.path_params, + ) + requests_chain = APIRequesterChain.from_llm_and_typescript( + llm, + typescript_definition=operation.to_typescript(), + verbose=verbose, + callbacks=callbacks, + ) + if raw_response: + response_chain = None + else: + response_chain = APIResponderChain.from_llm( + llm, verbose=verbose, callbacks=callbacks + ) + _requests = requests or Requests() + return cls( + api_request_chain=requests_chain, + api_response_chain=response_chain, + api_operation=operation, + requests=_requests, + param_mapping=param_mapping, + verbose=verbose, + return_intermediate_steps=return_intermediate_steps, + callbacks=callbacks, + **kwargs, + ) diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/prompts.py b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/prompts.py new file mode 100644 index 0000000000000000000000000000000000000000..84e5a2baee986bf3dc69d708bebe5c7e8a522ceb --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/prompts.py @@ -0,0 +1,57 @@ +# flake8: noqa +REQUEST_TEMPLATE = """You are a helpful AI Assistant. Please provide JSON arguments to agentFunc() based on the user's instructions. + +API_SCHEMA: ```typescript +{schema} +``` + +USER_INSTRUCTIONS: "{instructions}" + +Your arguments must be plain json provided in a markdown block: + +ARGS: ```json +{{valid json conforming to API_SCHEMA}} +``` + +Example +----- + +ARGS: ```json +{{"foo": "bar", "baz": {{"qux": "quux"}}}} +``` + +The block must be no more than 1 line long, and all arguments must be valid JSON. All string arguments must be wrapped in double quotes. +You MUST strictly comply to the types indicated by the provided schema, including all required args. + +If you don't have sufficient information to call the function due to things like requiring specific uuid's, you can reply with the following message: + +Message: ```text +Concise response requesting the additional information that would make calling the function successful. +``` + +Begin +----- +ARGS: +""" +RESPONSE_TEMPLATE = """You are a helpful AI assistant trained to answer user queries from API responses. +You attempted to call an API, which resulted in: +API_RESPONSE: {response} + +USER_COMMENT: "{instructions}" + + +If the API_RESPONSE can answer the USER_COMMENT respond with the following markdown json block: +Response: ```json +{{"response": "Human-understandable synthesis of the API_RESPONSE"}} +``` + +Otherwise respond with the following markdown json block: +Response Error: ```json +{{"response": "What you did and a concise statement of the resulting error. If it can be easily fixed, provide a suggestion."}} +``` + +You MUST respond as a markdown json code block. The person you are responding to CANNOT see the API_RESPONSE, so if there is any relevant information there you must include it in your response. + +Begin: +--- +""" diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/requests_chain.py b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/requests_chain.py new file mode 100644 index 0000000000000000000000000000000000000000..f6102f180f97e0744ccc7f8ae8fd4b7e8c2127d6 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/requests_chain.py @@ -0,0 +1,62 @@ +"""request parser.""" + +import json +import re +from typing import Any + +from langchain_classic.chains.api.openapi.prompts import REQUEST_TEMPLATE +from langchain_classic.chains.llm import LLMChain +from langchain_core.language_models import BaseLanguageModel +from langchain_core.output_parsers import BaseOutputParser +from langchain_core.prompts.prompt import PromptTemplate + + +class APIRequesterOutputParser(BaseOutputParser): + """Parse the request and error tags.""" + + def _load_json_block(self, serialized_block: str) -> str: + try: + return json.dumps(json.loads(serialized_block, strict=False)) + except json.JSONDecodeError: + return "ERROR serializing request." + + def parse(self, llm_output: str) -> str: + """Parse the request and error tags.""" + + json_match = re.search(r"```json(.*?)```", llm_output, re.DOTALL) + if json_match: + return self._load_json_block(json_match.group(1).strip()) + message_match = re.search(r"```text(.*?)```", llm_output, re.DOTALL) + if message_match: + return f"MESSAGE: {message_match.group(1).strip()}" + return "ERROR making request" + + @property + def _type(self) -> str: + return "api_requester" + + +class APIRequesterChain(LLMChain): + """Get the request parser.""" + + @classmethod + def is_lc_serializable(cls) -> bool: + return False + + @classmethod + def from_llm_and_typescript( + cls, + llm: BaseLanguageModel, + typescript_definition: str, + verbose: bool = True, + **kwargs: Any, + ) -> LLMChain: + """Get the request parser.""" + output_parser = APIRequesterOutputParser() + prompt = PromptTemplate( + template=REQUEST_TEMPLATE, + output_parser=output_parser, + partial_variables={"schema": typescript_definition}, + input_variables=["instructions"], + ) + return cls(prompt=prompt, llm=llm, verbose=verbose, **kwargs) diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/response_chain.py b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/response_chain.py new file mode 100644 index 0000000000000000000000000000000000000000..3c3ec0ac9ce8ae404e0c3ae22ee34636b9b44527 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/openapi/response_chain.py @@ -0,0 +1,57 @@ +"""Response parser.""" + +import json +import re +from typing import Any + +from langchain_classic.chains.api.openapi.prompts import RESPONSE_TEMPLATE +from langchain_classic.chains.llm import LLMChain +from langchain_core.language_models import BaseLanguageModel +from langchain_core.output_parsers import BaseOutputParser +from langchain_core.prompts.prompt import PromptTemplate + + +class APIResponderOutputParser(BaseOutputParser): + """Parse the response and error tags.""" + + def _load_json_block(self, serialized_block: str) -> str: + try: + response_content = json.loads(serialized_block, strict=False) + return response_content.get("response", "ERROR parsing response.") + except json.JSONDecodeError: + return "ERROR parsing response." + except: + raise + + def parse(self, llm_output: str) -> str: + """Parse the response and error tags.""" + json_match = re.search(r"```json(.*?)```", llm_output, re.DOTALL) + if json_match: + return self._load_json_block(json_match.group(1).strip()) + else: + raise ValueError(f"No response found in output: {llm_output}.") + + @property + def _type(self) -> str: + return "api_responder" + + +class APIResponderChain(LLMChain): + """Get the response parser.""" + + @classmethod + def is_lc_serializable(cls) -> bool: + return False + + @classmethod + def from_llm( + cls, llm: BaseLanguageModel, verbose: bool = True, **kwargs: Any + ) -> LLMChain: + """Get the response parser.""" + output_parser = APIResponderOutputParser() + prompt = PromptTemplate( + template=RESPONSE_TEMPLATE, + output_parser=output_parser, + input_variables=["response", "instructions"], + ) + return cls(prompt=prompt, llm=llm, verbose=verbose, **kwargs) diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d8efa73ca6d7ab28b55d2127025baad6a4eefe6c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f4c09b2dd6a93f3ac8b8b685fb17da93223ae203 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/enforcement_filters.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/enforcement_filters.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b86badef4b8f2ece9063586788ecf53777ddfed8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/enforcement_filters.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/models.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/models.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eabdb0df6a709cc8ba1924df0f48b11017730726 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/models.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/utilities.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/utilities.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..53d691157c5c43a3dc3d77402a218dd6209beb41 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/__pycache__/utilities.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/base.py b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/base.py new file mode 100644 index 0000000000000000000000000000000000000000..29ae7ba2a56ae3f834fedfb9883b0385d4f0d3f2 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/base.py @@ -0,0 +1,386 @@ +""" +Pebblo Retrieval Chain with Identity & Semantic Enforcement for question-answering +against a vector database. +""" + +import datetime +import inspect +import logging +from importlib.metadata import version +from typing import Any, Dict, List, Optional + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.combine_documents.base import BaseCombineDocumentsChain +from langchain_core.callbacks import ( + AsyncCallbackManagerForChainRun, + CallbackManagerForChainRun, +) +from langchain_core.documents import Document +from langchain_core.language_models import BaseLanguageModel +from langchain_core.vectorstores import VectorStoreRetriever +from pydantic import ConfigDict, Field, validator + +from langchain_community.chains.pebblo_retrieval.enforcement_filters import ( + SUPPORTED_VECTORSTORES, + set_enforcement_filters, +) +from langchain_community.chains.pebblo_retrieval.models import ( + App, + AuthContext, + ChainInfo, + Framework, + Model, + SemanticContext, + VectorDB, +) +from langchain_community.chains.pebblo_retrieval.utilities import ( + PLUGIN_VERSION, + PebbloRetrievalAPIWrapper, + get_runtime, +) + +logger = logging.getLogger(__name__) + + +class PebbloRetrievalQA(Chain): + """ + Retrieval Chain with Identity & Semantic Enforcement for question-answering + against a vector database. + """ + + combine_documents_chain: BaseCombineDocumentsChain + """Chain to use to combine the documents.""" + input_key: str = "query" #: :meta private: + output_key: str = "result" #: :meta private: + return_source_documents: bool = False + """Return the source documents or not.""" + + retriever: VectorStoreRetriever = Field(exclude=True) + """VectorStore to use for retrieval.""" + auth_context_key: str = "auth_context" #: :meta private: + """Authentication context for identity enforcement.""" + semantic_context_key: str = "semantic_context" #: :meta private: + """Semantic context for semantic enforcement.""" + app_name: str #: :meta private: + """App name.""" + owner: str #: :meta private: + """Owner of app.""" + description: str #: :meta private: + """Description of app.""" + api_key: Optional[str] = None #: :meta private: + """Pebblo cloud API key for app.""" + classifier_url: Optional[str] = None #: :meta private: + """Classifier endpoint.""" + classifier_location: str = "local" #: :meta private: + """Classifier location. It could be either of 'local' or 'pebblo-cloud'.""" + _discover_sent: bool = False #: :meta private: + """Flag to check if discover payload has been sent.""" + enable_prompt_gov: bool = True #: :meta private: + """Flag to check if prompt governance is enabled or not""" + pb_client: PebbloRetrievalAPIWrapper = Field( + default_factory=PebbloRetrievalAPIWrapper + ) + """Pebblo Retrieval API client""" + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, Any]: + """Run get_relevant_text and llm on input query. + + If chain has 'return_source_documents' as 'True', returns + the retrieved documents as well under the key 'source_documents'. + + Example: + .. code-block:: python + + res = indexqa({'query': 'This is my query'}) + answer, docs = res['result'], res['source_documents'] + """ + prompt_time = datetime.datetime.now().isoformat() + _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + question = inputs[self.input_key] + auth_context = inputs.get(self.auth_context_key) + semantic_context = inputs.get(self.semantic_context_key) + _, prompt_entities = self.pb_client.check_prompt_validity(question) + + accepts_run_manager = ( + "run_manager" in inspect.signature(self._get_docs).parameters + ) + if accepts_run_manager: + docs = self._get_docs( + question, auth_context, semantic_context, run_manager=_run_manager + ) + else: + docs = self._get_docs(question, auth_context, semantic_context) # type: ignore[call-arg] + answer = self.combine_documents_chain.run( + input_documents=docs, question=question, callbacks=_run_manager.get_child() + ) + + self.pb_client.send_prompt( + self.app_name, + self.retriever, + question, + answer, + auth_context, + docs, + prompt_entities, + prompt_time, + self.enable_prompt_gov, + ) + + if self.return_source_documents: + return {self.output_key: answer, "source_documents": docs} + else: + return {self.output_key: answer} + + async def _acall( + self, + inputs: Dict[str, Any], + run_manager: Optional[AsyncCallbackManagerForChainRun] = None, + ) -> Dict[str, Any]: + """Run get_relevant_text and llm on input query. + + If chain has 'return_source_documents' as 'True', returns + the retrieved documents as well under the key 'source_documents'. + + Example: + .. code-block:: python + + res = indexqa({'query': 'This is my query'}) + answer, docs = res['result'], res['source_documents'] + """ + prompt_time = datetime.datetime.now().isoformat() + _run_manager = run_manager or AsyncCallbackManagerForChainRun.get_noop_manager() + question = inputs[self.input_key] + auth_context = inputs.get(self.auth_context_key) + semantic_context = inputs.get(self.semantic_context_key) + accepts_run_manager = ( + "run_manager" in inspect.signature(self._aget_docs).parameters + ) + + _, prompt_entities = await self.pb_client.acheck_prompt_validity(question) + + if accepts_run_manager: + docs = await self._aget_docs( + question, auth_context, semantic_context, run_manager=_run_manager + ) + else: + docs = await self._aget_docs(question, auth_context, semantic_context) # type: ignore[call-arg] + answer = await self.combine_documents_chain.arun( + input_documents=docs, question=question, callbacks=_run_manager.get_child() + ) + + await self.pb_client.asend_prompt( + self.app_name, + self.retriever, + question, + answer, + auth_context, + docs, + prompt_entities, + prompt_time, + self.enable_prompt_gov, + ) + + if self.return_source_documents: + return {self.output_key: answer, "source_documents": docs} + else: + return {self.output_key: answer} + + model_config = ConfigDict( + populate_by_name=True, + arbitrary_types_allowed=True, + extra="forbid", + ) + + @property + def input_keys(self) -> List[str]: + """Input keys. + + :meta private: + """ + return [self.input_key, self.auth_context_key, self.semantic_context_key] + + @property + def output_keys(self) -> List[str]: + """Output keys. + + :meta private: + """ + _output_keys = [self.output_key] + if self.return_source_documents: + _output_keys += ["source_documents"] + return _output_keys + + @property + def _chain_type(self) -> str: + """Return the chain type.""" + return "pebblo_retrieval_qa" + + @classmethod + def from_chain_type( + cls, + llm: BaseLanguageModel, + app_name: str, + description: str, + owner: str, + chain_type: str = "stuff", + chain_type_kwargs: Optional[dict] = None, + api_key: Optional[str] = None, + classifier_url: Optional[str] = None, + classifier_location: str = "local", + **kwargs: Any, + ) -> "PebbloRetrievalQA": + """Load chain from chain type.""" + from langchain_classic.chains.question_answering import load_qa_chain + + _chain_type_kwargs = chain_type_kwargs or {} + combine_documents_chain = load_qa_chain( + llm, chain_type=chain_type, **_chain_type_kwargs + ) + + # generate app + app: App = PebbloRetrievalQA._get_app_details( + app_name=app_name, + description=description, + owner=owner, + llm=llm, + **kwargs, + ) + # initialize Pebblo API client + pb_client = PebbloRetrievalAPIWrapper( + api_key=api_key, + classifier_location=classifier_location, + classifier_url=classifier_url, + ) + # send app discovery request + pb_client.send_app_discover(app) + return cls( + combine_documents_chain=combine_documents_chain, + app_name=app_name, + owner=owner, + description=description, + api_key=api_key, + classifier_url=classifier_url, + classifier_location=classifier_location, + pb_client=pb_client, + **kwargs, + ) + + @validator("retriever", pre=True, always=True) + def validate_vectorstore( + cls, retriever: VectorStoreRetriever + ) -> VectorStoreRetriever: + """ + Validate that the vectorstore of the retriever is supported vectorstores. + """ + if retriever.vectorstore.__class__.__name__ not in SUPPORTED_VECTORSTORES: + raise ValueError( + f"Vectorstore must be an instance of one of the supported " + f"vectorstores: {SUPPORTED_VECTORSTORES}. " + f"Got '{retriever.vectorstore.__class__.__name__}' instead." + ) + return retriever + + def _get_docs( + self, + question: str, + auth_context: Optional[AuthContext], + semantic_context: Optional[SemanticContext], + *, + run_manager: CallbackManagerForChainRun, + ) -> List[Document]: + """Get docs.""" + set_enforcement_filters(self.retriever, auth_context, semantic_context) + return self.retriever.invoke( + question, config={"callbacks": run_manager.get_child()} + ) + + async def _aget_docs( + self, + question: str, + auth_context: Optional[AuthContext], + semantic_context: Optional[SemanticContext], + *, + run_manager: AsyncCallbackManagerForChainRun, + ) -> List[Document]: + """Get docs.""" + set_enforcement_filters(self.retriever, auth_context, semantic_context) + return await self.retriever.ainvoke( + question, config={"callbacks": run_manager.get_child()} + ) + + @staticmethod + def _get_app_details( + app_name: str, + owner: str, + description: str, + llm: BaseLanguageModel, + **kwargs: Any, + ) -> App: + """Fetch app details. Internal method. + Returns: + App: App details. + """ + framework, runtime = get_runtime() + chains = PebbloRetrievalQA.get_chain_details(llm, **kwargs) + app = App( + name=app_name, + owner=owner, + description=description, + runtime=runtime, + framework=framework, + chains=chains, + plugin_version=PLUGIN_VERSION, + client_version=Framework( + name="langchain_community", + version=version("langchain_community"), + ), + ) + return app + + @classmethod + def set_discover_sent(cls) -> None: + cls._discover_sent = True + + @classmethod + def get_chain_details( + cls, llm: BaseLanguageModel, **kwargs: Any + ) -> List[ChainInfo]: + """ + Get chain details. + + Args: + llm (BaseLanguageModel): Language model instance. + **kwargs: Additional keyword arguments. + + Returns: + List[ChainInfo]: Chain details. + """ + llm_dict = llm.__dict__ + chains = [ + ChainInfo( + name=cls.__name__, + model=Model( + name=llm_dict.get("model_name", llm_dict.get("model")), + vendor=llm.__class__.__name__, + ), + vector_dbs=[ + VectorDB( + name=kwargs["retriever"].vectorstore.__class__.__name__, + embedding_model=str( + kwargs["retriever"].vectorstore._embeddings.model + ) + if hasattr(kwargs["retriever"].vectorstore, "_embeddings") + else ( + str(kwargs["retriever"].vectorstore._embedding.model) + if hasattr(kwargs["retriever"].vectorstore, "_embedding") + else None + ), + ) + ], + ), + ] + return chains diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/enforcement_filters.py b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/enforcement_filters.py new file mode 100644 index 0000000000000000000000000000000000000000..579b86acb0ebc15c2bf6e2f0ee291d341379e5b6 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/enforcement_filters.py @@ -0,0 +1,532 @@ +""" +Identity & Semantic Enforcement filters for PebbloRetrievalQA chain: + +This module contains methods for applying Identity and Semantic Enforcement filters +in the PebbloRetrievalQA chain. +These filters are used to control the retrieval of documents based on authorization and +semantic context. +The Identity Enforcement filter ensures that only authorized identities can access +certain documents, while the Semantic Enforcement filter controls document retrieval +based on semantic context. + +The methods in this module are designed to work with different types of vector stores. +""" + +import logging +from typing import Any, List, Optional, Union + +from langchain_core.vectorstores import VectorStoreRetriever + +from langchain_community.chains.pebblo_retrieval.models import ( + AuthContext, + SemanticContext, +) + +logger = logging.getLogger(__name__) + +PINECONE = "Pinecone" +QDRANT = "Qdrant" +PGVECTOR = "PGVector" +PINECONE_VECTOR_STORE = "PineconeVectorStore" + +SUPPORTED_VECTORSTORES = {PINECONE, QDRANT, PGVECTOR, PINECONE_VECTOR_STORE} + + +def clear_enforcement_filters(retriever: VectorStoreRetriever) -> None: + """ + Clear the identity and semantic enforcement filters in the retriever search_kwargs. + """ + if retriever.vectorstore.__class__.__name__ == PGVECTOR: + search_kwargs = retriever.search_kwargs + if "filter" in search_kwargs: + filters = search_kwargs["filter"] + _pgvector_clear_pebblo_filters( + search_kwargs, filters, "authorized_identities" + ) + _pgvector_clear_pebblo_filters( + search_kwargs, filters, "pebblo_semantic_topics" + ) + _pgvector_clear_pebblo_filters( + search_kwargs, filters, "pebblo_semantic_entities" + ) + + +def set_enforcement_filters( + retriever: VectorStoreRetriever, + auth_context: Optional[AuthContext], + semantic_context: Optional[SemanticContext], +) -> None: + """ + Set identity and semantic enforcement filters in the retriever. + """ + # Clear existing enforcement filters + clear_enforcement_filters(retriever) + if auth_context is not None: + _set_identity_enforcement_filter(retriever, auth_context) + if semantic_context is not None: + _set_semantic_enforcement_filter(retriever, semantic_context) + + +def _apply_qdrant_semantic_filter( + search_kwargs: dict, semantic_context: Optional[SemanticContext] +) -> None: + """ + Set semantic enforcement filter in search_kwargs for Qdrant vectorstore. + """ + try: + from qdrant_client.http import models as rest + except ImportError as e: + raise ValueError( + "Could not import `qdrant-client.http` python package. " + "Please install it with `pip install qdrant-client`." + ) from e + + # Create a semantic enforcement filter condition + semantic_filters: List[ + Union[ + rest.FieldCondition, + rest.IsEmptyCondition, + rest.IsNullCondition, + rest.HasIdCondition, + rest.NestedCondition, + rest.Filter, + ] + ] = [] + + if ( + semantic_context is not None + and semantic_context.pebblo_semantic_topics is not None + ): + semantic_topics_filter = rest.FieldCondition( + key="metadata.pebblo_semantic_topics", + match=rest.MatchAny(any=semantic_context.pebblo_semantic_topics.deny), + ) + semantic_filters.append(semantic_topics_filter) + if ( + semantic_context is not None + and semantic_context.pebblo_semantic_entities is not None + ): + semantic_entities_filter = rest.FieldCondition( + key="metadata.pebblo_semantic_entities", + match=rest.MatchAny(any=semantic_context.pebblo_semantic_entities.deny), + ) + semantic_filters.append(semantic_entities_filter) + + # If 'filter' already exists in search_kwargs + if "filter" in search_kwargs: + existing_filter: rest.Filter = search_kwargs["filter"] + + # Check if existing_filter is a qdrant-client filter + if isinstance(existing_filter, rest.Filter): + # If 'must_not' condition exists in the existing filter + if isinstance(existing_filter.must_not, list): + # Warn if 'pebblo_semantic_topics' or 'pebblo_semantic_entities' + # filter is overridden + new_must_not_conditions: List[ + Union[ + rest.FieldCondition, + rest.IsEmptyCondition, + rest.IsNullCondition, + rest.HasIdCondition, + rest.NestedCondition, + rest.Filter, + ] + ] = [] + # Drop semantic filter conditions if already present + for condition in existing_filter.must_not: + if hasattr(condition, "key"): + if condition.key == "metadata.pebblo_semantic_topics": + continue + if condition.key == "metadata.pebblo_semantic_entities": + continue + new_must_not_conditions.append(condition) + # Add semantic enforcement filters to 'must_not' conditions + existing_filter.must_not = new_must_not_conditions + existing_filter.must_not.extend(semantic_filters) + else: + # Set 'must_not' condition with semantic enforcement filters + existing_filter.must_not = semantic_filters + else: + raise TypeError( + "Using dict as a `filter` is deprecated. " + "Please use qdrant-client filters directly: " + "https://qdrant.tech/documentation/concepts/filtering/" + ) + else: + # If 'filter' does not exist in search_kwargs, create it + search_kwargs["filter"] = rest.Filter(must_not=semantic_filters) + + +def _apply_qdrant_authorization_filter( + search_kwargs: dict, auth_context: Optional[AuthContext] +) -> None: + """ + Set identity enforcement filter in search_kwargs for Qdrant vectorstore. + """ + try: + from qdrant_client.http import models as rest + except ImportError as e: + raise ValueError( + "Could not import `qdrant-client.http` python package. " + "Please install it with `pip install qdrant-client`." + ) from e + + if auth_context is not None: + # Create a identity enforcement filter condition + identity_enforcement_filter = rest.FieldCondition( + key="metadata.authorized_identities", + match=rest.MatchAny(any=auth_context.user_auth), + ) + else: + return + + # If 'filter' already exists in search_kwargs + if "filter" in search_kwargs: + existing_filter: rest.Filter = search_kwargs["filter"] + + # Check if existing_filter is a qdrant-client filter + if isinstance(existing_filter, rest.Filter): + # If 'must' exists in the existing filter + if existing_filter.must: + new_must_conditions: List[ + Union[ + rest.FieldCondition, + rest.IsEmptyCondition, + rest.IsNullCondition, + rest.HasIdCondition, + rest.NestedCondition, + rest.Filter, + ] + ] = [] + # Drop 'authorized_identities' filter condition if already present + for condition in existing_filter.must: + if ( + hasattr(condition, "key") + and condition.key == "metadata.authorized_identities" + ): + continue + new_must_conditions.append(condition) + + # Add identity enforcement filter to 'must' conditions + existing_filter.must = new_must_conditions + existing_filter.must.append(identity_enforcement_filter) + else: + # Set 'must' condition with identity enforcement filter + existing_filter.must = [identity_enforcement_filter] + else: + raise TypeError( + "Using dict as a `filter` is deprecated. " + "Please use qdrant-client filters directly: " + "https://qdrant.tech/documentation/concepts/filtering/" + ) + else: + # If 'filter' does not exist in search_kwargs, create it + search_kwargs["filter"] = rest.Filter(must=[identity_enforcement_filter]) + + +def _apply_pinecone_semantic_filter( + search_kwargs: dict, semantic_context: Optional[SemanticContext] +) -> None: + """ + Set semantic enforcement filter in search_kwargs for Pinecone vectorstore. + """ + # Check if semantic_context is provided + semantic_context = semantic_context + if semantic_context is not None: + if semantic_context.pebblo_semantic_topics is not None: + # Add pebblo_semantic_topics filter to search_kwargs + search_kwargs.setdefault("filter", {})["pebblo_semantic_topics"] = { + "$nin": semantic_context.pebblo_semantic_topics.deny + } + + if semantic_context.pebblo_semantic_entities is not None: + # Add pebblo_semantic_entities filter to search_kwargs + search_kwargs.setdefault("filter", {})["pebblo_semantic_entities"] = { + "$nin": semantic_context.pebblo_semantic_entities.deny + } + + +def _apply_pinecone_authorization_filter( + search_kwargs: dict, auth_context: Optional[AuthContext] +) -> None: + """ + Set identity enforcement filter in search_kwargs for Pinecone vectorstore. + """ + if auth_context is not None: + search_kwargs.setdefault("filter", {})["authorized_identities"] = { + "$in": auth_context.user_auth + } + + +def _apply_pgvector_filter( + search_kwargs: dict, filters: Optional[Any], pebblo_filter: dict +) -> None: + """ + Apply pebblo filters in the search_kwargs filters. + """ + if isinstance(filters, dict): + if len(filters) == 1: + # The only operators allowed at the top level are $and, $or, and $not + # First check if an operator or a field + key, value = list(filters.items())[0] + if key.startswith("$"): + # Then it's an operator + if key.lower() not in ["$and", "$or", "$not"]: + raise ValueError( + f"Invalid filter condition. Expected $and, $or or $not " + f"but got: {key}" + ) + if not isinstance(value, list): + raise ValueError( + f"Expected a list, but got {type(value)} for value: {value}" + ) + + # Here we handle the $and, $or, and $not operators(Semantic filters) + if key.lower() == "$and": + # Add pebblo_filter to the $and list as it is + value.append(pebblo_filter) + elif key.lower() == "$not": + # Check if pebblo_filter is an operator or a field + _key, _value = list(pebblo_filter.items())[0] + if _key.startswith("$"): + # Then it's a operator + if _key.lower() == "$not": + # It's Semantic filter, add it's value to filters + value.append(_value) + logger.warning( + "Adding $not operator to the existing $not operator" + ) + return + else: + # Only $not operator is supported in pebblo_filter + raise ValueError( + f"Invalid filter key. Expected '$not' but got: {_key}" + ) + else: + # Then it's a field(Auth filter), move filters into $and + search_kwargs["filter"] = {"$and": [filters, pebblo_filter]} + return + elif key.lower() == "$or": + search_kwargs["filter"] = {"$and": [filters, pebblo_filter]} + else: + # Then it's a field and we can check pebblo_filter now + # Check if pebblo_filter is an operator or a field + _key, _ = list(pebblo_filter.items())[0] + if _key.startswith("$"): + # Then it's a operator + if _key.lower() == "$not": + # It's a $not operator(Semantic filter), move filters into $and + search_kwargs["filter"] = {"$and": [filters, pebblo_filter]} + return + else: + # Only $not operator is allowed in pebblo_filter + raise ValueError( + f"Invalid filter key. Expected '$not' but got: {_key}" + ) + else: + # Then it's a field(This handles Auth filter) + filters.update(pebblo_filter) + return + elif len(filters) > 1: + # Then all keys have to be fields (they cannot be operators) + for key in filters.keys(): + if key.startswith("$"): + raise ValueError( + f"Invalid filter condition. Expected a field but got: {key}" + ) + # filters should all be fields and we can check pebblo_filter now + # Check if pebblo_filter is an operator or a field + _key, _ = list(pebblo_filter.items())[0] + if _key.startswith("$"): + # Then it's a operator + if _key.lower() == "$not": + # It's a $not operator(Semantic filter), move filters into '$and' + search_kwargs["filter"] = {"$and": [filters, pebblo_filter]} + return + else: + # Only $not operator is supported in pebblo_filter + raise ValueError( + f"Invalid filter key. Expected '$not' but got: {_key}" + ) + else: + # Then it's a field(This handles Auth filter) + filters.update(pebblo_filter) + return + else: + # Got an empty dictionary for filters, set pebblo_filter in filter + search_kwargs.setdefault("filter", {}).update(pebblo_filter) + elif filters is None: + # If filters is None, set pebblo_filter as a new filter + search_kwargs.setdefault("filter", {}).update(pebblo_filter) + else: + raise ValueError( + f"Invalid filter. Expected a dictionary/None but got type: {type(filters)}" + ) + + +def _pgvector_clear_pebblo_filters( + search_kwargs: dict, filters: dict, pebblo_filter_key: str +) -> None: + """ + Remove pebblo filters from the search_kwargs filters. + """ + if isinstance(filters, dict): + if len(filters) == 1: + # The only operators allowed at the top level are $and, $or, and $not + # First check if an operator or a field + key, value = list(filters.items())[0] + if key.startswith("$"): + # Then it's an operator + # Validate the operator's key and value type + if key.lower() not in ["$and", "$or", "$not"]: + raise ValueError( + f"Invalid filter condition. Expected $and, $or or $not " + f"but got: {key}" + ) + elif not isinstance(value, list): + raise ValueError( + f"Expected a list, but got {type(value)} for value: {value}" + ) + + # Here we handle the $and, $or, and $not operators + if key.lower() == "$and": + # Remove the pebblo filter from the $and list + for i, _filter in enumerate(value): + if pebblo_filter_key in _filter: + # This handles Auth filter + value.pop(i) + break + # Check for $not operator with Semantic filter + if "$not" in _filter: + sem_filter_found = False + # This handles Semantic filter + for j, nested_filter in enumerate(_filter["$not"]): + if pebblo_filter_key in nested_filter: + if len(_filter["$not"]) == 1: + # If only one filter is left, + # then remove the $not operator + value.pop(i) + else: + value[i]["$not"].pop(j) + sem_filter_found = True + break + if sem_filter_found: + break + if len(value) == 1: + # If only one filter is left, then remove the $and operator + search_kwargs["filter"] = value[0] + elif key.lower() == "$not": + # Remove the pebblo filter from the $not list + for i, _filter in enumerate(value): + if pebblo_filter_key in _filter: + # This removes Semantic filter + value.pop(i) + break + if len(value) == 0: + # If no filter is left, then unset the filter + search_kwargs["filter"] = {} + elif key.lower() == "$or": + # If $or, pebblo filter will not be present + return + else: + # Then it's a field, check if it's a pebblo filter + if key == pebblo_filter_key: + filters.pop(key) + return + elif len(filters) > 1: + # Then all keys have to be fields (they cannot be operators) + if pebblo_filter_key in filters: + # This handles Auth filter + filters.pop(pebblo_filter_key) + return + else: + # Got an empty dictionary for filters, ignore the filter + return + elif filters is None: + # If filters is None, ignore the filter + return + else: + raise ValueError( + f"Invalid filter. Expected a dictionary/None but got type: {type(filters)}" + ) + + +def _apply_pgvector_semantic_filter( + search_kwargs: dict, semantic_context: Optional[SemanticContext] +) -> None: + """ + Set semantic enforcement filter in search_kwargs for PGVector vectorstore. + """ + # Check if semantic_context is provided + if semantic_context is not None: + _semantic_filters = [] + filters = search_kwargs.get("filter") + if semantic_context.pebblo_semantic_topics is not None: + # Add pebblo_semantic_topics filter to search_kwargs + topic_filter: dict = { + "pebblo_semantic_topics": { + "$eq": semantic_context.pebblo_semantic_topics.deny + } + } + _semantic_filters.append(topic_filter) + + if semantic_context.pebblo_semantic_entities is not None: + # Add pebblo_semantic_entities filter to search_kwargs + entity_filter: dict = { + "pebblo_semantic_entities": { + "$eq": semantic_context.pebblo_semantic_entities.deny + } + } + _semantic_filters.append(entity_filter) + + if len(_semantic_filters) > 0: + semantic_filter: dict = {"$not": _semantic_filters} + _apply_pgvector_filter(search_kwargs, filters, semantic_filter) + + +def _apply_pgvector_authorization_filter( + search_kwargs: dict, auth_context: Optional[AuthContext] +) -> None: + """ + Set identity enforcement filter in search_kwargs for PGVector vectorstore. + """ + if auth_context is not None: + auth_filter: dict = {"authorized_identities": {"$eq": auth_context.user_auth}} + filters = search_kwargs.get("filter") + _apply_pgvector_filter(search_kwargs, filters, auth_filter) + + +def _set_identity_enforcement_filter( + retriever: VectorStoreRetriever, auth_context: Optional[AuthContext] +) -> None: + """ + Set identity enforcement filter in search_kwargs. + + This method sets the identity enforcement filter in the search_kwargs + of the retriever based on the type of the vectorstore. + """ + search_kwargs = retriever.search_kwargs + if retriever.vectorstore.__class__.__name__ in [PINECONE, PINECONE_VECTOR_STORE]: + _apply_pinecone_authorization_filter(search_kwargs, auth_context) + elif retriever.vectorstore.__class__.__name__ == QDRANT: + _apply_qdrant_authorization_filter(search_kwargs, auth_context) + elif retriever.vectorstore.__class__.__name__ == PGVECTOR: + _apply_pgvector_authorization_filter(search_kwargs, auth_context) + + +def _set_semantic_enforcement_filter( + retriever: VectorStoreRetriever, semantic_context: Optional[SemanticContext] +) -> None: + """ + Set semantic enforcement filter in search_kwargs. + + This method sets the semantic enforcement filter in the search_kwargs + of the retriever based on the type of the vectorstore. + """ + search_kwargs = retriever.search_kwargs + if retriever.vectorstore.__class__.__name__ == PINECONE: + _apply_pinecone_semantic_filter(search_kwargs, semantic_context) + elif retriever.vectorstore.__class__.__name__ == QDRANT: + _apply_qdrant_semantic_filter(search_kwargs, semantic_context) + elif retriever.vectorstore.__class__.__name__ == PGVECTOR: + _apply_pgvector_semantic_filter(search_kwargs, semantic_context) diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/models.py b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/models.py new file mode 100644 index 0000000000000000000000000000000000000000..97e29769ced6f65034ecbc7f0896d2fa77fd482b --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/models.py @@ -0,0 +1,151 @@ +"""Models for the PebbloRetrievalQA chain.""" + +from typing import Any, List, Optional, Union + +from pydantic import BaseModel + + +class AuthContext(BaseModel): + """Class for an authorization context.""" + + name: Optional[str] = None + user_id: str + user_auth: List[str] + """List of user authorizations, which may include their User ID and + the groups they are part of""" + + +class SemanticEntities(BaseModel): + """Class for a semantic entity filter.""" + + deny: List[str] + + +class SemanticTopics(BaseModel): + """Class for a semantic topic filter.""" + + deny: List[str] + + +class SemanticContext(BaseModel): + """Class for a semantic context.""" + + pebblo_semantic_entities: Optional[SemanticEntities] = None + pebblo_semantic_topics: Optional[SemanticTopics] = None + + def __init__(self, **data: Any) -> None: + super().__init__(**data) + + # Validate semantic_context + if ( + self.pebblo_semantic_entities is None + and self.pebblo_semantic_topics is None + ): + raise ValueError( + "semantic_context must contain 'pebblo_semantic_entities' or " + "'pebblo_semantic_topics'" + ) + + +class ChainInput(BaseModel): + """Input for PebbloRetrievalQA chain.""" + + query: str + auth_context: Optional[AuthContext] = None + semantic_context: Optional[SemanticContext] = None + + def dict(self, **kwargs: Any) -> dict: + base_dict = super().dict(**kwargs) + # Keep auth_context and semantic_context as it is(Pydantic models) + base_dict["auth_context"] = self.auth_context + base_dict["semantic_context"] = self.semantic_context + return base_dict + + +class Runtime(BaseModel): + """ + OS, language details + """ + + type: Optional[str] = "" + host: str + path: str + ip: Optional[str] = "" + platform: str + os: str + os_version: str + language: str + language_version: str + runtime: Optional[str] = "" + + +class Framework(BaseModel): + """ + Langchain framework details + """ + + name: str + version: str + + +class Model(BaseModel): + vendor: Optional[str] + name: Optional[str] + + +class PkgInfo(BaseModel): + project_home_page: Optional[str] + documentation_url: Optional[str] + pypi_url: Optional[str] + liscence_type: Optional[str] + installed_via: Optional[str] + location: Optional[str] + + +class VectorDB(BaseModel): + name: Optional[str] = None + version: Optional[str] = None + location: Optional[str] = None + embedding_model: Optional[str] = None + + +class ChainInfo(BaseModel): + name: str + model: Optional[Model] + vector_dbs: Optional[List[VectorDB]] + + +class App(BaseModel): + name: str + owner: str + description: Optional[str] + runtime: Runtime + framework: Framework + chains: List[ChainInfo] + plugin_version: str + client_version: Framework + + +class Context(BaseModel): + retrieved_from: Optional[str] + doc: Optional[str] + vector_db: str + pb_checksum: Optional[str] + + +class Prompt(BaseModel): + data: Optional[Union[list, str]] + entityCount: Optional[int] = None + entities: Optional[dict] = None + prompt_gov_enabled: Optional[bool] = None + + +class Qa(BaseModel): + name: str + context: Union[List[Optional[Context]], Optional[Context]] + prompt: Optional[Prompt] + response: Optional[Prompt] + prompt_time: str + user: str + user_identities: Optional[List[str]] + classifier_location: str diff --git a/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/utilities.py b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/utilities.py new file mode 100644 index 0000000000000000000000000000000000000000..25f6efe1542c40802b62d85941a8443f4d98e9b1 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/chains/pebblo_retrieval/utilities.py @@ -0,0 +1,542 @@ +import json +import logging +import os +import platform +from enum import Enum +from http import HTTPStatus +from typing import Any, Dict, List, Optional, Tuple + +import aiohttp +from aiohttp import ClientTimeout +from langchain_core.documents import Document +from langchain_core.env import get_runtime_environment +from langchain_core.utils import get_from_dict_or_env +from langchain_core.vectorstores import VectorStoreRetriever +from pydantic import BaseModel +from requests import Response, request +from requests.exceptions import RequestException + +from langchain_community.chains.pebblo_retrieval.models import ( + App, + AuthContext, + Context, + Framework, + Prompt, + Qa, + Runtime, +) + +logger = logging.getLogger(__name__) + +PLUGIN_VERSION = "0.1.1" + +_DEFAULT_CLASSIFIER_URL = "http://localhost:8000" +_DEFAULT_PEBBLO_CLOUD_URL = "https://api.daxa.ai" + + +class Routes(str, Enum): + """Routes available for the Pebblo API as enumerator.""" + + retrieval_app_discover = "/v1/app/discover" + prompt = "/v1/prompt" + prompt_governance = "/v1/prompt/governance" + + +def get_runtime() -> Tuple[Framework, Runtime]: + """Fetch the current Framework and Runtime details. + + Returns: + Tuple[Framework, Runtime]: Framework and Runtime for the current app instance. + """ + runtime_env = get_runtime_environment() + framework = Framework( + name="langchain", version=runtime_env.get("library_version", "unknown") + ) + uname = platform.uname() + runtime = Runtime( + host=uname.node, + path=os.environ["PWD"], + platform=runtime_env.get("platform", "unknown"), + os=uname.system, + os_version=uname.version, + ip=get_ip(), + language=runtime_env.get("runtime", "unknown"), + language_version=runtime_env.get("runtime_version", "unknown"), + ) + + if "Darwin" in runtime.os: + runtime.type = "desktop" + runtime.runtime = "Mac OSX" + + logger.debug(f"framework {framework}") + logger.debug(f"runtime {runtime}") + return framework, runtime + + +def get_ip() -> str: + """Fetch local runtime ip address. + + Returns: + str: IP address + """ + import socket # lazy imports + + host = socket.gethostname() + try: + public_ip = socket.gethostbyname(host) + except Exception: + public_ip = socket.gethostbyname("localhost") + return public_ip + + +class PebbloRetrievalAPIWrapper(BaseModel): + """Wrapper for Pebblo Retrieval API.""" + + api_key: Optional[str] # Use SecretStr + """API key for Pebblo Cloud""" + classifier_location: str = "local" + """Location of the classifier, local or cloud. Defaults to 'local'""" + classifier_url: Optional[str] + """URL of the Pebblo Classifier""" + cloud_url: Optional[str] + """URL of the Pebblo Cloud""" + + def __init__(self, **kwargs: Any): + """Validate that api key in environment.""" + kwargs["api_key"] = get_from_dict_or_env( + kwargs, "api_key", "PEBBLO_API_KEY", "" + ) + kwargs["classifier_url"] = get_from_dict_or_env( + kwargs, "classifier_url", "PEBBLO_CLASSIFIER_URL", _DEFAULT_CLASSIFIER_URL + ) + kwargs["cloud_url"] = get_from_dict_or_env( + kwargs, "cloud_url", "PEBBLO_CLOUD_URL", _DEFAULT_PEBBLO_CLOUD_URL + ) + super().__init__(**kwargs) + + def send_app_discover(self, app: App) -> None: + """ + Send app discovery request to Pebblo server & cloud. + + Args: + app (App): App instance to be discovered. + """ + pebblo_resp = None + payload = app.dict(exclude_unset=True) + + if self.classifier_location == "local": + # Send app details to local classifier + headers = self._make_headers() + app_discover_url = ( + f"{self.classifier_url}{Routes.retrieval_app_discover.value}" + ) + pebblo_resp = self.make_request("POST", app_discover_url, headers, payload) + + if self.api_key: + # Send app details to Pebblo cloud if api_key is present + headers = self._make_headers(cloud_request=True) + if pebblo_resp: + pebblo_server_version = json.loads(pebblo_resp.text).get( + "pebblo_server_version" + ) + payload.update({"pebblo_server_version": pebblo_server_version}) + + payload.update({"pebblo_client_version": PLUGIN_VERSION}) + pebblo_cloud_url = f"{self.cloud_url}{Routes.retrieval_app_discover.value}" + _ = self.make_request("POST", pebblo_cloud_url, headers, payload) + + def send_prompt( + self, + app_name: str, + retriever: VectorStoreRetriever, + question: str, + answer: str, + auth_context: Optional[AuthContext], + docs: List[Document], + prompt_entities: Dict[str, Any], + prompt_time: str, + prompt_gov_enabled: bool = False, + ) -> None: + """ + Send prompt to Pebblo server for classification. + Then send prompt to Daxa cloud(If api_key is present). + + Args: + app_name (str): Name of the app. + retriever (VectorStoreRetriever): Retriever instance. + question (str): Question asked in the prompt. + answer (str): Answer generated by the model. + auth_context (Optional[AuthContext]): Authentication context. + docs (List[Document]): List of documents retrieved. + prompt_entities (Dict[str, Any]): Entities present in the prompt. + prompt_time (str): Time when the prompt was generated. + prompt_gov_enabled (bool): Whether prompt governance is enabled. + """ + pebblo_resp = None + payload = self.build_prompt_qa_payload( + app_name, + retriever, + question, + answer, + auth_context, + docs, + prompt_entities, + prompt_time, + prompt_gov_enabled, + ) + + if self.classifier_location == "local": + # Send prompt to local classifier + headers = self._make_headers() + prompt_url = f"{self.classifier_url}{Routes.prompt.value}" + pebblo_resp = self.make_request("POST", prompt_url, headers, payload) + + if self.api_key: + # Send prompt to Pebblo cloud if api_key is present + if self.classifier_location == "local": + # If classifier location is local, then response, context and prompt + # should be fetched from pebblo_resp and replaced in payload. + pebblo_resp = pebblo_resp.json() if pebblo_resp else None + self.update_cloud_payload(payload, pebblo_resp) + + headers = self._make_headers(cloud_request=True) + pebblo_cloud_prompt_url = f"{self.cloud_url}{Routes.prompt.value}" + _ = self.make_request("POST", pebblo_cloud_prompt_url, headers, payload) + elif self.classifier_location == "pebblo-cloud": + logger.warning("API key is missing for sending prompt to Pebblo cloud.") + raise NameError("API key is missing for sending prompt to Pebblo cloud.") + + async def asend_prompt( + self, + app_name: str, + retriever: VectorStoreRetriever, + question: str, + answer: str, + auth_context: Optional[AuthContext], + docs: List[Document], + prompt_entities: Dict[str, Any], + prompt_time: str, + prompt_gov_enabled: bool = False, + ) -> None: + """ + Send prompt to Pebblo server for classification. + Then send prompt to Daxa cloud(If api_key is present). + + Args: + app_name (str): Name of the app. + retriever (VectorStoreRetriever): Retriever instance. + question (str): Question asked in the prompt. + answer (str): Answer generated by the model. + auth_context (Optional[AuthContext]): Authentication context. + docs (List[Document]): List of documents retrieved. + prompt_entities (Dict[str, Any]): Entities present in the prompt. + prompt_time (str): Time when the prompt was generated. + prompt_gov_enabled (bool): Whether prompt governance is enabled. + """ + pebblo_resp = None + payload = self.build_prompt_qa_payload( + app_name, + retriever, + question, + answer, + auth_context, + docs, + prompt_entities, + prompt_time, + prompt_gov_enabled, + ) + + if self.classifier_location == "local": + # Send prompt to local classifier + headers = self._make_headers() + prompt_url = f"{self.classifier_url}{Routes.prompt.value}" + pebblo_resp = await self.amake_request("POST", prompt_url, headers, payload) + + if self.api_key: + # Send prompt to Pebblo cloud if api_key is present + if self.classifier_location == "local": + # If classifier location is local, then response, context and prompt + # should be fetched from pebblo_resp and replaced in payload. + self.update_cloud_payload(payload, pebblo_resp) + + headers = self._make_headers(cloud_request=True) + pebblo_cloud_prompt_url = f"{self.cloud_url}{Routes.prompt.value}" + _ = await self.amake_request( + "POST", pebblo_cloud_prompt_url, headers, payload + ) + elif self.classifier_location == "pebblo-cloud": + logger.warning("API key is missing for sending prompt to Pebblo cloud.") + raise NameError("API key is missing for sending prompt to Pebblo cloud.") + + def check_prompt_validity(self, question: str) -> Tuple[bool, Dict[str, Any]]: + """ + Check the validity of the given prompt using a remote classification service. + + This method sends a prompt to a remote classifier service and return entities + present in prompt or not. + + Args: + question (str): The prompt question to be validated. + + Returns: + bool: True if the prompt is valid (does not contain deny list entities), + False otherwise. + dict: The entities present in the prompt + """ + prompt_payload = {"prompt": question} + prompt_entities: dict = {"entities": {}, "entityCount": 0} + is_valid_prompt: bool = True + if self.classifier_location == "local": + headers = self._make_headers() + prompt_gov_api_url = ( + f"{self.classifier_url}{Routes.prompt_governance.value}" + ) + pebblo_resp = self.make_request( + "POST", prompt_gov_api_url, headers, prompt_payload + ) + if pebblo_resp: + prompt_entities["entities"] = pebblo_resp.json().get("entities", {}) + prompt_entities["entityCount"] = pebblo_resp.json().get( + "entityCount", 0 + ) + return is_valid_prompt, prompt_entities + + async def acheck_prompt_validity( + self, question: str + ) -> Tuple[bool, Dict[str, Any]]: + """ + Check the validity of the given prompt using a remote classification service. + + This method sends a prompt to a remote classifier service and return entities + present in prompt or not. + + Args: + question (str): The prompt question to be validated. + + Returns: + bool: True if the prompt is valid (does not contain deny list entities), + False otherwise. + dict: The entities present in the prompt + """ + prompt_payload = {"prompt": question} + prompt_entities: dict = {"entities": {}, "entityCount": 0} + is_valid_prompt: bool = True + if self.classifier_location == "local": + headers = self._make_headers() + prompt_gov_api_url = ( + f"{self.classifier_url}{Routes.prompt_governance.value}" + ) + pebblo_resp = await self.amake_request( + "POST", prompt_gov_api_url, headers, prompt_payload + ) + if pebblo_resp: + prompt_entities["entities"] = pebblo_resp.get("entities", {}) + prompt_entities["entityCount"] = pebblo_resp.get("entityCount", 0) + return is_valid_prompt, prompt_entities + + def _make_headers(self, cloud_request: bool = False) -> dict: + """ + Generate headers for the request. + + args: + cloud_request (bool): flag indicating whether the request is for Pebblo + cloud. + returns: + dict: Headers for the request. + + """ + headers = { + "Accept": "application/json", + "Content-Type": "application/json", + } + if cloud_request: + # Add API key for Pebblo cloud request + if self.api_key: + headers.update({"x-api-key": self.api_key}) + else: + logger.warning("API key is missing for Pebblo cloud request.") + return headers + + @staticmethod + def make_request( + method: str, + url: str, + headers: dict, + payload: Optional[dict] = None, + timeout: int = 20, + ) -> Optional[Response]: + """ + Make a request to the Pebblo server/cloud API. + + Args: + method (str): HTTP method (GET, POST, PUT, DELETE, etc.). + url (str): URL for the request. + headers (dict): Headers for the request. + payload (Optional[dict]): Payload for the request (for POST, PUT, etc.). + timeout (int): Timeout for the request in seconds. + + Returns: + Optional[Response]: Response object if the request is successful. + """ + try: + response = request( + method=method, url=url, headers=headers, json=payload, timeout=timeout + ) + logger.debug( + "Request: method %s, url %s, len %s response status %s", + method, + response.request.url, + str(len(response.request.body if response.request.body else [])), + str(response.status_code), + ) + + if response.status_code >= HTTPStatus.INTERNAL_SERVER_ERROR: + logger.warning(f"Pebblo Server: Error {response.status_code}") + elif response.status_code >= HTTPStatus.BAD_REQUEST: + logger.warning(f"Pebblo received an invalid payload: {response.text}") + elif response.status_code != HTTPStatus.OK: + logger.warning( + f"Pebblo returned an unexpected response code: " + f"{response.status_code}" + ) + + return response + except RequestException: + logger.warning("Unable to reach server %s", url) + except Exception as e: + logger.warning("An Exception caught in make_request: %s", e) + return None + + @staticmethod + def update_cloud_payload(payload: dict, pebblo_resp: Optional[dict]) -> None: + """ + Update the payload with response, prompt and context from Pebblo response. + + Args: + payload (dict): Payload to be updated. + pebblo_resp (Optional[dict]): Response from Pebblo server. + """ + if pebblo_resp: + # Update response, prompt and context from pebblo response + response = payload.get("response", {}) + response.update(pebblo_resp.get("retrieval_data", {}).get("response", {})) + response.pop("data", None) + prompt = payload.get("prompt", {}) + prompt.update(pebblo_resp.get("retrieval_data", {}).get("prompt", {})) + prompt.pop("data", None) + context = payload.get("context", []) + for context_data in context: + context_data.pop("doc", None) + else: + payload["response"] = {} + payload["prompt"] = {} + payload["context"] = [] + + @staticmethod + async def amake_request( + method: str, + url: str, + headers: dict, + payload: Optional[dict] = None, + timeout: int = 20, + ) -> Any: + """ + Make a async request to the Pebblo server/cloud API. + + Args: + method (str): HTTP method (GET, POST, PUT, DELETE, etc.). + url (str): URL for the request. + headers (dict): Headers for the request. + payload (Optional[dict]): Payload for the request (for POST, PUT, etc.). + timeout (int): Timeout for the request in seconds. + + Returns: + Any: Response json if the request is successful. + """ + try: + client_timeout = ClientTimeout(total=timeout) + async with aiohttp.ClientSession() as asession: + async with asession.request( + method=method, + url=url, + json=payload, + headers=headers, + timeout=client_timeout, + ) as response: + if response.status >= HTTPStatus.INTERNAL_SERVER_ERROR: + logger.warning(f"Pebblo Server: Error {response.status}") + elif response.status >= HTTPStatus.BAD_REQUEST: + logger.warning( + f"Pebblo received an invalid payload: {response.text}" + ) + elif response.status != HTTPStatus.OK: + logger.warning( + f"Pebblo returned an unexpected response code: " + f"{response.status}" + ) + response_json = await response.json() + return response_json + except RequestException: + logger.warning("Unable to reach server %s", url) + except Exception as e: + logger.warning("An Exception caught in amake_request: %s", e) + return None + + def build_prompt_qa_payload( + self, + app_name: str, + retriever: VectorStoreRetriever, + question: str, + answer: str, + auth_context: Optional[AuthContext], + docs: List[Document], + prompt_entities: Dict[str, Any], + prompt_time: str, + prompt_gov_enabled: bool = False, + ) -> dict: + """ + Build the QA payload for the prompt. + + Args: + app_name (str): Name of the app. + retriever (VectorStoreRetriever): Retriever instance. + question (str): Question asked in the prompt. + answer (str): Answer generated by the model. + auth_context (Optional[AuthContext]): Authentication context. + docs (List[Document]): List of documents retrieved. + prompt_entities (Dict[str, Any]): Entities present in the prompt. + prompt_time (str): Time when the prompt was generated. + prompt_gov_enabled (bool): Whether prompt governance is enabled. + + Returns: + dict: The QA payload for the prompt. + """ + qa = Qa( + name=app_name, + context=[ + Context( + retrieved_from=doc.metadata.get( + "full_path", doc.metadata.get("source") + ), + doc=doc.page_content, + vector_db=retriever.vectorstore.__class__.__name__, + pb_checksum=doc.metadata.get("pb_checksum"), + ) + for doc in docs + if isinstance(doc, Document) + ], + prompt=Prompt( + data=question, + entities=prompt_entities.get("entities", {}), + entityCount=prompt_entities.get("entityCount", 0), + prompt_gov_enabled=prompt_gov_enabled, + ), + response=Prompt(data=answer), + prompt_time=prompt_time, + user=auth_context.user_id if auth_context else "unknown", + user_identities=auth_context.user_auth + if auth_context and hasattr(auth_context, "user_auth") + else [], + classifier_location=self.classifier_location, + ) + return qa.dict(exclude_unset=True) diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1475028b6c3c5634c5b76d507012676eb72b2b4b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7271e0b54d2fd7c856caf0d83f9cf342f3f66120 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/facebook_messenger.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/facebook_messenger.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..45ee76b4efd247db23256f36418340aeccf998fd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/facebook_messenger.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/gmail.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/gmail.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a4880838b817c31dd6abfaf65f84d81290b65fc7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/gmail.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/imessage.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/imessage.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1130f5954f67fc8e4e808a65ea6fcf61aa3d6566 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/imessage.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/langsmith.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/langsmith.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d4fbfb0319b8a392996685b7f34b5fa7aa73c80c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/langsmith.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/slack.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/slack.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3259f3124f3c6796f46cd25db9161df741abb978 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/slack.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/telegram.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/telegram.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a66c64a6d1bb1b082c9b1fcc826bbffabf2db9d6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/telegram.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79b34a6787094c124f7e6da8a9ba2796c4c3a87d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/whatsapp.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/whatsapp.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..109042e7b2e6ead71398ded16abdff02ceced346 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_loaders/__pycache__/whatsapp.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f0808d23b428ce64b02f6bbfa133f3d267ee263e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/astradb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/astradb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d383e8b0e87604e6e55c5694c9237649b0bf3cdf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/astradb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/cassandra.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/cassandra.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5c7b95548bbde15646f4549739d695161ae319f5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/cassandra.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/cosmos_db.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/cosmos_db.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3668b8e7144c3eb41a20afc4ec9eefc88560c823 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/cosmos_db.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/dynamodb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/dynamodb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..534ab5361157a8ea2e98db42c13d014a887d002f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/dynamodb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/elasticsearch.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/elasticsearch.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2b533120766da4961004912ca66b9968b0f6feb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/elasticsearch.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/file.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/file.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cb694dc03a407e0e4f28ee4d4e548cb070de8f0e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/file.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/firestore.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/firestore.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7a20472cc1c6d59d2b567a918e1504a13382f64 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/firestore.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/in_memory.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/in_memory.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8291c152d1a27cc17fdc9e269ae2e481c59eed9e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/in_memory.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/kafka.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/kafka.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c77eb7a5438b59e84ff0aeaa11822699c67eb36d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/kafka.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/momento.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/momento.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f28804fca3d9ac919df4954f8f3715d42036c9c4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/momento.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/mongodb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/mongodb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..378db91f242af83afefded607b81cd6238638c13 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/mongodb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/neo4j.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/neo4j.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3e5244d56aa50f0eeffe0d17793f80682224a9a0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/neo4j.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/postgres.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/postgres.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1bee081c51f800d9c2899f18d00c619f1dc5d662 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/postgres.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/redis.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/redis.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e350852255f0cf3230ae05e9b8cb158afd9f788a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/redis.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/rocksetdb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/rocksetdb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e24d5c9de7a51537a80e31e383794065ee5db076 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/rocksetdb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/singlestoredb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/singlestoredb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8df7d2d5621342be3669697c2e291b8b00554dd9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/singlestoredb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/sql.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/sql.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7a14eb651b7b96a59540bd72d334a84b827fc835 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/sql.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/streamlit.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/streamlit.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8088ca393194a7f5426ca84869df0443fe3057ae Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/streamlit.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/tidb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/tidb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6452fd18017fcf0ebfc4f733562621571a7f3fab Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/tidb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/upstash_redis.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/upstash_redis.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8fbc02914a656fc4f40c10e98e27cacdba02f385 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/upstash_redis.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/xata.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/xata.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2aa34f4934e705ec94ffbb8353f3f2a817b44edf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/xata.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/zep.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/zep.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4d0672c59f91d2238d463945de1cff2560e71ca7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/zep.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/zep_cloud.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/zep_cloud.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c252334ba1c75d7ed739d66ebed368f5e7c8bdba Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_message_histories/__pycache__/zep_cloud.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fa144f811de68c16cfe40f526736bfffe0a76a4e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/anthropic.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/anthropic.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ea763c337481763622e24325a5386639631956da Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/anthropic.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/anyscale.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/anyscale.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7063a9c39ec92123fbced564e57dab7b2d9f4ea1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/anyscale.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/azure_openai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/azure_openai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2bb1c84fc10238e4be5fb8e3bdf581a3b9f68f58 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/azure_openai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/azureml_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/azureml_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ebc6041d3c91371d8fdd81831579490a66c032f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/azureml_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/baichuan.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/baichuan.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d960c09ef221c7cb367727304a85bffee4267b71 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/baichuan.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/baidu_qianfan_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/baidu_qianfan_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dc7b0da9e40f744e556e58e1f709b674fea8fb5d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/baidu_qianfan_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/bedrock.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/bedrock.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..469367c5a48a7d38b32013846d8872b6d54cc5b9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/bedrock.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/cloudflare_workersai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/cloudflare_workersai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..802816c3f0bf3a7477225f68b9671d27e7dd8fef Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/cloudflare_workersai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/cohere.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/cohere.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d552fca3089fa8b625994fb0fc62acfa54da780 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/cohere.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/coze.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/coze.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0c3d7ae845d971895f88ab04e1872fbb6c5fa011 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/coze.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/dappier.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/dappier.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7f95ed274e27fec95571e727ec89feece66ea81f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/dappier.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/databricks.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/databricks.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..928dccc5e3fd70986578c87054c3a99f86bcc735 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/databricks.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/deepinfra.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/deepinfra.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..86b67edf744534d27cfd4f475ddcf307f0fc9056 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/deepinfra.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/edenai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/edenai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7d539735d6ad571414c667dd03d3f77a7af6e8f5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/edenai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/ernie.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/ernie.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ca9b655d47f394f5a3a2619433439f17497e9021 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/ernie.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/everlyai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/everlyai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80db47235352097746513b2e8638e589258c1a09 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/everlyai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/fake.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/fake.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f4d6ac314e613652c020b43426aa9aacf80e22f1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/fake.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/fireworks.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/fireworks.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dbec22de0925540d98d217874e7f2680e11d81e9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/fireworks.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/friendli.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/friendli.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0dc060197ceaeffca9e8d6133997d5428802d871 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/friendli.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/gigachat.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/gigachat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..087b1869ecfeb380dbdf41009a06aa6bc3cdb57c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/gigachat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/google_palm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/google_palm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e6f205e98c6f54d3f738a059d6d091e155cb89b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/google_palm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/gpt_router.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/gpt_router.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fb677f61ea100aa5cd6b515fc3387df27dc6b3a2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/gpt_router.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/huggingface.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/huggingface.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f0438a197c80c12a33d984760dd97e3240e0a236 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/huggingface.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/human.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/human.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3599db52aee47bfc9c040b436ab0ea809f902242 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/human.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/hunyuan.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/hunyuan.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c8e7954cf154a40e87e980f4c89ff90f3a74a451 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/hunyuan.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/javelin_ai_gateway.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/javelin_ai_gateway.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4aa29c338d8f54265ec43a1775ab49999d9dba9f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/javelin_ai_gateway.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/jinachat.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/jinachat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..19db41d12602c4fded9fcce84d2b28d5a0d98621 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/jinachat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/kinetica.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/kinetica.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4aa6c0d11db2d6d6ebecff5f37f0db32ba412a11 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/kinetica.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/konko.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/konko.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..534a04d933ec167e46ec332d16c6b09089abf84d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/konko.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/litellm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/litellm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b42ba7fccea4a969ed11e7e6c8c539046749eb6c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/litellm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/litellm_router.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/litellm_router.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4602421d8cfdc44b5ca23d6234aa5126925fb296 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/litellm_router.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/llama_edge.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/llama_edge.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..66cb7cd59d43b4dca49ba7c0dedbe97fb8c7ed93 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/llama_edge.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/llamacpp.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/llamacpp.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..85fb60c2d072452d253bc08a6674def9c57dc817 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/llamacpp.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/maritalk.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/maritalk.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..92c5065b978a74e74c8439abc7e35242489d609c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/maritalk.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/meta.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/meta.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a53b2894c8bf745aa4bfa6abcc208559f1908fce Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/meta.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/minimax.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/minimax.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bb36ed0aa8c669eb22afdc189e41adce97a2ba9a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/minimax.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/mlflow.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/mlflow.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bcda8b62f83ff09636c573a5b22983056d19ffcf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/mlflow.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/mlflow_ai_gateway.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/mlflow_ai_gateway.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f2d27bc64095c1ba85da45e171aad2a06ccaab6b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/mlflow_ai_gateway.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/mlx.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/mlx.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c118d05186d1817bb4527770d5d99352e0a6b81d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/mlx.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/moonshot.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/moonshot.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..017008f4acdf699a606723c1440dccc49a7d894f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/moonshot.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/naver.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/naver.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..800dae6872dce72614afa8a6bb58cc516ed1a51e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/naver.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/oci_data_science.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/oci_data_science.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a029d5ce8e4e89f1a402bfb0c161532bba1c9649 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/oci_data_science.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/oci_generative_ai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/oci_generative_ai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a7840c8fc49b5a6bcd9a026ec0638c15b71677a4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/oci_generative_ai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/octoai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/octoai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5d8f5225554f9b22426c928a6da77072a1bf372d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/octoai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/ollama.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/ollama.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a557ef0a621ecd171c493e257b106c0202b40fd1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/ollama.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/openai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/openai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..53d643cb227ace6bfb64538595a91e82fce38bbf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/openai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/outlines.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/outlines.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4edfd2594fa90be31e6c315f1b11dd7bdf11c4e4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/outlines.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/pai_eas_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/pai_eas_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7e43fa8bfc515165ec48172e85b9f618a0cbf89a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/pai_eas_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/perplexity.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/perplexity.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..297103459c894c3139e14d0d396d4eddfdd4579d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/perplexity.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/premai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/premai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cc1b98d78b276bb554c823208e16774f66dc6e9c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/premai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/promptlayer_openai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/promptlayer_openai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b078d3e04ab05f8cbcac5e7d3cd0165f458d452a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/promptlayer_openai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/reka.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/reka.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ef8a4a306595657b8dc079a6b92eea3124b7e239 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/reka.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/sambanova.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/sambanova.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9ad9a247f237eb9dcdfb8b9894f11ef9e666c4e3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/sambanova.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/snowflake.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/snowflake.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e98341514fdc372c30bd4c83302cdca14d8ab6b6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/snowflake.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/solar.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/solar.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5847460088ab00c2b1de4328560e63a6a553f963 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/solar.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/sparkllm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/sparkllm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..55494e86ecc629fe5f9d3896ba01212cbba88a17 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/sparkllm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/symblai_nebula.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/symblai_nebula.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a8422810b07befaae5713d311dc94630d6ad1b31 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/symblai_nebula.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/tongyi.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/tongyi.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c00d2f7a06b5975829360c4ea068e7fca2f7bfc Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/tongyi.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/vertexai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/vertexai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fe49039ce70672462743b12154ede035034169d4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/vertexai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/volcengine_maas.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/volcengine_maas.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..83b7f729b4cc1f93f5067c629dbdb0d64825603e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/volcengine_maas.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/writer.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/writer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0b01c5a00843fc1a37e92e061aa7c9a1fec02e19 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/writer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/yandex.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/yandex.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41239a90eef1cd23e87a92d4f99cf145448415be Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/yandex.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/yi.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/yi.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cebddd53f36f0aa85a05925598fd061eb1c48f48 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/yi.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/yuan2.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/yuan2.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7d09df8fc1f0b83557ce08c7b515a93cbf1aed64 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/yuan2.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/zhipuai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/zhipuai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a7ae72c567b468eb0585e166dc4a7d96161a976b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/chat_models/__pycache__/zhipuai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79ec7d4a3eed6cd8e9821a2d820b46ec154c57b3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3334be5782347727192f44de2735e3a2c8ecb33e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/fake.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/fake.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e7e5843ff1e01acec93a006fcb201c131f584548 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/fake.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/huggingface.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/huggingface.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6f2b6b1fd0bf9805b32ff5cbf26cbbc68c9fcbee Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/huggingface.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/sagemaker_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/sagemaker_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf5d04364c8bee5e8b26511a444afd0d32aad4f3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/cross_encoders/__pycache__/sagemaker_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..832ec267e0f4ae057a7f8a76e0143040ead509f0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/arbitrary_fn.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/arbitrary_fn.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b2e5b59b2ac4dc696b5c9b71014093306cc13cbe Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/arbitrary_fn.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..072f7f392c35b2ecc65a60c1713ec775095ff15a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/document.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/document.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..da6d1aeb994869fd2869242af2c91f08c1b309cb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/document.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/in_memory.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/in_memory.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b617729e379b6ed84ec2ed1e1bfbf85a9e488827 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/in_memory.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/wikipedia.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/wikipedia.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1f3aaa1c4e1335428dd41a54fd51cfe15a7db7f3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/docstore/__pycache__/wikipedia.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6a32b433c605282dbc79c7f1ccb974646bc28b3f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/dashscope_rerank.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/dashscope_rerank.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..73b410dca99b48909de786dbeb8ae9636c97bacf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/dashscope_rerank.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/flashrank_rerank.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/flashrank_rerank.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d3d81329e9eed188fcc75eeb5fd114578b6b960b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/flashrank_rerank.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/infinity_rerank.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/infinity_rerank.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0c0f89b278f8a34e3b47398d1318ac788750fe9c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/infinity_rerank.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/jina_rerank.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/jina_rerank.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b2299633b8af34b6f61b74edd819dd7df30541c0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/jina_rerank.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/llmlingua_filter.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/llmlingua_filter.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2115f687596138701fbe2e9784a79f721eb6bcc2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/llmlingua_filter.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/openvino_rerank.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/openvino_rerank.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f7107deb4e812f5bb829be0a77ea72e74c3cf9fc Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/openvino_rerank.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/rankllm_rerank.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/rankllm_rerank.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6cca6dc672838147371256c53657835ce0907f60 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/rankllm_rerank.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/volcengine_rerank.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/volcengine_rerank.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9879b12638d89abdc98ff87d751d4e21ef93d6d0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_compressors/__pycache__/volcengine_rerank.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0725e9017dfbba750fc2155af37ce2507377f19 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/acreom.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/acreom.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5c326093082e238fabab0a08241b28ffb0395869 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/acreom.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/airbyte.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/airbyte.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9ff6b74c8d18f84ad49a0ea2db1d55ee8abd89c1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/airbyte.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/airbyte_json.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/airbyte_json.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e1d76f586aefa20c673404ccf9963291055af77 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/airbyte_json.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/airtable.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/airtable.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f3e87ac2b2f92786582acaae419218ae0c5f943f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/airtable.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/apify_dataset.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/apify_dataset.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a646c05ffe57e7e17f23ff3e1faa77a22e93177e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/apify_dataset.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/arcgis_loader.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/arcgis_loader.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1e5edf65a506518604fc0d571c2ef36058044de6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/arcgis_loader.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/arxiv.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/arxiv.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..219d7d9b8c5fd1b58e9a4df1b6f70086dff84e71 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/arxiv.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/assemblyai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/assemblyai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2ecb20f5a08034a8d7846c2bb68297ded28b75ee Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/assemblyai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/astradb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/astradb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c1ae9717ab5a515e943c5f93af5e189f69b8b149 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/astradb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/async_html.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/async_html.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6b9291d78917e155ab59a4d72ecc3801334c4d1e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/async_html.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/athena.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/athena.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..54852f54af31bcdfc30c5392b9431ef2a0b9e1a1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/athena.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/azlyrics.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/azlyrics.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..83ff2050dd855c50d9c51b1143d1c0b380fd3e02 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/azlyrics.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/azure_ai_data.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/azure_ai_data.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..abf4b42eaeb4ac3e3ab340cf8e8a6f6643f07c7b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/azure_ai_data.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/azure_blob_storage_container.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/azure_blob_storage_container.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8833c7dd9d5e5bbca8f3eec4ce3c1c97dfd7d36f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/azure_blob_storage_container.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/azure_blob_storage_file.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/azure_blob_storage_file.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..833c21357b77788e37abd2e07a54a102ced71656 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/azure_blob_storage_file.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/baiducloud_bos_directory.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/baiducloud_bos_directory.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9681455c73329d2dbcd988da32b7d8d9a64b7d52 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/baiducloud_bos_directory.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/baiducloud_bos_file.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/baiducloud_bos_file.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..19a534ecb937759c22cd0e3e6599c6b5ca3ee546 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/baiducloud_bos_file.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..208432e3529fdccb89d011163318e286cf8a0656 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/base_o365.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/base_o365.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..105d4680e0b591ee6f1f8d0e11085aa7c0739c6b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/base_o365.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/bibtex.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/bibtex.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..703b335bafc9dbb4eefe4e2636c338de81affe01 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/bibtex.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/bigquery.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/bigquery.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..47add11c01eef08674e3abc7e514ab42efff3a1f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/bigquery.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/bilibili.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/bilibili.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c9b0e87fbcc70b7643e763b932caa2eac2a4034d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/bilibili.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/blackboard.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/blackboard.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..52d18d79e2d634df067375d7f03576f2e3d0d4e2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/blackboard.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/blockchain.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/blockchain.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..06a1d440099e19f3df829f7fba0ec9917c0e0245 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/blockchain.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/brave_search.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/brave_search.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb1abf0797315548e71c9e42d39a51e90b1eb587 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/brave_search.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/browserbase.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/browserbase.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7dca28e78d6510b346fb32774c94c320c4db3e9d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/browserbase.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/browserless.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/browserless.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ef667cb098b30790a93e2eb94aa26dda6ceff905 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/browserless.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/cassandra.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/cassandra.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..35e12a4c44e82799360f9579bef2fcd9d8de4169 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/cassandra.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/chatgpt.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/chatgpt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..950edc812cdd7de12d468ba0ae74cd5db7cc3291 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/chatgpt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/chm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/chm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c91949ba9f1a00141452e8dff8e13da0578d597c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/chm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/chromium.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/chromium.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..18654d429f7aa2e215faf9aa3b9ef309eab8d252 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/chromium.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/college_confidential.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/college_confidential.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c1301c645c5b0fa40bfa05e7784d19b345210f48 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/college_confidential.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/concurrent.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/concurrent.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1c7f5dcdbf47543d3c51de6e88c0ef5fdaeb2cf5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/concurrent.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/confluence.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/confluence.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7e00b933201a1fbbf1c31ab11ae9e1c508e03d5d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/confluence.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/conllu.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/conllu.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c1c4cff34f1d1666a048f0024a7d31f1a1661621 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/conllu.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/couchbase.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/couchbase.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..970e894cd22c813bc396f284291b5ccc82a3f241 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/couchbase.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/csv_loader.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/csv_loader.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9d31cad24b3b84adb6a516cf8551b8b6b71c74af Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/csv_loader.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/cube_semantic.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/cube_semantic.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8c8df54dacfe5a1186e47b084a27e4d3116ca01 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/cube_semantic.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/datadog_logs.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/datadog_logs.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0ee78375f5ba0b7d0549c97626c665545bdab86f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/datadog_logs.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/dataframe.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/dataframe.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0afdbc840814e1bf8096abfbc12659145b01e950 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/dataframe.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/dedoc.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/dedoc.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a75ebe942b3b9ed1b955811f7413e47a10e2e849 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/dedoc.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/diffbot.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/diffbot.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0ff7c2ada919561a5ebbc7ea94bccfd588e1194e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/diffbot.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/directory.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/directory.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d0b6e780c9683186bc00f247a177911113d5de7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/directory.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/discord.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/discord.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..57e8e227694936fdcb0124616c92f7d075769ec2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/discord.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/doc_intelligence.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/doc_intelligence.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ce3790cb79a888018cab5280e0b42815f8524e1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/doc_intelligence.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/docugami.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/docugami.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f1e1a04962be6d8477faafc451ad3590f366b14d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/docugami.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/docusaurus.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/docusaurus.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e7b11025bb09b10c85a4f8b3da696cc49a3b2e68 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/docusaurus.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/dropbox.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/dropbox.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ec1acbbcdc0c038a1b96ee9d48172efbbc3043e1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/dropbox.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/duckdb_loader.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/duckdb_loader.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cb9c09596c45542400bcac44f4a553c80e033486 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/duckdb_loader.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/email.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/email.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fe3c168cf012d8b492ad3dbca80c2980d917de42 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/email.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/epub.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/epub.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cf90fd327fae7ae22f56e03ff871d209111cc87e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/epub.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/etherscan.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/etherscan.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b0472be36d887b9075a276a7aebf805e0f12a777 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/etherscan.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/evernote.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/evernote.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6c7fe796fc9b420ccaa046312b00af907c2bf222 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/evernote.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/excel.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/excel.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6b71bec8acc176ffe07eaa3ac58ec0c5bd16a10f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/excel.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/facebook_chat.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/facebook_chat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..913b120bb9cc3147fab40f64fe76911434beb75a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/facebook_chat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/fauna.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/fauna.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2494c29a1fbe7700045c306907a99f18ad7955a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/fauna.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/figma.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/figma.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..49bf6ebc3e80c41f94a30dae2f77c5abbe510a0f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/figma.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/firecrawl.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/firecrawl.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..baba30f69afe733c3616c67a9797da55356348e5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/firecrawl.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/gcs_directory.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/gcs_directory.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..86707167a0fb4f714250fe764711ed38cf24699d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/gcs_directory.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/gcs_file.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/gcs_file.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..efa3e09804f3de9fbfe4bd5f4685507a71f7cb38 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/gcs_file.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/generic.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/generic.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..831b4a8a0f5e8a6779271b5d65e472cf697cad19 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/generic.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/geodataframe.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/geodataframe.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1d856407c7e788626a02e41b7a33d57c6eaf9812 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/geodataframe.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/git.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/git.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d1e9c2cec15f3a2aa766692bb12572de2609a241 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/git.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/gitbook.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/gitbook.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a59f939bf51b1c074a3c7df2e5a640131bc2a669 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/gitbook.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/github.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/github.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5cc662fa71c1dec33e5418a689b1e74fab5c61ac Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/github.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/glue_catalog.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/glue_catalog.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d81e344f9c128d7e8c98259c435e4d0d56cba316 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/glue_catalog.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/google_speech_to_text.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/google_speech_to_text.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f99ab35036ced58a1e5a46f74d59c2adb2fd3cd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/google_speech_to_text.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/googledrive.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/googledrive.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..566a9c3f6259bd0cd01bdc822457fe496c995c77 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/googledrive.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/gutenberg.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/gutenberg.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..942742efe5f19d40bf3efe1f2508ef7d6b4d920f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/gutenberg.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/helpers.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/helpers.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..064bd7f01596e6c8a3172134c25d30af9cb86e2e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/helpers.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/hn.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/hn.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c7c60e451acae2e36052d29e70b23f11d8736aaa Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/hn.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/html.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/html.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2c17ff793d3fc9cbe441d9bfd0918e7a96fb872 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/html.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/html_bs.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/html_bs.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3aad71dfa3eed46fd6cdd4f8ee173339c5d4adbf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/html_bs.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/hugging_face_dataset.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/hugging_face_dataset.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..58679ddf18ca53bb8f24b3cd60a2df419ef976db Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/hugging_face_dataset.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/hugging_face_model.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/hugging_face_model.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1a361ef6cf56cacfce63fa6ffaf4e9f6d52f33c4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/hugging_face_model.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/ifixit.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/ifixit.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b13c73671b316d7a048bc591037a080cfcd6d381 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/ifixit.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/image.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/image.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3c7a95b18f09b7a68f7a52257637860946b4aa1f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/image.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/image_captions.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/image_captions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d5c4de478851bf86688d20c5a37fd0262a2a7e8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/image_captions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/imsdb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/imsdb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3349aac3b4bfe13016493838bf51a51c1fa38e92 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/imsdb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/iugu.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/iugu.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2fd592276e7ff515570767c135959882801ed3fb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/iugu.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/joplin.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/joplin.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b7cb683837deaf5226f9d3c7c99f989196ba2eb9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/joplin.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/json_loader.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/json_loader.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..531d6242350bf5c210efd759cb5e99a50075d0e0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/json_loader.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/kinetica_loader.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/kinetica_loader.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b4d51e6f087cce80287e7bb2df47dddbbfc4221c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/kinetica_loader.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/lakefs.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/lakefs.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..279b47734a726701c28e4d1f587ec69fa46ff2e7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/lakefs.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/larksuite.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/larksuite.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..95464cf117f6545fe7f9f8b34d477d7eb42a30c6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/larksuite.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/llmsherpa.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/llmsherpa.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8a28f90ad821f0d82b8c7f38abcfd793d417379c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/llmsherpa.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/markdown.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/markdown.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f5cec7c08683eef71a3830db657ad4173d5079e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/markdown.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mastodon.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mastodon.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c066e1e8ee9190cfe5bea0234cb12e4a44eef338 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mastodon.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/max_compute.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/max_compute.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..82de4232345f9dde65f08744f29c63a0ec59c26b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/max_compute.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mediawikidump.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mediawikidump.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dedc910408a5931ae0ee6babb3585ce99e8ab5de Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mediawikidump.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/merge.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/merge.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..02d8967fa2735ded388e76320aba91999a454418 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/merge.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mhtml.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mhtml.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7bb1426f2aa991eb74a22b64abea818445d0da26 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mhtml.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mintbase.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mintbase.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..94ece6756202b5d03033e7fb8e7ff261ff38f85c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mintbase.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/modern_treasury.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/modern_treasury.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cc59f108153d140f0d0ab1d6fe115c52a889d718 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/modern_treasury.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mongodb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mongodb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f56374b99fb4aa2fa6b3df6057b8e813fdf316e7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/mongodb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/needle.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/needle.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4fc076446040e96757db3f79eca9de9d18caf1b9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/needle.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/news.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/news.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..59817524b65486f2d492e8127dc36ff02bd9f3a2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/news.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/notebook.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/notebook.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4a8bd1949bf6bda99ee26257c040158859ff95cf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/notebook.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/notion.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/notion.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60c633f4a786b969df356563872659903f391a95 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/notion.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/notiondb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/notiondb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c97c6a208e1d79a5d7dd1e4103a32598585d388b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/notiondb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/nuclia.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/nuclia.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a4c703dc05bebd24e4572d057b3223f3c53468ef Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/nuclia.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/obs_directory.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/obs_directory.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fe4795f939b65862af1d043a5e57fc1a5f7822e2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/obs_directory.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/obs_file.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/obs_file.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dc28544508ca8ca9134e76287b2048c61de24d0b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/obs_file.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/obsidian.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/obsidian.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1ea0852cf065d89a7628a8ef787d550a21c06a24 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/obsidian.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/odt.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/odt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5cddebf24dc3fd5d4162bd636988b09557330270 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/odt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/onedrive.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/onedrive.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8177415170e1442108be95583db701c736f0701 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/onedrive.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/onedrive_file.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/onedrive_file.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c7121f51af1010b392a2cebd761c12f19a3c256c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/onedrive_file.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/onenote.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/onenote.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c4a940465775cc3df3e5ce773bcd8f01e37ec75b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/onenote.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/open_city_data.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/open_city_data.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2dde90a80786f00886028eefe2d1219e2b9c1d3b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/open_city_data.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/oracleadb_loader.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/oracleadb_loader.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..64e45abb9fad890affe52ce21a0a50b8713f869d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/oracleadb_loader.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/oracleai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/oracleai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a4edff36fd5c7c9cc7ababfdd47fa9d1f8608ebc Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/oracleai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/org_mode.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/org_mode.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ccabbada2d5fcbf994d1282a87c16327397e7b73 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/org_mode.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/pdf.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/pdf.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f0b80b5ea48077ffaeda0fe7cafe0d4b991740ab Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/pdf.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/pebblo.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/pebblo.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..444ac3ac97f368cccf3efe9577cc6a72c1367a59 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/pebblo.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/polars_dataframe.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/polars_dataframe.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2929f8f0f107e8765402b2aeb6e3065989835c09 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/polars_dataframe.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/powerpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/powerpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0baccbdbddca2d19973bb5066acb8f3ef90f4ab9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/powerpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/psychic.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/psychic.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..35965a45c7e123e1af6845f7d33267cabb1191db Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/psychic.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/pubmed.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/pubmed.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8bf8dfcdd0e6e48c3c8febc7dac8774384f32ed3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/pubmed.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/pyspark_dataframe.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/pyspark_dataframe.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fd1505a357b1efd09c6999a3bbb6589ae0f8da37 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/pyspark_dataframe.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/python.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/python.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..03dfe7a148b9fa8b40bdf7dd8673c09b8853c97b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/python.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/quip.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/quip.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8397b52ebef9837d70dd034f1dfcf126cf70b941 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/quip.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/readthedocs.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/readthedocs.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e30d26963741b9371edabb7978ab6e7bd6c33e07 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/readthedocs.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/recursive_url_loader.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/recursive_url_loader.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6f1366414615ff68f0af2ebd827d2aa6b0a4f362 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/recursive_url_loader.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/reddit.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/reddit.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3f1be835c53fdbaf68584df5d56d3a516bfa6619 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/reddit.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/roam.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/roam.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2a65924e1e27b4b827f96742b0230bdeeb124d2e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/roam.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rocksetdb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rocksetdb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3144f4f95714aa116c45530872ae3b7f1de15522 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rocksetdb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rspace.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rspace.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..50005aa65aa5f8c72b94497a729830a5c34ba9c3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rspace.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rss.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rss.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e1a363399609319472d1081cb1cfc5810784b632 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rss.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rst.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rst.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..28fb1cd9e40a746dd4dc528bbe1d30f66396b4a7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rst.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rtf.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rtf.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d3806433b8f23e5481a34d4443858e7b639dd38d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/rtf.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/s3_directory.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/s3_directory.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf57b70c31a14282dbd03561e190276f2dfc1877 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/s3_directory.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/s3_file.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/s3_file.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..01eb52ae99bff5e58f85af38b51f15b9fc196221 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/s3_file.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/scrapfly.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/scrapfly.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aa898449bffddb7915b15fd29fac8e4ece955491 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/scrapfly.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/scrapingant.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/scrapingant.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c4551ee24f16edc9c35b9f11abab40cd0742682b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/scrapingant.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/sharepoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/sharepoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..920cafc7ac52398c7dfc99294610994067f37d2a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/sharepoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/sitemap.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/sitemap.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2782d51c800e9231b19404a748df47968e8d4d0c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/sitemap.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/slack_directory.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/slack_directory.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e38066381918442fb9577a744ab082f87ebe9246 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/slack_directory.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/snowflake_loader.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/snowflake_loader.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb1d1393c6addaff0257ae5f463abb344d3b5181 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/snowflake_loader.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/spider.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/spider.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e473833cb1bffde76922d7488ab1ab5dd7871256 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/spider.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/spreedly.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/spreedly.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ca2d8326ab567dd0affc4a6761d976c7d9740ae3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/spreedly.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/sql_database.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/sql_database.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..339ad1bb8afd7cdbf59740849d95ee27ee5b1fe8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/sql_database.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/srt.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/srt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..22070ab181588edb5b1bf971043c79225658c444 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/srt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/stripe.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/stripe.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..49da8ac0a87eb437ce52999b0ade09e973146d37 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/stripe.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/surrealdb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/surrealdb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..046779f8ede9139458e4177d57b1cd7c995020c4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/surrealdb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/telegram.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/telegram.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8194a59fcdf5680b26477d1724fbade6b62d779b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/telegram.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tencent_cos_directory.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tencent_cos_directory.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5d535422419b8b33516c4beeaef3faf7db756dbe Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tencent_cos_directory.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tencent_cos_file.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tencent_cos_file.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fa11d0a5bdec5e92b0323e0791b08eba63d777e6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tencent_cos_file.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tensorflow_datasets.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tensorflow_datasets.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..744a54cb645c3ffd08afeeb24e45d80ce1854a88 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tensorflow_datasets.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/text.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/text.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0198874eaabf073f26b3c521fc1ebec939ff3b3f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/text.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tidb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tidb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4b40bf9f29bc196a8c553693eaf5391e28acf592 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tidb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tomarkdown.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tomarkdown.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a413e52e16b5914ded19089d72e857a5be1cc07e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tomarkdown.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/toml.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/toml.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8aeea7e3a870516519aa3e2c9c952fb8ed84c69c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/toml.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/trello.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/trello.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ff66de8bdd54f3e686e305d8a9f89362f470345b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/trello.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tsv.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tsv.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..45d18fe37ae38d45fa27250fa529f5f50ce6eaab Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/tsv.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/twitter.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/twitter.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d124a70122e9f379dfa485867f0143aa0f271580 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/twitter.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/unstructured.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/unstructured.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cea29477d52d1b7dbe4565b54d614f110befb9e8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/unstructured.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/url.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/url.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..52ed6fbabb114624474e8ff52f893372d54f751b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/url.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/url_playwright.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/url_playwright.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ad33577cad7ce407971570cdbac41ef7b8db6a62 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/url_playwright.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/url_selenium.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/url_selenium.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf4c7e7b9e2ff080b075b6da882db1076f6f1f48 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/url_selenium.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/vsdx.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/vsdx.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..14bf9e6da4033f68cab953bfefe12455d468aacd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/vsdx.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/weather.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/weather.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..954b13c3192bb2095c1dabac3c091911a4647a70 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/weather.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/web_base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/web_base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..82840f0adbafdcf3185cdd53d1e051b989f48edf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/web_base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/whatsapp_chat.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/whatsapp_chat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..913d35ef4c30d0b249eca8150ed589810fb1a910 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/whatsapp_chat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/wikipedia.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/wikipedia.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..362647205813d9271cdb2226c4dc44e534bd64d7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/wikipedia.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/word_document.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/word_document.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d22f4e4895fa33ab67f8077db23b974903c549d3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/word_document.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/xml.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/xml.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9985c32aa314b82fbf19dda20c31b5ba2c37aea2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/xml.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/xorbits.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/xorbits.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..385bfc7338dca92a788b6283564ff597be50cd49 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/xorbits.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/youtube.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/youtube.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d419ec4510b9cbfc7c7520646f347b514eb51a9a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/youtube.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/yuque.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/yuque.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d58a53e8c0c2b868d9e5fcb93991a98436cbc346 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/__pycache__/yuque.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..95907e77ffc6af73c3e0f66f299fb33041169f89 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__init__.py @@ -0,0 +1,44 @@ +import importlib +from typing import TYPE_CHECKING, Any + +from langchain_core.document_loaders import Blob, BlobLoader + +if TYPE_CHECKING: + from langchain_community.document_loaders.blob_loaders.cloud_blob_loader import ( + CloudBlobLoader, + ) + from langchain_community.document_loaders.blob_loaders.file_system import ( + FileSystemBlobLoader, + ) + from langchain_community.document_loaders.blob_loaders.youtube_audio import ( + YoutubeAudioLoader, + ) + + +_module_lookup = { + "CloudBlobLoader": ( + "langchain_community.document_loaders.blob_loaders.cloud_blob_loader" + ), + "FileSystemBlobLoader": ( + "langchain_community.document_loaders.blob_loaders.file_system" + ), + "YoutubeAudioLoader": ( + "langchain_community.document_loaders.blob_loaders.youtube_audio" + ), +} + + +def __getattr__(name: str) -> Any: + if name in _module_lookup: + module = importlib.import_module(_module_lookup[name]) + return getattr(module, name) + raise AttributeError(f"module {__name__} has no attribute {name}") + + +__all__ = [ + "BlobLoader", + "Blob", + "CloudBlobLoader", + "FileSystemBlobLoader", + "YoutubeAudioLoader", +] diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e2cb945689f96b9dc7ecfb88dd1c54df4bcc406c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/cloud_blob_loader.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/cloud_blob_loader.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c7c586e1e5be1ada954f80f85ec673167e3aed0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/cloud_blob_loader.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/file_system.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/file_system.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d4b7927698806380ac0cf76c062c5aab7ba591dc Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/file_system.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/schema.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/schema.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f4eb5f9c365c354cad91db6c0c1eb3003714586a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/schema.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/youtube_audio.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/youtube_audio.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..65ef8a752c4541e1f7edb55f637f966a3a3ffe3f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/__pycache__/youtube_audio.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/cloud_blob_loader.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/cloud_blob_loader.py new file mode 100644 index 0000000000000000000000000000000000000000..8413c3108cc3c9598dc5ab218f8079375d103edb --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/cloud_blob_loader.py @@ -0,0 +1,296 @@ +"""Use to load blobs from the local file system.""" + +import contextlib +import mimetypes +import tempfile +from io import BufferedReader, BytesIO +from pathlib import Path +from typing import ( + TYPE_CHECKING, + Callable, + Generator, + Iterable, + Iterator, + Optional, + Sequence, + TypeVar, + Union, +) +from urllib.parse import urlparse + +if TYPE_CHECKING: + from cloudpathlib import AnyPath + +from langchain_community.document_loaders.blob_loaders.schema import ( + Blob, + BlobLoader, +) + +T = TypeVar("T") + + +class _CloudBlob(Blob): + def as_string(self) -> str: + """Read data as a string.""" + from cloudpathlib import AnyPath + + if self.data is None and self.path: + return AnyPath(self.path).read_text(encoding=self.encoding) + elif isinstance(self.data, bytes): + return self.data.decode(self.encoding) + elif isinstance(self.data, str): + return self.data + else: + raise ValueError(f"Unable to get string for blob {self}") + + def as_bytes(self) -> bytes: + """Read data as bytes.""" + from cloudpathlib import AnyPath + + if isinstance(self.data, bytes): + return self.data + elif isinstance(self.data, str): + return self.data.encode(self.encoding) + elif self.data is None and self.path: + return AnyPath(self.path).read_bytes() + else: + raise ValueError(f"Unable to get bytes for blob {self}") + + @contextlib.contextmanager + def as_bytes_io(self) -> Generator[Union[BytesIO, BufferedReader], None, None]: + """Read data as a byte stream.""" + from cloudpathlib import AnyPath + + if isinstance(self.data, bytes): + yield BytesIO(self.data) + elif self.data is None and self.path: + return AnyPath(self.path).read_bytes() + else: + raise NotImplementedError(f"Unable to convert blob {self}") + + +def _url_to_filename(url: str) -> str: + """ + Convert file:, s3:, az: or gs: url to localfile. + If the file is not here, download it in a temporary file. + """ + from cloudpathlib import AnyPath + + url_parsed = urlparse(url) + suffix = Path(url_parsed.path).suffix + if url_parsed.scheme in ["s3", "az", "gs"]: + with AnyPath(url).open("rb") as f: + temp_file = tempfile.NamedTemporaryFile(suffix=suffix, delete=False) + while True: + buf = f.read() + if not buf: + break + temp_file.write(buf) + temp_file.close() + file_path = temp_file.name + elif url_parsed.scheme in ["file", ""]: + file_path = url_parsed.path + else: + raise ValueError(f"Scheme {url_parsed.scheme} not supported") + return file_path + + +def _make_iterator( + length_func: Callable[[], int], show_progress: bool = False +) -> Callable[[Iterable[T]], Iterator[T]]: + """Create a function that optionally wraps an iterable in tqdm.""" + if show_progress: + try: + from tqdm.auto import tqdm + except ImportError: + raise ImportError( + "You must install tqdm to use show_progress=True." + "You can install tqdm with `pip install tqdm`." + ) + + # Make sure to provide `total` here so that tqdm can show + # a progress bar that takes into account the total number of files. + def _with_tqdm(iterable: Iterable[T]) -> Iterator[T]: + """Wrap an iterable in a tqdm progress bar.""" + return tqdm(iterable, total=length_func()) + + iterator = _with_tqdm + else: + iterator = iter # type: ignore[assignment] + + return iterator + + +# PUBLIC API + + +class CloudBlobLoader(BlobLoader): + """Load blobs from cloud URL or file:. + + Example: + + .. code-block:: python + + loader = CloudBlobLoader("s3://mybucket/id") + + for blob in loader.yield_blobs(): + print(blob) + """ # noqa: E501 + + def __init__( + self, + url: Union[str, "AnyPath"], + *, + glob: str = "**/[!.]*", + exclude: Sequence[str] = (), + suffixes: Optional[Sequence[str]] = None, + show_progress: bool = False, + ) -> None: + """Initialize with a url and how to glob over it. + + Use [CloudPathLib](https://cloudpathlib.drivendata.org/). + + Args: + url: Cloud URL to load from. + Supports s3://, az://, gs://, file:// schemes. + If no scheme is provided, it is assumed to be a local file. + If a path to a file is provided, glob/exclude/suffixes are ignored. + glob: Glob pattern relative to the specified path + by default set to pick up all non-hidden files + exclude: patterns to exclude from results, use glob syntax + suffixes: Provide to keep only files with these suffixes + Useful when wanting to keep files with different suffixes + Suffixes must include the dot, e.g. ".txt" + show_progress: If true, will show a progress bar as the files are loaded. + This forces an iteration through all matching files + to count them prior to loading them. + + Examples: + + .. code-block:: python + from langchain_community.document_loaders.blob_loaders import CloudBlobLoader + + # Load a single file. + loader = CloudBlobLoader("s3://mybucket/id") # az:// + + # Recursively load all text files in a directory. + loader = CloudBlobLoader("az://mybucket/id", glob="**/*.txt") + + # Recursively load all non-hidden files in a directory. + loader = CloudBlobLoader("gs://mybucket/id", glob="**/[!.]*") + + # Load all files in a directory without recursion. + loader = CloudBlobLoader("s3://mybucket/id", glob="*") + + # Recursively load all files in a directory, except for py or pyc files. + loader = CloudBlobLoader( + "s3://mybucket/id", + glob="**/*.txt", + exclude=["**/*.py", "**/*.pyc"] + ) + """ # noqa: E501 + from cloudpathlib import AnyPath + + url_parsed = urlparse(str(url)) + + if url_parsed.scheme == "file": + url = url_parsed.path + + if isinstance(url, str): + self.path = AnyPath(url) + else: + self.path = url + + self.glob = glob + self.suffixes = set(suffixes or []) + self.show_progress = show_progress + self.exclude = exclude + + def yield_blobs( + self, + ) -> Iterable[Blob]: + """Yield blobs that match the requested pattern.""" + iterator = _make_iterator( + length_func=self.count_matching_files, show_progress=self.show_progress + ) + + for path in iterator(self._yield_paths()): + # yield Blob.from_path(path) + yield self.from_path(path) + + def _yield_paths(self) -> Iterable["AnyPath"]: + """Yield paths that match the requested pattern.""" + if self.path.is_file(): + yield self.path + return + + paths = self.path.glob(self.glob) + for path in paths: + if self.exclude: + if any(path.match(glob) for glob in self.exclude): + continue + if path.is_file(): + if self.suffixes and path.suffix not in self.suffixes: + continue # FIXME + yield path + + def count_matching_files(self) -> int: + """Count files that match the pattern without loading them.""" + # Carry out a full iteration to count the files without + # materializing anything expensive in memory. + num = 0 + for _ in self._yield_paths(): + num += 1 + return num + + @classmethod + def from_path( + cls, + path: "AnyPath", + *, + encoding: str = "utf-8", + mime_type: Optional[str] = None, + guess_type: bool = True, + metadata: Optional[dict] = None, + ) -> Blob: + """Load the blob from a path like object. + + Args: + path: path like object to file to be read + Supports s3://, az://, gs://, file:// schemes. + If no scheme is provided, it is assumed to be a local file. + encoding: Encoding to use if decoding the bytes into a string + mime_type: if provided, will be set as the mime-type of the data + guess_type: If True, the mimetype will be guessed from the file extension, + if a mime-type was not provided + metadata: Metadata to associate with the blob + + Returns: + Blob instance + """ + if mime_type is None and guess_type: + _mimetype = mimetypes.guess_type(path)[0] if guess_type else None + else: + _mimetype = mime_type + + url_parsed = urlparse(str(path)) + if url_parsed.scheme in ["file", ""]: + if url_parsed.scheme == "file": + local_path = url_parsed.path + else: + local_path = str(path) + return Blob( + data=None, + mimetype=_mimetype, + encoding=encoding, + path=local_path, + metadata=metadata if metadata is not None else {}, + ) + + return _CloudBlob( + data=None, + mimetype=_mimetype, + encoding=encoding, + path=str(path), + metadata=metadata if metadata is not None else {}, + ) diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/file_system.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/file_system.py new file mode 100644 index 0000000000000000000000000000000000000000..ee756f32ed73e90c8f2700f8d451d53fdddabdb5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/file_system.py @@ -0,0 +1,149 @@ +"""Use to load blobs from the local file system.""" + +from pathlib import Path +from typing import Callable, Iterable, Iterator, Optional, Sequence, TypeVar, Union + +from langchain_community.document_loaders.blob_loaders.schema import Blob, BlobLoader + +T = TypeVar("T") + + +def _make_iterator( + length_func: Callable[[], int], show_progress: bool = False +) -> Callable[[Iterable[T]], Iterator[T]]: + """Create a function that optionally wraps an iterable in tqdm.""" + iterator: Callable[[Iterable[T]], Iterator[T]] + if show_progress: + try: + from tqdm.auto import tqdm + except ImportError: + raise ImportError( + "You must install tqdm to use show_progress=True." + "You can install tqdm with `pip install tqdm`." + ) + + # Make sure to provide `total` here so that tqdm can show + # a progress bar that takes into account the total number of files. + def _with_tqdm(iterable: Iterable[T]) -> Iterator[T]: + """Wrap an iterable in a tqdm progress bar.""" + return tqdm(iterable, total=length_func()) + + iterator = _with_tqdm + else: + iterator = iter + + return iterator + + +# PUBLIC API + + +class FileSystemBlobLoader(BlobLoader): + """Load blobs in the local file system. + + Example: + + .. code-block:: python + + from langchain_community.document_loaders.blob_loaders import FileSystemBlobLoader + loader = FileSystemBlobLoader("/path/to/directory") + for blob in loader.yield_blobs(): + print(blob) # noqa: T201 + """ # noqa: E501 + + def __init__( + self, + path: Union[str, Path], + *, + glob: str = "**/[!.]*", + exclude: Sequence[str] = (), + suffixes: Optional[Sequence[str]] = None, + show_progress: bool = False, + ) -> None: + """Initialize with a path to directory and how to glob over it. + + Args: + path: Path to directory to load from or path to file to load. + If a path to a file is provided, glob/exclude/suffixes are ignored. + glob: Glob pattern relative to the specified path + by default set to pick up all non-hidden files + exclude: patterns to exclude from results, use glob syntax + suffixes: Provide to keep only files with these suffixes + Useful when wanting to keep files with different suffixes + Suffixes must include the dot, e.g. ".txt" + show_progress: If true, will show a progress bar as the files are loaded. + This forces an iteration through all matching files + to count them prior to loading them. + + Examples: + + .. code-block:: python + from langchain_community.document_loaders.blob_loaders import FileSystemBlobLoader + + # Load a single file. + loader = FileSystemBlobLoader("/path/to/file.txt") + + # Recursively load all text files in a directory. + loader = FileSystemBlobLoader("/path/to/directory", glob="**/*.txt") + + # Recursively load all non-hidden files in a directory. + loader = FileSystemBlobLoader("/path/to/directory", glob="**/[!.]*") + + # Load all files in a directory without recursion. + loader = FileSystemBlobLoader("/path/to/directory", glob="*") + + # Recursively load all files in a directory, except for py or pyc files. + loader = FileSystemBlobLoader( + "/path/to/directory", + glob="**/*.txt", + exclude=["**/*.py", "**/*.pyc"] + ) + """ # noqa: E501 + if isinstance(path, Path): + _path = path + elif isinstance(path, str): + _path = Path(path) + else: + raise TypeError(f"Expected str or Path, got {type(path)}") + + self.path = _path.expanduser() # Expand user to handle ~ + self.glob = glob + self.suffixes = set(suffixes or []) + self.show_progress = show_progress + self.exclude = exclude + + def yield_blobs( + self, + ) -> Iterable[Blob]: + """Yield blobs that match the requested pattern.""" + iterator = _make_iterator( + length_func=self.count_matching_files, show_progress=self.show_progress + ) + + for path in iterator(self._yield_paths()): + yield Blob.from_path(path) + + def _yield_paths(self) -> Iterable[Path]: + """Yield paths that match the requested pattern.""" + if self.path.is_file(): + yield self.path + return + + paths = self.path.glob(self.glob) + for path in paths: + if self.exclude: + if any(path.match(glob) for glob in self.exclude): + continue + if path.is_file(): + if self.suffixes and path.suffix not in self.suffixes: + continue + yield path + + def count_matching_files(self) -> int: + """Count files that match the pattern without loading them.""" + # Carry out a full iteration to count the files without + # materializing anything expensive in memory. + num = 0 + for _ in self._yield_paths(): + num += 1 + return num diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/schema.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/schema.py new file mode 100644 index 0000000000000000000000000000000000000000..208510eaeac507c0007b09aeee92f1d1d2ca4eaa --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/schema.py @@ -0,0 +1,7 @@ +from langchain_core.document_loaders.blob_loaders import Blob, BlobLoader, PathLike + +__all__ = [ + "Blob", + "BlobLoader", + "PathLike", +] diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/youtube_audio.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/youtube_audio.py new file mode 100644 index 0000000000000000000000000000000000000000..b0b2dc6daa8f4e23a42d5ddab12b4c21d5b44896 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/blob_loaders/youtube_audio.py @@ -0,0 +1,48 @@ +from typing import Iterable, List + +from langchain_community.document_loaders.blob_loaders import FileSystemBlobLoader +from langchain_community.document_loaders.blob_loaders.schema import Blob, BlobLoader + + +class YoutubeAudioLoader(BlobLoader): + """Load YouTube urls as audio file(s).""" + + def __init__(self, urls: List[str], save_dir: str): + if not isinstance(urls, list): + raise TypeError("urls must be a list") + + self.urls = urls + self.save_dir = save_dir + + def yield_blobs(self) -> Iterable[Blob]: + """Yield audio blobs for each url.""" + + try: + import yt_dlp + except ImportError: + raise ImportError( + "yt_dlp package not found, please install it with `pip install yt_dlp`" + ) + + # Use yt_dlp to download audio given a YouTube url + ydl_opts = { + "format": "m4a/bestaudio/best", + "noplaylist": True, + "outtmpl": self.save_dir + "/%(title)s.%(ext)s", + "postprocessors": [ + { + "key": "FFmpegExtractAudio", + "preferredcodec": "m4a", + } + ], + } + + for url in self.urls: + # Download file + with yt_dlp.YoutubeDL(ydl_opts) as ydl: + ydl.download(url) + + # Yield the written blobs + loader = FileSystemBlobLoader(self.save_dir, glob="*.m4a") + for blob in loader.yield_blobs(): + yield blob diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9712718e19714985e211135afdea820a01110245 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__init__.py @@ -0,0 +1,85 @@ +import importlib +from typing import TYPE_CHECKING, Any + +if TYPE_CHECKING: + from langchain_community.document_loaders.parsers.audio import ( + OpenAIWhisperParser, + ) + from langchain_community.document_loaders.parsers.doc_intelligence import ( + AzureAIDocumentIntelligenceParser, + ) + from langchain_community.document_loaders.parsers.docai import ( + DocAIParser, + ) + from langchain_community.document_loaders.parsers.grobid import ( + GrobidParser, + ) + from langchain_community.document_loaders.parsers.html import ( + BS4HTMLParser, + ) + from langchain_community.document_loaders.parsers.images import ( + BaseImageBlobParser, + LLMImageBlobParser, + RapidOCRBlobParser, + TesseractBlobParser, + ) + from langchain_community.document_loaders.parsers.language import ( + LanguageParser, + ) + from langchain_community.document_loaders.parsers.pdf import ( + PDFMinerParser, + PDFPlumberParser, + PyMuPDFParser, + PyPDFium2Parser, + PyPDFParser, + ) + from langchain_community.document_loaders.parsers.vsdx import ( + VsdxParser, + ) + + +_module_lookup = { + "AzureAIDocumentIntelligenceParser": "langchain_community.document_loaders.parsers.doc_intelligence", # noqa: E501 + "BS4HTMLParser": "langchain_community.document_loaders.parsers.html", + "BaseImageBlobParser": "langchain_community.document_loaders.parsers.images", + "DocAIParser": "langchain_community.document_loaders.parsers.docai", + "GrobidParser": "langchain_community.document_loaders.parsers.grobid", + "LanguageParser": "langchain_community.document_loaders.parsers.language", + "LLMImageBlobParser": "langchain_community.document_loaders.parsers.images", + "OpenAIWhisperParser": "langchain_community.document_loaders.parsers.audio", + "PDFMinerParser": "langchain_community.document_loaders.parsers.pdf", + "PDFPlumberParser": "langchain_community.document_loaders.parsers.pdf", + "PyMuPDFParser": "langchain_community.document_loaders.parsers.pdf", + "PyPDFParser": "langchain_community.document_loaders.parsers.pdf", + "PyPDFium2Parser": "langchain_community.document_loaders.parsers.pdf", + "RapidOCRBlobParser": "langchain_community.document_loaders.parsers.images", + "TesseractBlobParser": "langchain_community.document_loaders.parsers.images", + "VsdxParser": "langchain_community.document_loaders.parsers.vsdx", +} + + +def __getattr__(name: str) -> Any: + if name in _module_lookup: + module = importlib.import_module(_module_lookup[name]) + return getattr(module, name) + raise AttributeError(f"module {__name__} has no attribute {name}") + + +__all__ = [ + "AzureAIDocumentIntelligenceParser", + "BaseImageBlobParser", + "BS4HTMLParser", + "DocAIParser", + "GrobidParser", + "LanguageParser", + "LLMImageBlobParser", + "OpenAIWhisperParser", + "PDFMinerParser", + "PDFPlumberParser", + "PyMuPDFParser", + "PyPDFParser", + "PyPDFium2Parser", + "RapidOCRBlobParser", + "TesseractBlobParser", + "VsdxParser", +] diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a1b629b95a0d8663eb15d40c13a73d58ae611877 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/audio.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/audio.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9fab8cacee3af22fdee3efc9d9847dc6130cda9e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/audio.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/doc_intelligence.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/doc_intelligence.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c1a91f280b2070188447fb457cf271b496d7dec9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/doc_intelligence.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/docai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/docai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dad1c333dc6209eeba2dd6bc72d66aa80989f657 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/docai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/documentloader_adapter.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/documentloader_adapter.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..962c1328ae38f83985f9261147192f0b5baf5636 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/documentloader_adapter.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/generic.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/generic.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1d7550635cb58a5caea06630e4dc73e1697db4dc Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/generic.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/grobid.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/grobid.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0b6ca2951f6f7f1b8026cedacf5e067769c13972 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/grobid.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/images.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/images.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0ebe5ddb3523af449a2b181cd6f425305c4c5cc5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/images.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/msword.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/msword.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..62302c0ffd4c835029dd8b4bda64ad11f4658d9d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/msword.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/pdf.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/pdf.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5fa8cdf1a0f9cb14e63c0248e19e461561e4f587 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/pdf.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/registry.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/registry.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e2d97700bcfcfcbee36a55501b68544653871f4c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/registry.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/txt.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/txt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fd1270eb486a3bdb1f4a0d1e8cd45978dbfc53d8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/txt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/vsdx.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/vsdx.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..90edf4d116417a7b7a2b84ec0ef8f7e1043cf0ee Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/__pycache__/vsdx.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/audio.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/audio.py new file mode 100644 index 0000000000000000000000000000000000000000..e03dec6e28cd588256420c618084c9dc21beb72b --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/audio.py @@ -0,0 +1,684 @@ +import io +import logging +import os +import time +from typing import Any, Callable, Dict, Iterator, Literal, Optional, Tuple, Union + +from langchain_core.documents import Document + +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.blob_loaders import Blob +from langchain_community.utils.openai import is_openai_v1 + +logger = logging.getLogger(__name__) + + +class AzureOpenAIWhisperParser(BaseBlobParser): + """ + Transcribe and parse audio files using Azure OpenAI Whisper. + + This parser integrates with the Azure OpenAI Whisper model to transcribe + audio files. It differs from the standard OpenAI Whisper parser, requiring + an Azure endpoint and credentials. The parser is limited to files under 25 MB. + + **Note**: + This parser uses the Azure OpenAI API, providing integration with the Azure + ecosystem, and making it suitable for workflows involving other Azure services. + + For files larger than 25 MB, consider using Azure AI Speech batch transcription: + https://learn.microsoft.com/azure/ai-services/speech-service/batch-transcription-create?pivots=rest-api#use-a-whisper-model + + Setup: + 1. Follow the instructions here to deploy Azure Whisper: + https://learn.microsoft.com/azure/ai-services/openai/whisper-quickstart?tabs=command-line%2Cpython-new&pivots=programming-language-python + 2. Install ``langchain`` and set the following environment variables: + + .. code-block:: bash + + pip install -U langchain langchain-community + + export AZURE_OPENAI_API_KEY="your-api-key" + export AZURE_OPENAI_ENDPOINT="https://your-endpoint.openai.azure.com/" + export OPENAI_API_VERSION="your-api-version" + + Example Usage: + .. code-block:: python + + from langchain_classic.community import AzureOpenAIWhisperParser + + whisper_parser = AzureOpenAIWhisperParser( + deployment_name="your-whisper-deployment", + api_version="2024-06-01", + api_key="your-api-key", + # other params... + ) + + audio_blob = Blob(path="your-audio-file-path") + response = whisper_parser.lazy_parse(audio_blob) + + for document in response: + print(document.page_content) + + Integration with Other Loaders: + The AzureOpenAIWhisperParser can be used with video/audio loaders and + `GenericLoader` to automate retrieval and parsing. + + YoutubeAudioLoader Example: + .. code-block:: python + + from langchain_community.document_loaders.blob_loaders import ( + YoutubeAudioLoader + ) + from langchain_community.document_loaders.generic import GenericLoader + + # Must be a list + youtube_url = ["https://your-youtube-url"] + save_dir = "directory-to-download-videos" + + loader = GenericLoader( + YoutubeAudioLoader(youtube_url, save_dir), + AzureOpenAIWhisperParser(deployment_name="your-deployment-name") + ) + + docs = loader.load() + """ + + def __init__( + self, + *, + api_key: Optional[str] = None, + azure_endpoint: Optional[str] = None, + api_version: Optional[str] = None, + azure_ad_token_provider: Union[Callable[[], str], None] = None, + language: Optional[str] = None, + prompt: Optional[str] = None, + response_format: Union[ + Literal["json", "text", "srt", "verbose_json", "vtt"], None + ] = None, + temperature: Optional[float] = None, + deployment_name: str, + max_retries: int = 3, + ): + """ + Initialize the AzureOpenAIWhisperParser. + + Args: + api_key (Optional[str]): + Azure OpenAI API key. If not provided, defaults to the + `AZURE_OPENAI_API_KEY` environment variable. + azure_endpoint (Optional[str]): + Azure OpenAI service endpoint. Defaults to `AZURE_OPENAI_ENDPOINT` + environment variable if not set. + api_version (Optional[str]): + API version to use, + defaults to the `OPENAI_API_VERSION` environment variable. + azure_ad_token_provider (Union[Callable[[], str], None]): + Azure Active Directory token for authentication (if applicable). + language (Optional[str]): + Language in which the request should be processed. + prompt (Optional[str]): + Custom instructions or prompt for the Whisper model. + response_format (Union[str, None]): + The desired output format. Options: "json", "text", "srt", + "verbose_json", "vtt". + temperature (Optional[float]): + Controls the randomness of the model's output. + deployment_name (str): + The deployment name of the Whisper model. + max_retries (int): + Maximum number of retries for failed API requests. + Raises: + ImportError: + If the required package `openai` is not installed. + """ + self.api_key = api_key or os.environ.get("AZURE_OPENAI_API_KEY") + self.azure_endpoint = azure_endpoint or os.environ.get("AZURE_OPENAI_ENDPOINT") + self.api_version = api_version or os.environ.get("OPENAI_API_VERSION") + self.azure_ad_token_provider = azure_ad_token_provider + + self.language = language + self.prompt = prompt + self.response_format = response_format + self.temperature = temperature + + self.deployment_name = deployment_name + self.max_retries = max_retries + + try: + import openai + except ImportError: + raise ImportError( + "openai package not found, please install it with `pip install openai`" + ) + + if is_openai_v1(): + self._client = openai.AzureOpenAI( + api_key=self.api_key, + azure_endpoint=self.azure_endpoint, + api_version=self.api_version, + max_retries=self.max_retries, + azure_ad_token_provider=self.azure_ad_token_provider, + ) + else: + if self.api_key: + openai.api_key = self.api_key + if self.azure_endpoint: + openai.api_base = self.azure_endpoint + if self.api_version: + openai.api_version = self.api_version + openai.api_type = "azure" + self._client = openai + + @property + def _create_params(self) -> Dict[str, Any]: + params = { + "language": self.language, + "prompt": self.prompt, + "response_format": self.response_format, + "temperature": self.temperature, + } + return {k: v for k, v in params.items() if v is not None} + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """ + Lazily parse the provided audio blob for transcription. + + Args: + blob (Blob): + The audio file in Blob format to be transcribed. + + Yields: + Document: + Parsed transcription from the audio file. + + Raises: + Exception: + If an error occurs during transcription. + """ + + file_obj = open(str(blob.path), "rb") + + # Transcribe + try: + if is_openai_v1(): + transcript = self._client.audio.transcriptions.create( + model=self.deployment_name, + file=file_obj, + **self._create_params, + ) + else: + transcript = self._client.Audio.transcribe( + model=self.deployment_name, + deployment_id=self.deployment_name, + file=file_obj, + **self._create_params, + ) + except Exception: + raise + + yield Document( + page_content=transcript.text + if not isinstance(transcript, str) + else transcript, + metadata={"source": blob.source}, + ) + + +class OpenAIWhisperParser(BaseBlobParser): + """Transcribe and parse audio files. + + Audio transcription is with OpenAI Whisper model. + + Args: + api_key: OpenAI API key + chunk_duration_threshold: Minimum duration of a chunk in seconds + NOTE: According to the OpenAI API, the chunk duration should be at least 0.1 + seconds. If the chunk duration is less or equal than the threshold, + it will be skipped. + """ + + def __init__( + self, + api_key: Optional[str] = None, + *, + chunk_duration_threshold: float = 0.1, + base_url: Optional[str] = None, + language: Union[str, None] = None, + prompt: Union[str, None] = None, + response_format: Union[ + Literal["json", "text", "srt", "verbose_json", "vtt"], None + ] = None, + temperature: Union[float, None] = None, + model: str = "whisper-1", + ): + self.api_key = api_key + self.chunk_duration_threshold = chunk_duration_threshold + self.base_url = ( + base_url if base_url is not None else os.environ.get("OPENAI_API_BASE") + ) + self.language = language + self.prompt = prompt + self.response_format = response_format + self.temperature = temperature + self.model = model + + @property + def _create_params(self) -> Dict[str, Any]: + params = { + "language": self.language, + "prompt": self.prompt, + "response_format": self.response_format, + "temperature": self.temperature, + } + return {k: v for k, v in params.items() if v is not None} + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Lazily parse the blob.""" + + try: + import openai + except ImportError: + raise ImportError( + "openai package not found, please install it with `pip install openai`" + ) + + audio = _get_audio_from_blob(blob) + + if is_openai_v1(): + # api_key optional, defaults to `os.environ['OPENAI_API_KEY']` + client = openai.OpenAI(api_key=self.api_key, base_url=self.base_url) + else: + # Set the API key if provided + if self.api_key: + openai.api_key = self.api_key + if self.base_url: + openai.api_base = self.base_url + + # Define the duration of each chunk in minutes + # Need to meet 25MB size limit for Whisper API + chunk_duration = 20 + chunk_duration_ms = chunk_duration * 60 * 1000 + + # Split the audio into chunk_duration_ms chunks + for split_number, i in enumerate(range(0, len(audio), chunk_duration_ms)): + # Audio chunk + chunk = audio[i : i + chunk_duration_ms] + # Skip chunks that are too short to transcribe + if chunk.duration_seconds <= self.chunk_duration_threshold: + continue + file_obj = io.BytesIO(chunk.export(format="mp3").read()) + if blob.source is not None: + file_obj.name = blob.source + f"_part_{split_number}.mp3" + else: + file_obj.name = f"part_{split_number}.mp3" + + # Transcribe + print(f"Transcribing part {split_number + 1}!") # noqa: T201 + attempts = 0 + while attempts < 3: + try: + if is_openai_v1(): + transcript = client.audio.transcriptions.create( + model=self.model, file=file_obj, **self._create_params + ) + else: + transcript = openai.Audio.transcribe(self.model, file_obj) + break + except Exception as e: + attempts += 1 + print(f"Attempt {attempts} failed. Exception: {str(e)}") # noqa: T201 + time.sleep(5) + else: + print("Failed to transcribe after 3 attempts.") # noqa: T201 + continue + + yield Document( + page_content=transcript.text + if not isinstance(transcript, str) + else transcript, + metadata={"source": blob.source, "chunk": split_number}, + ) + + +class OpenAIWhisperParserLocal(BaseBlobParser): + """Transcribe and parse audio files with OpenAI Whisper model. + + Audio transcription with OpenAI Whisper model locally from transformers. + + Parameters: + device - device to use + NOTE: By default uses the gpu if available, + if you want to use cpu, please set device = "cpu" + lang_model - whisper model to use, for example "openai/whisper-medium" + forced_decoder_ids - id states for decoder in multilanguage model, + usage example: + from transformers import WhisperProcessor + processor = WhisperProcessor.from_pretrained("openai/whisper-medium") + forced_decoder_ids = WhisperProcessor.get_decoder_prompt_ids(language="french", + task="transcribe") + forced_decoder_ids = WhisperProcessor.get_decoder_prompt_ids(language="french", + task="translate") + + + + """ + + def __init__( + self, + device: str = "0", + lang_model: Optional[str] = None, + batch_size: int = 8, + chunk_length: int = 30, + forced_decoder_ids: Optional[Tuple[Dict]] = None, + ): + """Initialize the parser. + + Args: + device: device to use. + lang_model: whisper model to use, for example "openai/whisper-medium". + Defaults to None. + forced_decoder_ids: id states for decoder in a multilanguage model. + Defaults to None. + batch_size: batch size used for decoding + Defaults to 8. + chunk_length: chunk length used during inference. + Defaults to 30s. + """ + try: + from transformers import pipeline + except ImportError: + raise ImportError( + "transformers package not found, please install it with " + "`pip install transformers`" + ) + try: + import torch + except ImportError: + raise ImportError( + "torch package not found, please install it with `pip install torch`" + ) + + # Determine the device to use + if device == "cpu": + self.device = "cpu" + else: + self.device = "cuda:0" if torch.cuda.is_available() else "cpu" + + if self.device == "cpu": + default_model = "openai/whisper-base" + self.lang_model = lang_model if lang_model else default_model + else: + # Set the language model based on the device and available memory + mem = torch.cuda.get_device_properties(self.device).total_memory / (1024**2) + if mem < 5000: + rec_model = "openai/whisper-base" + elif mem < 7000: + rec_model = "openai/whisper-small" + elif mem < 12000: + rec_model = "openai/whisper-medium" + else: + rec_model = "openai/whisper-large" + self.lang_model = lang_model if lang_model else rec_model + + print("Using the following model: ", self.lang_model) # noqa: T201 + + self.batch_size = batch_size + + # load model for inference + self.pipe = pipeline( + "automatic-speech-recognition", + model=self.lang_model, + chunk_length_s=chunk_length, + device=self.device, + ) + if forced_decoder_ids is not None: + try: + self.pipe.model.config.forced_decoder_ids = forced_decoder_ids + except Exception as exception_text: + logger.info( + "Unable to set forced_decoder_ids parameter for whisper model" + f"Text of exception: {exception_text}" + "Therefore whisper model will use default mode for decoder" + ) + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Lazily parse the blob.""" + + try: + import librosa + except ImportError: + raise ImportError( + "librosa package not found, please install it with " + "`pip install librosa`" + ) + + audio = _get_audio_from_blob(blob) + + file_obj = io.BytesIO(audio.export(format="mp3").read()) + + # Transcribe + print(f"Transcribing part {blob.path}!") # noqa: T201 + + y, sr = librosa.load(file_obj, sr=16000) + + prediction = self.pipe(y.copy(), batch_size=self.batch_size)["text"] + + yield Document( + page_content=prediction, + metadata={"source": blob.source}, + ) + + +class YandexSTTParser(BaseBlobParser): + """Transcribe and parse audio files. + Audio transcription is with OpenAI Whisper model.""" + + def __init__( + self, + *, + api_key: Optional[str] = None, + iam_token: Optional[str] = None, + model: str = "general", + language: str = "auto", + ): + """Initialize the parser. + + Args: + api_key: API key for a service account + with the `ai.speechkit-stt.user` role. + iam_token: IAM token for a service account + with the `ai.speechkit-stt.user` role. + model: Recognition model name. + Defaults to general. + language: The language in ISO 639-1 format. + Defaults to automatic language recognition. + Either `api_key` or `iam_token` must be provided, but not both. + """ + if (api_key is None) == (iam_token is None): + raise ValueError( + "Either 'api_key' or 'iam_token' must be provided, but not both." + ) + self.api_key = api_key + self.iam_token = iam_token + self.model = model + self.language = language + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Lazily parse the blob.""" + + try: + from speechkit import configure_credentials, creds, model_repository + from speechkit.stt import AudioProcessingType + except ImportError: + raise ImportError( + "yandex-speechkit package not found, please install it with " + "`pip install yandex-speechkit`" + ) + + audio = _get_audio_from_blob(blob) + + if self.api_key: + configure_credentials( + yandex_credentials=creds.YandexCredentials(api_key=self.api_key) + ) + else: + configure_credentials( + yandex_credentials=creds.YandexCredentials(iam_token=self.iam_token) + ) + + model = model_repository.recognition_model() + + model.model = self.model + model.language = self.language + model.audio_processing_type = AudioProcessingType.Full + + result = model.transcribe(audio) + + for res in result: + yield Document( + page_content=res.normalized_text, + metadata={"source": blob.source}, + ) + + +class FasterWhisperParser(BaseBlobParser): + """Transcribe and parse audio files with faster-whisper. + + faster-whisper is a reimplementation of OpenAI's Whisper model using CTranslate2, + which is up to 4 times faster than openai/whisper for the same accuracy while using + less memory. The efficiency can be further improved with 8-bit quantization on both + CPU and GPU. + + It can automatically detect the following 14 languages and transcribe the text + into their respective languages: en, zh, fr, de, ja, ko, ru, es, th, it, pt, vi, + ar, tr. + + The gitbub repository for faster-whisper is : + https://github.com/SYSTRAN/faster-whisper + + Example: Load a YouTube video and transcribe the video speech into a document. + .. code-block:: python + + from langchain_classic.document_loaders.generic import GenericLoader + from langchain_community.document_loaders.parsers.audio + import FasterWhisperParser + from langchain_classic.document_loaders.blob_loaders.youtube_audio + import YoutubeAudioLoader + + + url="https://www.youtube.com/watch?v=your_video" + save_dir="your_dir/" + loader = GenericLoader( + YoutubeAudioLoader([url],save_dir), + FasterWhisperParser() + ) + docs = loader.load() + + """ + + def __init__( + self, + *, + device: Optional[str] = "cuda", + model_size: Optional[str] = None, + ): + """Initialize the parser. + + Args: + device: It can be "cuda" or "cpu" based on the available device. + model_size: There are four model sizes to choose from: "base", "small", + "medium", and "large-v3", based on the available GPU memory. + """ + try: + import torch + except ImportError: + raise ImportError( + "torch package not found, please install it with `pip install torch`" + ) + + # Determine the device to use + if device == "cpu": + self.device = "cpu" + else: + self.device = "cuda" if torch.cuda.is_available() else "cpu" + + # Determine the model_size + if self.device == "cpu": + self.model_size = "base" + else: + # Set the model_size based on the available memory + mem = torch.cuda.get_device_properties(self.device).total_memory / (1024**2) + if mem < 1000: + self.model_size = "base" + elif mem < 3000: + self.model_size = "small" + elif mem < 5000: + self.model_size = "medium" + else: + self.model_size = "large-v3" + # If the user has assigned a model size, then use the assigned size + if model_size is not None: + if model_size in ["base", "small", "medium", "large-v3"]: + self.model_size = model_size + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Lazily parse the blob.""" + + try: + from faster_whisper import WhisperModel + except ImportError: + raise ImportError( + "faster_whisper package not found, please install it with " + "`pip install faster-whisper`" + ) + + audio = _get_audio_from_blob(blob) + + file_obj = io.BytesIO(audio.export(format="mp3").read()) + + # Transcribe + model = WhisperModel(self.model_size, device=self.device) + + segments, info = model.transcribe(file_obj, beam_size=5) + + for segment in segments: + yield Document( + page_content=segment.text, + metadata={ + "source": blob.source, + "timestamps": "[%.2fs -> %.2fs]" % (segment.start, segment.end), + "language": info.language, + "probability": "%d%%" % round(info.language_probability * 100), + **blob.metadata, + }, + ) + + +def _get_audio_from_blob(blob: Blob) -> Any: + """Get audio data from blob. + + Args: + blob: Blob object containing the audio data. + + Returns: + AudioSegment: Audio data from the blob. + + Raises: + ImportError: If the required package `pydub` is not installed. + ValueError: If the audio data is not found in the blob + """ + try: + from pydub import AudioSegment + except ImportError: + raise ImportError( + "pydub package not found, please install it with `pip install pydub`" + ) + + if isinstance(blob.data, bytes): + audio = AudioSegment.from_file(io.BytesIO(blob.data)) + elif blob.data is None and blob.path: + audio = AudioSegment.from_file(blob.path) + else: + raise ValueError("Unable to get audio from blob") + + return audio diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/doc_intelligence.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/doc_intelligence.py new file mode 100644 index 0000000000000000000000000000000000000000..f122f4dbabb5e3c99bf2e16ef2fdc31256d469c5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/doc_intelligence.py @@ -0,0 +1,136 @@ +from __future__ import annotations + +import logging +from typing import TYPE_CHECKING, Any, Iterator, List, Optional, Union + +from langchain_core.documents import Document + +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.blob_loaders import Blob + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + +logger = logging.getLogger(__name__) + + +class AzureAIDocumentIntelligenceParser(BaseBlobParser): + """Loads a PDF with Azure Document Intelligence + (formerly Forms Recognizer).""" + + def __init__( + self, + api_endpoint: str, + api_key: Optional[str] = None, + api_version: Optional[str] = None, + api_model: str = "prebuilt-layout", + mode: str = "markdown", + analysis_features: Optional[List[str]] = None, + azure_credential: Optional["TokenCredential"] = None, + ): + from azure.ai.documentintelligence import DocumentIntelligenceClient + from azure.ai.documentintelligence.models import DocumentAnalysisFeature + from azure.core.credentials import AzureKeyCredential + + kwargs = {} + + credential: Union[AzureKeyCredential, TokenCredential] + if azure_credential: + if api_key is not None: + raise ValueError( + "Only one of api_key or azure_credential should be provided." + ) + credential = azure_credential + elif api_key is not None: + credential = AzureKeyCredential(api_key) + else: + raise ValueError("Either api_key or azure_credential must be provided.") + + if api_version is not None: + kwargs["api_version"] = api_version + + self.client = DocumentIntelligenceClient( + endpoint=api_endpoint, + credential=credential, + headers={"x-ms-useragent": "langchain-parser/1.0.0"}, + **kwargs, + ) + self.api_model = api_model + self.mode = mode + self.features: Optional[List[DocumentAnalysisFeature]] = None + if analysis_features is not None: + self.features = [ + DocumentAnalysisFeature(feature) for feature in analysis_features + ] + assert self.mode in ["single", "page", "markdown"] + + def _generate_docs_page(self, result: Any) -> Iterator[Document]: + for p in result.pages: + content = " ".join([line.content for line in p.lines]) + + d = Document( + page_content=content, + metadata={ + "page": p.page_number, + }, + ) + yield d + + def _generate_docs_single(self, result: Any) -> Iterator[Document]: + yield Document(page_content=result.content, metadata=result.as_dict()) + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Lazily parse the blob.""" + + with blob.as_bytes_io() as file_obj: + poller = self.client.begin_analyze_document( + self.api_model, + body=file_obj, + content_type="application/octet-stream", + output_content_format="markdown" if self.mode == "markdown" else "text", + features=self.features, + ) + result = poller.result() + + if self.mode in ["single", "markdown"]: + yield from self._generate_docs_single(result) + elif self.mode in ["page"]: + yield from self._generate_docs_page(result) + else: + raise ValueError(f"Invalid mode: {self.mode}") + + def parse_url(self, url: str) -> Iterator[Document]: + from azure.ai.documentintelligence.models import AnalyzeDocumentRequest + + poller = self.client.begin_analyze_document( + self.api_model, + body=AnalyzeDocumentRequest(url_source=url), + output_content_format="markdown" if self.mode == "markdown" else "text", + features=self.features, + ) + result = poller.result() + + if self.mode in ["single", "markdown"]: + yield from self._generate_docs_single(result) + elif self.mode in ["page"]: + yield from self._generate_docs_page(result) + else: + raise ValueError(f"Invalid mode: {self.mode}") + + def parse_bytes(self, bytes_source: bytes) -> Iterator[Document]: + from azure.ai.documentintelligence.models import AnalyzeDocumentRequest + + poller = self.client.begin_analyze_document( + self.api_model, + body=AnalyzeDocumentRequest(bytes_source=bytes_source), + output_content_format="markdown" if self.mode == "markdown" else "text", + features=self.features, + ) + result = poller.result() + + if self.mode in ["single", "markdown"]: + yield from self._generate_docs_single(result) + elif self.mode in ["page"]: + yield from self._generate_docs_page(result) + else: + raise ValueError(f"Invalid mode: {self.mode}") diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/docai.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/docai.py new file mode 100644 index 0000000000000000000000000000000000000000..b17b52ebcb069929c838a6e15e637d2688897552 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/docai.py @@ -0,0 +1,395 @@ +"""Module contains a PDF parser based on Document AI from Google Cloud. + +You need to install two libraries to use this parser: +pip install google-cloud-documentai +pip install google-cloud-documentai-toolbox +""" + +import logging +import re +import time +from dataclasses import dataclass +from typing import TYPE_CHECKING, Iterator, List, Optional, Sequence + +from langchain_core._api.deprecation import deprecated +from langchain_core.documents import Document +from langchain_core.utils.iter import batch_iterate + +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.blob_loaders import Blob +from langchain_community.utilities.vertexai import get_client_info + +if TYPE_CHECKING: + from google.api_core.operation import Operation + from google.cloud.documentai import DocumentProcessorServiceClient + + +logger = logging.getLogger(__name__) + + +@dataclass +class DocAIParsingResults: + """Dataclass to store Document AI parsing results.""" + + source_path: str + parsed_path: str + + +@deprecated( + since="0.0.32", + removal="1.0", + alternative_import="langchain_google_community.DocAIParser", +) +class DocAIParser(BaseBlobParser): + """`Google Cloud Document AI` parser. + + For a detailed explanation of Document AI, refer to the product documentation. + https://cloud.google.com/document-ai/docs/overview + """ + + def __init__( + self, + *, + client: Optional["DocumentProcessorServiceClient"] = None, + location: Optional[str] = None, + gcs_output_path: Optional[str] = None, + processor_name: Optional[str] = None, + ): + """Initializes the parser. + + Args: + client: a DocumentProcessorServiceClient to use + location: a Google Cloud location where a Document AI processor is located + gcs_output_path: a path on Google Cloud Storage to store parsing results + processor_name: full resource name of a Document AI processor or processor + version + + You should provide either a client or location (and then a client + would be instantiated). + """ + + if bool(client) == bool(location): + raise ValueError( + "You must specify either a client or a location to instantiate " + "a client." + ) + + pattern = r"projects\/[0-9]+\/locations\/[a-z\-0-9]+\/processors\/[a-z0-9]+" + if processor_name and not re.fullmatch(pattern, processor_name): + raise ValueError( + f"Processor name {processor_name} has the wrong format. If your " + "prediction endpoint looks like https://us-documentai.googleapis.com" + "/v1/projects/PROJECT_ID/locations/us/processors/PROCESSOR_ID:process," + " use only projects/PROJECT_ID/locations/us/processors/PROCESSOR_ID " + "part." + ) + + self._gcs_output_path = gcs_output_path + self._processor_name = processor_name + if client: + self._client = client + else: + try: + from google.api_core.client_options import ClientOptions + from google.cloud.documentai import DocumentProcessorServiceClient + except ImportError as exc: + raise ImportError( + "documentai package not found, please install it with" + " `pip install google-cloud-documentai`" + ) from exc + options = ClientOptions( + api_endpoint=f"{location}-documentai.googleapis.com" + ) + self._client = DocumentProcessorServiceClient( + client_options=options, + client_info=get_client_info(module="document-ai"), + ) + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Parses a blob lazily. + + Args: + blobs: a Blob to parse + + This is a long-running operation. A recommended way is to batch + documents together and use the `batch_parse()` method. + """ + yield from self.batch_parse([blob], gcs_output_path=self._gcs_output_path) + + def online_process( + self, + blob: Blob, + enable_native_pdf_parsing: bool = True, + field_mask: Optional[str] = None, + page_range: Optional[List[int]] = None, + ) -> Iterator[Document]: + """Parses a blob lazily using online processing. + + Args: + blob: a blob to parse. + enable_native_pdf_parsing: enable pdf embedded text extraction + field_mask: a comma-separated list of which fields to include in the + Document AI response. + suggested: "text,pages.pageNumber,pages.layout" + page_range: list of page numbers to parse. If `None`, + entire document will be parsed. + """ + try: + from google.cloud import documentai + from google.cloud.documentai_v1.types import ( + IndividualPageSelector, + OcrConfig, + ProcessOptions, + ) + except ImportError as exc: + raise ImportError( + "documentai package not found, please install it with" + " `pip install google-cloud-documentai`" + ) from exc + try: + from google.cloud.documentai_toolbox.wrappers.page import _text_from_layout + except ImportError as exc: + raise ImportError( + "documentai_toolbox package not found, please install it with" + " `pip install google-cloud-documentai-toolbox`" + ) from exc + ocr_config = ( + OcrConfig(enable_native_pdf_parsing=enable_native_pdf_parsing) + if enable_native_pdf_parsing + else None + ) + individual_page_selector = ( + IndividualPageSelector(pages=page_range) if page_range else None + ) + + response = self._client.process_document( + documentai.ProcessRequest( + name=self._processor_name, + gcs_document=documentai.GcsDocument( + gcs_uri=blob.path, + mime_type=blob.mimetype or "application/pdf", + ), + process_options=ProcessOptions( + ocr_config=ocr_config, + individual_page_selector=individual_page_selector, + ), + skip_human_review=True, + field_mask=field_mask, + ) + ) + yield from ( + Document( + page_content=_text_from_layout(page.layout, response.document.text), + metadata={ + "page": page.page_number, + "source": blob.path, + }, + ) + for page in response.document.pages + ) + + def batch_parse( + self, + blobs: Sequence[Blob], + gcs_output_path: Optional[str] = None, + timeout_sec: int = 3600, + check_in_interval_sec: int = 60, + ) -> Iterator[Document]: + """Parses a list of blobs lazily. + + Args: + blobs: a list of blobs to parse. + gcs_output_path: a path on Google Cloud Storage to store parsing results. + timeout_sec: a timeout to wait for Document AI to complete, in seconds. + check_in_interval_sec: an interval to wait until next check + whether parsing operations have been completed, in seconds + This is a long-running operation. A recommended way is to decouple + parsing from creating LangChain Documents: + >>> operations = parser.docai_parse(blobs, gcs_path) + >>> parser.is_running(operations) + You can get operations names and save them: + >>> names = [op.operation.name for op in operations] + And when all operations are finished, you can use their results: + >>> operations = parser.operations_from_names(operation_names) + >>> results = parser.get_results(operations) + >>> docs = parser.parse_from_results(results) + """ + output_path = gcs_output_path or self._gcs_output_path + if not output_path: + raise ValueError( + "An output path on Google Cloud Storage should be provided." + ) + operations = self.docai_parse(blobs, gcs_output_path=output_path) + operation_names = [op.operation.name for op in operations] + logger.debug( + "Started parsing with Document AI, submitted operations %s", operation_names + ) + time_elapsed = 0 + while self.is_running(operations): + time.sleep(check_in_interval_sec) + time_elapsed += check_in_interval_sec + if time_elapsed > timeout_sec: + raise TimeoutError( + f"Timeout exceeded! Check operations {operation_names} later!" + ) + logger.debug(".") + + results = self.get_results(operations=operations) + yield from self.parse_from_results(results) + + def parse_from_results( + self, results: List[DocAIParsingResults] + ) -> Iterator[Document]: + try: + from google.cloud.documentai_toolbox.utilities.gcs_utilities import ( + split_gcs_uri, + ) + from google.cloud.documentai_toolbox.wrappers.document import _get_shards + from google.cloud.documentai_toolbox.wrappers.page import _text_from_layout + except ImportError as exc: + raise ImportError( + "documentai_toolbox package not found, please install it with" + " `pip install google-cloud-documentai-toolbox`" + ) from exc + for result in results: + gcs_bucket_name, gcs_prefix = split_gcs_uri(result.parsed_path) + shards = _get_shards(gcs_bucket_name, gcs_prefix) + yield from ( + Document( + page_content=_text_from_layout(page.layout, shard.text), + metadata={"page": page.page_number, "source": result.source_path}, + ) + for shard in shards + for page in shard.pages + ) + + def operations_from_names(self, operation_names: List[str]) -> List["Operation"]: + """Initializes Long-Running Operations from their names.""" + try: + from google.longrunning.operations_pb2 import ( + GetOperationRequest, + ) + except ImportError as exc: + raise ImportError( + "long running operations package not found, please install it with" + " `pip install gapic-google-longrunning`" + ) from exc + + return [ + self._client.get_operation(request=GetOperationRequest(name=name)) + for name in operation_names + ] + + def is_running(self, operations: List["Operation"]) -> bool: + return any(not op.done() for op in operations) + + def docai_parse( + self, + blobs: Sequence[Blob], + *, + gcs_output_path: Optional[str] = None, + processor_name: Optional[str] = None, + batch_size: int = 1000, + enable_native_pdf_parsing: bool = True, + field_mask: Optional[str] = None, + ) -> List["Operation"]: + """Runs Google Document AI PDF Batch Processing on a list of blobs. + + Args: + blobs: a list of blobs to be parsed + gcs_output_path: a path (folder) on GCS to store results + processor_name: name of a Document AI processor. + batch_size: amount of documents per batch + enable_native_pdf_parsing: a config option for the parser + field_mask: a comma-separated list of which fields to include in the + Document AI response. + suggested: "text,pages.pageNumber,pages.layout" + + Document AI has a 1000 file limit per batch, so batches larger than that need + to be split into multiple requests. + Batch processing is an async long-running operation + and results are stored in a output GCS bucket. + """ + try: + from google.cloud import documentai + from google.cloud.documentai_v1.types import OcrConfig, ProcessOptions + except ImportError as exc: + raise ImportError( + "documentai package not found, please install it with" + " `pip install google-cloud-documentai`" + ) from exc + + output_path = gcs_output_path or self._gcs_output_path + if output_path is None: + raise ValueError( + "An output path on Google Cloud Storage should be provided." + ) + processor_name = processor_name or self._processor_name + if processor_name is None: + raise ValueError("A Document AI processor name should be provided.") + + operations = [] + for batch in batch_iterate(size=batch_size, iterable=blobs): + input_config = documentai.BatchDocumentsInputConfig( + gcs_documents=documentai.GcsDocuments( + documents=[ + documentai.GcsDocument( + gcs_uri=blob.path, + mime_type=blob.mimetype or "application/pdf", + ) + for blob in batch + ] + ) + ) + + output_config = documentai.DocumentOutputConfig( + gcs_output_config=documentai.DocumentOutputConfig.GcsOutputConfig( + gcs_uri=output_path, field_mask=field_mask + ) + ) + + process_options = ( + ProcessOptions( + ocr_config=OcrConfig( + enable_native_pdf_parsing=enable_native_pdf_parsing + ) + ) + if enable_native_pdf_parsing + else None + ) + operations.append( + self._client.batch_process_documents( + documentai.BatchProcessRequest( + name=processor_name, + input_documents=input_config, + document_output_config=output_config, + process_options=process_options, + skip_human_review=True, + ) + ) + ) + return operations + + def get_results(self, operations: List["Operation"]) -> List[DocAIParsingResults]: + try: + from google.cloud.documentai_v1 import BatchProcessMetadata + except ImportError as exc: + raise ImportError( + "documentai package not found, please install it with" + " `pip install google-cloud-documentai`" + ) from exc + + return [ + DocAIParsingResults( + source_path=status.input_gcs_source, + parsed_path=status.output_gcs_destination, + ) + for op in operations + for status in ( + op.metadata.individual_process_statuses + if isinstance(op.metadata, BatchProcessMetadata) + else BatchProcessMetadata.deserialize( + op.metadata.value + ).individual_process_statuses + ) + ] diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/documentloader_adapter.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/documentloader_adapter.py new file mode 100644 index 0000000000000000000000000000000000000000..93f6bb9ea12d6f8ff198c7e0e8e58eb113c15a65 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/documentloader_adapter.py @@ -0,0 +1,67 @@ +import inspect +from typing import Any, Dict, Iterator, Type + +from langchain_classic.document_loaders.base import BaseBlobParser, BaseLoader +from langchain_core._api import beta +from langchain_core.documents import Document +from langchain_core.documents.base import Blob + + +@beta() +class DocumentLoaderAsParser(BaseBlobParser): + """A wrapper class that adapts a document loader to function as a parser. + + This class is a work-around that adapts a document loader to function as a parser. + It is recommended to use a proper parser, if available. + + Requires the document loader to accept a `file_path` parameter. + """ + + DocumentLoaderType: Type[BaseLoader] + doc_loader_kwargs: Dict[str, Any] + + def __init__(self, document_loader_class: Type[BaseLoader], **kwargs: Any) -> None: + """ + Initializes the DocumentLoaderAsParser with a specific document loader class + and additional arguments. + + Args: + document_loader_class (Type[BaseLoader]): The document loader class to adapt + as a parser. + **kwargs: Additional arguments passed to the document loader's constructor. + + Raises: + TypeError: If the specified document loader does not accept a `file_path` parameter, + an exception is raised, as only loaders with this parameter can be adapted. + + Example: + ``` + from langchain_community.document_loaders.excel import UnstructuredExcelLoader + + # Initialize parser adapter with a document loader + excel_parser = DocumentLoaderAsParser(UnstructuredExcelLoader, mode="elements") + ``` + """ # noqa: E501 + super().__init__() + self.DocumentLoaderClass = document_loader_class + self.document_loader_kwargs = kwargs + + # Ensure the document loader class has a `file_path` parameter + init_signature = inspect.signature(document_loader_class.__init__) + if "file_path" not in init_signature.parameters: + raise TypeError( + f"{document_loader_class.__name__} does not accept `file_path`." + "Only document loaders with `file_path` parameter" + "can be morphed into a parser." + ) + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """ + Use underlying DocumentLoader to lazily parse the blob. + """ + doc_loader = self.DocumentLoaderClass( # type: ignore[call-arg] + file_path=blob.path, **self.document_loader_kwargs + ) + for document in doc_loader.lazy_load(): + document.metadata.update(blob.metadata) + yield document diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/generic.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/generic.py new file mode 100644 index 0000000000000000000000000000000000000000..75861ab346d9653431c0cdcac5b02d029ca93703 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/generic.py @@ -0,0 +1,71 @@ +"""Code for generic / auxiliary parsers. + +This module contains some logic to help assemble more sophisticated parsers. +""" + +from typing import Iterator, Mapping, Optional + +from langchain_core.documents import Document + +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.blob_loaders.schema import Blob + + +class MimeTypeBasedParser(BaseBlobParser): + """Parser that uses `mime`-types to parse a blob. + + This parser is useful for simple pipelines where the mime-type is sufficient + to determine how to parse a blob. + + To use, configure handlers based on mime-types and pass them to the initializer. + + Example: + + .. code-block:: python + + from langchain_community.document_loaders.parsers.generic import MimeTypeBasedParser + + parser = MimeTypeBasedParser( + handlers={ + "application/pdf": ..., + }, + fallback_parser=..., + ) + """ # noqa: E501 + + def __init__( + self, + handlers: Mapping[str, BaseBlobParser], + *, + fallback_parser: Optional[BaseBlobParser] = None, + ) -> None: + """Define a parser that uses mime-types to determine how to parse a blob. + + Args: + handlers: A mapping from mime-types to functions that take a blob, parse it + and return a document. + fallback_parser: A fallback_parser parser to use if the mime-type is not + found in the handlers. If provided, this parser will be + used to parse blobs with all mime-types not found in + the handlers. + If not provided, a ValueError will be raised if the + mime-type is not found in the handlers. + """ + self.handlers = handlers + self.fallback_parser = fallback_parser + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Load documents from a blob.""" + mimetype = blob.mimetype + + if mimetype is None: + raise ValueError(f"{blob} does not have a mimetype.") + + if mimetype in self.handlers: + handler = self.handlers[mimetype] + yield from handler.lazy_parse(blob) + else: + if self.fallback_parser is not None: + yield from self.fallback_parser.lazy_parse(blob) + else: + raise ValueError(f"Unsupported mime type: {mimetype}") diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/grobid.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/grobid.py new file mode 100644 index 0000000000000000000000000000000000000000..4df05fe7b30f149416860e88af2c74f2cc70870a --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/grobid.py @@ -0,0 +1,153 @@ +import logging +from typing import Dict, Iterator, List, Union + +import requests +from langchain_core.documents import Document + +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.blob_loaders import Blob + +logger = logging.getLogger(__name__) + + +class ServerUnavailableException(Exception): + """Exception raised when the Grobid server is unavailable.""" + + pass + + +class GrobidParser(BaseBlobParser): + """Load article `PDF` files using `Grobid`.""" + + def __init__( + self, + segment_sentences: bool, + grobid_server: str = "http://localhost:8070/api/processFulltextDocument", + ) -> None: + self.segment_sentences = segment_sentences + self.grobid_server = grobid_server + try: + requests.get(grobid_server) + except requests.exceptions.RequestException: + logger.error( + "GROBID server does not appear up and running, \ + please ensure Grobid is installed and the server is running" + ) + raise ServerUnavailableException + + def process_xml( + self, file_path: str, xml_data: str, segment_sentences: bool + ) -> Iterator[Document]: + """Process the XML file from Grobin.""" + + try: + from bs4 import BeautifulSoup + except ImportError: + raise ImportError( + "`bs4` package not found, please install it with `pip install bs4`" + ) + soup = BeautifulSoup(xml_data, "xml") + sections = soup.find_all("div") + titles = soup.find_all("title") + if titles: + title = titles[0].text + else: + title = "No title found" + chunks = [] + for section in sections: + sect = section.find("head") + if sect is not None: + for i, paragraph in enumerate(section.find_all("p")): + chunk_bboxes = [] + paragraph_text = [] + for i, sentence in enumerate(paragraph.find_all("s")): + paragraph_text.append(sentence.text) + sbboxes = [] + if sentence.get("coords") is not None: + for bbox in sentence.get("coords").split(";"): # type: ignore[union-attr] + box = bbox.split(",") + sbboxes.append( + { + "page": box[0], + "x": box[1], + "y": box[2], + "h": box[3], + "w": box[4], + } + ) + chunk_bboxes.append(sbboxes) + if (segment_sentences is True) and (len(sbboxes) > 0): + fpage, lpage = sbboxes[0]["page"], sbboxes[-1]["page"] + sentence_dict = { + "text": sentence.text, + "para": str(i), + "bboxes": [sbboxes], + "section_title": sect.text, + "section_number": sect.get("n"), + "pages": (fpage, lpage), + } + chunks.append(sentence_dict) + if segment_sentences is not True: + fpage, lpage = ( + chunk_bboxes[0][0]["page"], + chunk_bboxes[-1][-1]["page"], + ) + paragraph_dict = { + "text": "".join(paragraph_text), + "para": str(i), + "bboxes": chunk_bboxes, + "section_title": sect.text, + "section_number": sect.get("n"), + "pages": (fpage, lpage), + } + chunks.append(paragraph_dict) + + yield from [ + Document( + page_content=chunk["text"], + metadata=dict( + { + "text": str(chunk["text"]), + "para": str(chunk["para"]), + "bboxes": str(chunk["bboxes"]), + "pages": str(chunk["pages"]), + "section_title": str(chunk["section_title"]), + "section_number": str(chunk["section_number"]), + "paper_title": str(title), + "file_path": str(file_path), + } + ), + ) + for chunk in chunks + ] + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + file_path = blob.source + if file_path is None: + raise ValueError("blob.source cannot be None.") + pdf = open(file_path, "rb") + files = {"input": (file_path, pdf, "application/pdf", {"Expires": "0"})} + try: + data: Dict[str, Union[str, List[str]]] = {} + for param in ["generateIDs", "consolidateHeader", "segmentSentences"]: + data[param] = "1" + data["teiCoordinates"] = ["head", "s"] + files = files or {} + r = requests.request( + "POST", + self.grobid_server, + headers=None, + params=None, + files=files, + data=data, + timeout=60, + ) + xml_data = r.text + except requests.exceptions.ReadTimeout: + logger.error("GROBID server timed out. Return None.") + xml_data = None + + if xml_data is None: + return iter([]) + else: + return self.process_xml(file_path, xml_data, self.segment_sentences) diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/html/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/html/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f59e804b30f7d66e8475dbd7576d0e3307786791 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/html/__init__.py @@ -0,0 +1,3 @@ +from langchain_community.document_loaders.parsers.html.bs4 import BS4HTMLParser + +__all__ = ["BS4HTMLParser"] diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/html/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/html/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..61dda79760b2c3dedc88b82b29de919e8c950aaa Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/html/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/html/__pycache__/bs4.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/html/__pycache__/bs4.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5391cb7436a293174af39c0be8b1702d5297fc0a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/html/__pycache__/bs4.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/html/bs4.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/html/bs4.py new file mode 100644 index 0000000000000000000000000000000000000000..d00af499dcf05ebb68b7bc4e68e6c4387c8c9df4 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/html/bs4.py @@ -0,0 +1,54 @@ +"""Loader that uses bs4 to load HTML files, enriching metadata with page title.""" + +import logging +from typing import Any, Dict, Iterator, Union + +from langchain_core.documents import Document + +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.blob_loaders import Blob + +logger = logging.getLogger(__name__) + + +class BS4HTMLParser(BaseBlobParser): + """Parse HTML files using `Beautiful Soup`.""" + + def __init__( + self, + *, + features: str = "lxml", + get_text_separator: str = "", + **kwargs: Any, + ) -> None: + """Initialize a bs4 based HTML parser.""" + try: + import bs4 # noqa:F401 + except ImportError: + raise ImportError( + "beautifulsoup4 package not found, please install it with " + "`pip install beautifulsoup4`" + ) + + self.bs_kwargs = {"features": features, **kwargs} + self.get_text_separator = get_text_separator + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Load HTML document into document objects.""" + from bs4 import BeautifulSoup + + with blob.as_bytes_io() as f: + soup = BeautifulSoup(f, **self.bs_kwargs) + + text = soup.get_text(self.get_text_separator) + + if soup.title: + title = str(soup.title.string) + else: + title = "" + + metadata: Dict[str, Union[str, None]] = { + "source": blob.source, + "title": title, + } + yield Document(page_content=text, metadata=metadata) diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/images.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/images.py new file mode 100644 index 0000000000000000000000000000000000000000..1b4e1474af53c73aa306b10b899436aec60d91be --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/images.py @@ -0,0 +1,224 @@ +import base64 +import io +import logging +from abc import abstractmethod +from typing import TYPE_CHECKING, Iterable, Iterator + +import numpy +import numpy as np +from langchain_core.documents import Document +from langchain_core.language_models import BaseChatModel +from langchain_core.messages import HumanMessage + +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.blob_loaders import Blob + +if TYPE_CHECKING: + from PIL.Image import Image + +logger = logging.getLogger(__name__) + + +class BaseImageBlobParser(BaseBlobParser): + """Abstract base class for parsing image blobs into text.""" + + @abstractmethod + def _analyze_image(self, img: "Image") -> str: + """Abstract method to analyze an image and extract textual content. + + Args: + img: The image to be analyzed. + + Returns: + The extracted text content. + """ + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Lazily parse a blob and yields Documents containing the parsed content. + + Args: + blob (Blob): The blob to be parsed. + + Yields: + Document: + A document containing the parsed content and metadata. + """ + try: + from PIL import Image as Img + except ImportError: + raise ImportError( + "`Pillow` package not found, please install it with " + "`pip install Pillow`" + ) + + with blob.as_bytes_io() as buf: + if blob.mimetype == "application/x-npy": + array = numpy.load(buf) + if array.ndim == 3 and array.shape[2] == 1: # Grayscale image + img = Img.fromarray(numpy.squeeze(array, axis=2), mode="L") + else: + img = Img.fromarray(array) + else: + img = Img.open(buf) + content = self._analyze_image(img) + logger.debug("Image text: %s", content.replace("\n", "\\n")) + yield Document( + page_content=content, + metadata={**blob.metadata, **{"source": blob.source}}, + ) + + +class RapidOCRBlobParser(BaseImageBlobParser): + """Parser for extracting text from images using the RapidOCR library. + + Attributes: + ocr: + The RapidOCR instance for performing OCR. + """ + + def __init__( + self, + ) -> None: + """ + Initializes the RapidOCRBlobParser. + """ + super().__init__() + self.ocr = None + + def _analyze_image(self, img: "Image") -> str: + """ + Analyzes an image and extracts text using RapidOCR. + + Args: + img (Image): + The image to be analyzed. + + Returns: + str: + The extracted text content. + """ + if not self.ocr: + try: + from rapidocr_onnxruntime import RapidOCR + + self.ocr = RapidOCR() + except ImportError: + raise ImportError( + "`rapidocr-onnxruntime` package not found, please install it with " + "`pip install rapidocr-onnxruntime`" + ) + ocr_result, _ = self.ocr(np.array(img)) # type: ignore[misc] + content = "" + if ocr_result: + content = ("\n".join([text[1] for text in ocr_result])).strip() + return content + + +class TesseractBlobParser(BaseImageBlobParser): + """Parse for extracting text from images using the Tesseract OCR library.""" + + def __init__( + self, + *, + langs: Iterable[str] = ("eng",), + ): + """Initialize the TesseractBlobParser. + + Args: + langs (list[str]): + The languages to use for OCR. + """ + super().__init__() + self.langs = list(langs) + + def _analyze_image(self, img: "Image") -> str: + """Analyze an image and extracts text using Tesseract OCR. + + Args: + img: The image to be analyzed. + + Returns: + str: The extracted text content. + """ + try: + import pytesseract + except ImportError: + raise ImportError( + "`pytesseract` package not found, please install it with " + "`pip install pytesseract`" + ) + return pytesseract.image_to_string(img, lang="+".join(self.langs)).strip() + + +_PROMPT_IMAGES_TO_DESCRIPTION: str = ( + "You are an assistant tasked with summarizing images for retrieval. " + "1. These summaries will be embedded and used to retrieve the raw image. " + "Give a concise summary of the image that is well optimized for retrieval\n" + "2. extract all the text from the image. " + "Do not exclude any content from the page.\n" + "Format answer in markdown without explanatory text " + "and without markdown delimiter ``` at the beginning. " +) + + +class LLMImageBlobParser(BaseImageBlobParser): + """Parser for analyzing images using a language model (LLM). + + Attributes: + model (BaseChatModel): + The language model to use for analysis. + prompt (str): + The prompt to provide to the language model. + """ + + def __init__( + self, + *, + model: BaseChatModel, + prompt: str = _PROMPT_IMAGES_TO_DESCRIPTION, + ): + """Initializes the LLMImageBlobParser. + + Args: + model (BaseChatModel): + The language model to use for analysis. + prompt (str): + The prompt to provide to the language model. + """ + super().__init__() + self.model = model + self.prompt = prompt + + def _analyze_image(self, img: "Image") -> str: + """Analyze an image using the provided language model. + + Args: + img: The image to be analyzed. + + Returns: + The extracted textual content. + """ + image_bytes = io.BytesIO() + img.save(image_bytes, format="PNG") + img_base64 = base64.b64encode(image_bytes.getvalue()).decode("utf-8") + msg = self.model.invoke( + [ + HumanMessage( + content=[ + { + "type": "text", + "text": self.prompt.format(format=format), + }, + { + "type": "image_url", + "image_url": { + "url": f"data:image/jpeg;base64,{img_base64}" + }, + }, + ] + ) + ] + ) + result = msg.content + assert isinstance(result, str) + return result diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e56cc143cfda9cbe3f92b72608267a75e2668c3a --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__init__.py @@ -0,0 +1,5 @@ +from langchain_community.document_loaders.parsers.language.language_parser import ( + LanguageParser, +) + +__all__ = ["LanguageParser"] diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6e85c20f533009ddb340428eaad5f6641324284e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/c.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/c.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf3a78a17ecbfd2248d046c84fe9d822c0edfbe5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/c.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/cobol.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/cobol.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f0f97049e62b34e773dc39cfbefbbde5149d560c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/cobol.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/code_segmenter.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/code_segmenter.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2b8b589cb1e220a68e07f7effdd421588ca6db8e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/code_segmenter.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/cpp.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/cpp.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e1b21e38432a45862ec0e15e3244b4a3cc4825fc Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/cpp.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/csharp.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/csharp.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..547d85d1145864766ff55e44421202dab8dcd5cf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/csharp.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/elixir.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/elixir.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..84db7ee00dcce03ddb10e0bcdc1329ff48f1a20f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/elixir.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/go.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/go.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68f1fc1833de3ab49ff306f3dc73c0157b9d4b32 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/go.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/java.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/java.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f03ba9b6d88c3bd190b4c817001366228c6735ab Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/java.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/javascript.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/javascript.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f4e48e0de5a110e312d64787c41b08fcbab65811 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/javascript.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/kotlin.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/kotlin.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..90ac8c9ed9600877760ccf91480946a7954c66e5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/kotlin.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/language_parser.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/language_parser.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..38380d196d02c468a4a5613b4612d689f872b351 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/language_parser.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/lua.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/lua.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8a14bd5a75a7c9823a800129251c258d23922dde Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/lua.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/perl.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/perl.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2881ccb189db10b1154beb187c652ee7cad69b2a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/perl.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/php.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/php.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dc5df340c75ee8fb8d50a92316517c19d949aa70 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/php.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/python.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/python.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..59ece41202cc1117b982ceba7eee4e0410e2cd43 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/python.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/ruby.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/ruby.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dafac78d2f99535375b3bd5bde39924a5fc37cf7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/ruby.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/rust.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/rust.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79823cca47e847e290ec6f0e3ddb7c21e0b7cf3f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/rust.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/scala.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/scala.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..046f2ea2ae2128c23db5237895000e6802fb6d0b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/scala.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/sql.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/sql.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a1a9cfbfaa452eb711ef7201a361d5c5e3671829 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/sql.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/tree_sitter_segmenter.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/tree_sitter_segmenter.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..461ac58ba030b44852c9f8cf28e6d5b54dfb5295 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/tree_sitter_segmenter.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/typescript.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/typescript.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..757c8d6fcf419fb21864b849963f84c0d3bfca04 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/__pycache__/typescript.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/c.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/c.py new file mode 100644 index 0000000000000000000000000000000000000000..2db1ec99fca4a39ef07a3dcf7853a8fa0351c889 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/c.py @@ -0,0 +1,36 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (struct_specifier + body: (field_declaration_list)) @struct + (enum_specifier + body: (enumerator_list)) @enum + (union_specifier + body: (field_declaration_list)) @union + (function_definition) @function + ] +""".strip() + + +class CSegmenter(TreeSitterSegmenter): + """Code segmenter for C.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("c") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"// {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/cobol.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/cobol.py new file mode 100644 index 0000000000000000000000000000000000000000..2b598ba27029737740438a584d5dfbb0a963b851 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/cobol.py @@ -0,0 +1,98 @@ +import re +from typing import Callable, List, Pattern + +from langchain_community.document_loaders.parsers.language.code_segmenter import ( + CodeSegmenter, +) + + +class CobolSegmenter(CodeSegmenter): + """Code segmenter for `COBOL`.""" + + PARAGRAPH_PATTERN: Pattern = re.compile(r"^[A-Z0-9\-]+(\s+.*)?\.$", re.IGNORECASE) + DIVISION_PATTERN: Pattern = re.compile( + r"^\s*(IDENTIFICATION|DATA|PROCEDURE|ENVIRONMENT)\s+DIVISION.*$", re.IGNORECASE + ) + SECTION_PATTERN: Pattern = re.compile(r"^\s*[A-Z0-9\-]+\s+SECTION.$", re.IGNORECASE) + + def __init__(self, code: str): + super().__init__(code) + self.source_lines: List[str] = self.code.splitlines() + + def is_valid(self) -> bool: + # Identify presence of any division to validate COBOL code + return any(self.DIVISION_PATTERN.match(line) for line in self.source_lines) + + def _extract_code(self, start_idx: int, end_idx: int) -> str: + return "\n".join(self.source_lines[start_idx:end_idx]).rstrip("\n") + + def _is_relevant_code(self, line: str) -> bool: + """Check if a line is part of the procedure division or a relevant section.""" + if "PROCEDURE DIVISION" in line.upper(): + return True + # Add additional conditions for relevant sections if needed + return False + + def _process_lines(self, func: Callable) -> List[str]: + """A generic function to process COBOL lines based on provided func.""" + elements: List[str] = [] + start_idx = None + inside_relevant_section = False + + for i, line in enumerate(self.source_lines): + if self._is_relevant_code(line): + inside_relevant_section = True + + if inside_relevant_section and ( + self.PARAGRAPH_PATTERN.match(line.strip().split(" ")[0]) + or self.SECTION_PATTERN.match(line.strip()) + ): + if start_idx is not None: + func(elements, start_idx, i) + start_idx = i + + # Handle the last element if exists + if start_idx is not None: + func(elements, start_idx, len(self.source_lines)) + + return elements + + def extract_functions_classes(self) -> List[str]: + def extract_func(elements: List[str], start_idx: int, end_idx: int) -> None: + elements.append(self._extract_code(start_idx, end_idx)) + + return self._process_lines(extract_func) + + def simplify_code(self) -> str: + simplified_lines: List[str] = [] + inside_relevant_section = False + omitted_code_added = ( + False # To track if "* OMITTED CODE *" has been added after the last header + ) + + for line in self.source_lines: + is_header = ( + "PROCEDURE DIVISION" in line + or "DATA DIVISION" in line + or "IDENTIFICATION DIVISION" in line + or self.PARAGRAPH_PATTERN.match(line.strip().split(" ")[0]) + or self.SECTION_PATTERN.match(line.strip()) + ) + + if is_header: + inside_relevant_section = True + # Reset the flag since we're entering a new section/division or + # paragraph + omitted_code_added = False + + if inside_relevant_section: + if is_header: + # Add header and reset the omitted code added flag + simplified_lines.append(line) + elif not omitted_code_added: + # Add omitted code comment only if it hasn't been added directly + # after the last header + simplified_lines.append("* OMITTED CODE *") + omitted_code_added = True + + return "\n".join(simplified_lines) diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/code_segmenter.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/code_segmenter.py new file mode 100644 index 0000000000000000000000000000000000000000..2efb2add448e3d9d315a0cbc9c5926e431273450 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/code_segmenter.py @@ -0,0 +1,20 @@ +from abc import ABC, abstractmethod +from typing import List + + +class CodeSegmenter(ABC): + """Abstract class for the code segmenter.""" + + def __init__(self, code: str): + self.code = code + + def is_valid(self) -> bool: + return True + + @abstractmethod + def simplify_code(self) -> str: + raise NotImplementedError() # pragma: no cover + + @abstractmethod + def extract_functions_classes(self) -> List[str]: + raise NotImplementedError() # pragma: no cover diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/cpp.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/cpp.py new file mode 100644 index 0000000000000000000000000000000000000000..9d09164a846e773631cd0d67ea8d53e507593cd6 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/cpp.py @@ -0,0 +1,36 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (class_specifier + body: (field_declaration_list)) @class + (struct_specifier + body: (field_declaration_list)) @struct + (union_specifier + body: (field_declaration_list)) @union + (function_definition) @function + ] +""".strip() + + +class CPPSegmenter(TreeSitterSegmenter): + """Code segmenter for C++.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("cpp") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"// {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/csharp.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/csharp.py new file mode 100644 index 0000000000000000000000000000000000000000..a9f809fa00a84992d8b6fb627b71d229dfbc2bc1 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/csharp.py @@ -0,0 +1,36 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (namespace_declaration) @namespace + (class_declaration) @class + (method_declaration) @method + (interface_declaration) @interface + (enum_declaration) @enum + (struct_declaration) @struct + (record_declaration) @record + ] +""".strip() + + +class CSharpSegmenter(TreeSitterSegmenter): + """Code segmenter for C#.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("c_sharp") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"// {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/elixir.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/elixir.py new file mode 100644 index 0000000000000000000000000000000000000000..780209767d89fadda03a80ff3e39c836baf9b0cc --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/elixir.py @@ -0,0 +1,35 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (call target: ((identifier) @_identifier + (#any-of? @_identifier "defmodule" "defprotocol" "defimpl"))) @module + (call target: ((identifier) @_identifier + (#any-of? @_identifier "def" "defmacro" "defmacrop" "defp"))) @function + (unary_operator operator: "@" operand: (call target: ((identifier) @_identifier + (#any-of? @_identifier "moduledoc" "typedoc""doc")))) @comment + ] +""".strip() + + +class ElixirSegmenter(TreeSitterSegmenter): + """Code segmenter for Elixir.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("elixir") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"# {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/go.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/go.py new file mode 100644 index 0000000000000000000000000000000000000000..f836ab3ad710c73e2629828a6cf0f9fdab4b3c7a --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/go.py @@ -0,0 +1,31 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (function_declaration) @function + (type_declaration) @type + ] +""".strip() + + +class GoSegmenter(TreeSitterSegmenter): + """Code segmenter for Go.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("go") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"// {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/java.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/java.py new file mode 100644 index 0000000000000000000000000000000000000000..c7293e1ed7f7845420a7a1907fffa3010da1f14d --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/java.py @@ -0,0 +1,32 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (class_declaration) @class + (interface_declaration) @interface + (enum_declaration) @enum + ] +""".strip() + + +class JavaSegmenter(TreeSitterSegmenter): + """Code segmenter for Java.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("java") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"// {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/javascript.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/javascript.py new file mode 100644 index 0000000000000000000000000000000000000000..27a360a2e6c6475890d2a7992c27fd35beac2e6a --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/javascript.py @@ -0,0 +1,72 @@ +from typing import Any, List, Tuple + +from langchain_community.document_loaders.parsers.language.code_segmenter import ( + CodeSegmenter, +) + + +class JavaScriptSegmenter(CodeSegmenter): + """Code segmenter for JavaScript.""" + + def __init__(self, code: str): + super().__init__(code) + self.source_lines = self.code.splitlines() + + try: + import esprima # noqa: F401 + except ImportError: + raise ImportError( + "Could not import esprima Python package. " + "Please install it with `pip install esprima`." + ) + + def is_valid(self) -> bool: + import esprima + + try: + esprima.parseScript(self.code) + return True + except esprima.Error: + return False + + def _extract_code(self, node: Any) -> str: + start = node.loc.start.line - 1 + end = node.loc.end.line + return "\n".join(self.source_lines[start:end]) + + def extract_functions_classes(self) -> List[str]: + import esprima + + tree = esprima.parseScript(self.code, loc=True) + functions_classes = [] + + for node in tree.body: + if isinstance( + node, + (esprima.nodes.FunctionDeclaration, esprima.nodes.ClassDeclaration), + ): + functions_classes.append(self._extract_code(node)) + + return functions_classes + + def simplify_code(self) -> str: + import esprima + + tree = esprima.parseScript(self.code, loc=True) + simplified_lines = self.source_lines[:] + + indices_to_del: List[Tuple[int, int]] = [] + for node in tree.body: + if isinstance( + node, + (esprima.nodes.FunctionDeclaration, esprima.nodes.ClassDeclaration), + ): + start, end = node.loc.start.line - 1, node.loc.end.line + simplified_lines[start] = f"// Code for: {simplified_lines[start]}" + + indices_to_del.append((start + 1, end)) + + for start, end in reversed(indices_to_del): + del simplified_lines[start + 0 : end] + + return "\n".join(line for line in simplified_lines) diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/kotlin.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/kotlin.py new file mode 100644 index 0000000000000000000000000000000000000000..6f946f7b4a622004526249709b1f98885752aadb --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/kotlin.py @@ -0,0 +1,31 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (function_declaration) @function + (class_declaration) @class + ] +""".strip() + + +class KotlinSegmenter(TreeSitterSegmenter): + """Code segmenter for Kotlin.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("kotlin") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"// {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/language_parser.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/language_parser.py new file mode 100644 index 0000000000000000000000000000000000000000..e1d4e5ec664b983efed7041c380e3a168927569b --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/language_parser.py @@ -0,0 +1,249 @@ +from __future__ import annotations + +from typing import Any, Dict, Iterator, Literal, Optional + +from langchain_core.documents import Document + +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.blob_loaders import Blob +from langchain_community.document_loaders.parsers.language.c import CSegmenter +from langchain_community.document_loaders.parsers.language.cobol import CobolSegmenter +from langchain_community.document_loaders.parsers.language.cpp import CPPSegmenter +from langchain_community.document_loaders.parsers.language.csharp import CSharpSegmenter +from langchain_community.document_loaders.parsers.language.elixir import ElixirSegmenter +from langchain_community.document_loaders.parsers.language.go import GoSegmenter +from langchain_community.document_loaders.parsers.language.java import JavaSegmenter +from langchain_community.document_loaders.parsers.language.javascript import ( + JavaScriptSegmenter, +) +from langchain_community.document_loaders.parsers.language.kotlin import KotlinSegmenter +from langchain_community.document_loaders.parsers.language.lua import LuaSegmenter +from langchain_community.document_loaders.parsers.language.perl import PerlSegmenter +from langchain_community.document_loaders.parsers.language.php import PHPSegmenter +from langchain_community.document_loaders.parsers.language.python import PythonSegmenter +from langchain_community.document_loaders.parsers.language.ruby import RubySegmenter +from langchain_community.document_loaders.parsers.language.rust import RustSegmenter +from langchain_community.document_loaders.parsers.language.scala import ScalaSegmenter +from langchain_community.document_loaders.parsers.language.sql import SQLSegmenter +from langchain_community.document_loaders.parsers.language.typescript import ( + TypeScriptSegmenter, +) + +LANGUAGE_EXTENSIONS: Dict[str, str] = { + "py": "python", + "js": "js", + "cobol": "cobol", + "c": "c", + "cpp": "cpp", + "cs": "csharp", + "rb": "ruby", + "scala": "scala", + "rs": "rust", + "go": "go", + "kt": "kotlin", + "lua": "lua", + "pl": "perl", + "ts": "ts", + "java": "java", + "php": "php", + "ex": "elixir", + "exs": "elixir", + "sql": "sql", +} + +LANGUAGE_SEGMENTERS: Dict[str, Any] = { + "python": PythonSegmenter, + "js": JavaScriptSegmenter, + "cobol": CobolSegmenter, + "c": CSegmenter, + "cpp": CPPSegmenter, + "csharp": CSharpSegmenter, + "ruby": RubySegmenter, + "rust": RustSegmenter, + "scala": ScalaSegmenter, + "go": GoSegmenter, + "kotlin": KotlinSegmenter, + "lua": LuaSegmenter, + "perl": PerlSegmenter, + "ts": TypeScriptSegmenter, + "java": JavaSegmenter, + "php": PHPSegmenter, + "elixir": ElixirSegmenter, + "sql": SQLSegmenter, +} + +Language = Literal[ + "cpp", + "go", + "java", + "kotlin", + "js", + "ts", + "php", + "proto", + "python", + "rst", + "ruby", + "rust", + "scala", + "markdown", + "latex", + "html", + "sol", + "csharp", + "cobol", + "c", + "lua", + "perl", + "elixir", + "sql", +] + + +class LanguageParser(BaseBlobParser): + """Parse using the respective programming language syntax. + + Each top-level function and class in the code is loaded into separate documents. + Furthermore, an extra document is generated, containing the remaining top-level code + that excludes the already segmented functions and classes. + + This approach can potentially improve the accuracy of QA models over source code. + + The supported languages for code parsing are: + + - C: "c" (*) + - C++: "cpp" (*) + - C#: "csharp" (*) + - COBOL: "cobol" + - Elixir: "elixir" + - Go: "go" (*) + - Java: "java" (*) + - JavaScript: "js" (requires package `esprima`) + - Kotlin: "kotlin" (*) + - Lua: "lua" (*) + - Perl: "perl" (*) + - Python: "python" + - Ruby: "ruby" (*) + - Rust: "rust" (*) + - Scala: "scala" (*) + - SQL: "sql" (*) + - TypeScript: "ts" (*) + + Items marked with (*) require the packages `tree_sitter` and + `tree_sitter_languages`. It is straightforward to add support for additional + languages using `tree_sitter`, although this currently requires modifying LangChain. + + The language used for parsing can be configured, along with the minimum number of + lines required to activate the splitting based on syntax. + + If a language is not explicitly specified, `LanguageParser` will infer one from + filename extensions, if present. + + Examples: + + .. code-block:: python + + from langchain_community.document_loaders.generic import GenericLoader + from langchain_community.document_loaders.parsers import LanguageParser + + loader = GenericLoader.from_filesystem( + "./code", + glob="**/*", + suffixes=[".py", ".js"], + parser=LanguageParser() + ) + docs = loader.load() + + Example instantiations to manually select the language: + + .. code-block:: python + + + loader = GenericLoader.from_filesystem( + "./code", + glob="**/*", + suffixes=[".py"], + parser=LanguageParser(language="python") + ) + + Example instantiations to set number of lines threshold: + + .. code-block:: python + + loader = GenericLoader.from_filesystem( + "./code", + glob="**/*", + suffixes=[".py"], + parser=LanguageParser(parser_threshold=200) + ) + """ + + def __init__(self, language: Optional[Language] = None, parser_threshold: int = 0): + """ + Language parser that split code using the respective language syntax. + + Args: + language: If None (default), it will try to infer language from source. + parser_threshold: Minimum lines needed to activate parsing (0 by default). + """ + if language and language not in LANGUAGE_SEGMENTERS: + raise Exception(f"No parser available for {language}") + self.language = language + self.parser_threshold = parser_threshold + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + code = blob.as_string() + + language = self.language or ( + LANGUAGE_EXTENSIONS.get(blob.source.rsplit(".", 1)[-1]) + if isinstance(blob.source, str) + else None + ) + + if language is None: + yield Document( + page_content=code, + metadata={ + "source": blob.source, + }, + ) + return + + if self.parser_threshold >= len(code.splitlines()): + yield Document( + page_content=code, + metadata={ + "source": blob.source, + "language": language, + }, + ) + return + + self.Segmenter = LANGUAGE_SEGMENTERS[language] + segmenter = self.Segmenter(blob.as_string()) + if not segmenter.is_valid(): + yield Document( + page_content=code, + metadata={ + "source": blob.source, + }, + ) + return + + for functions_classes in segmenter.extract_functions_classes(): + yield Document( + page_content=functions_classes, + metadata={ + "source": blob.source, + "content_type": "functions_classes", + "language": language, + }, + ) + yield Document( + page_content=segmenter.simplify_code(), + metadata={ + "source": blob.source, + "content_type": "simplified_code", + "language": language, + }, + ) diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/lua.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/lua.py new file mode 100644 index 0000000000000000000000000000000000000000..3e0a762ba4b5ffd7911e28c1c83978b476e491e9 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/lua.py @@ -0,0 +1,33 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (function_definition_statement + name: (identifier)) @function + (local_function_definition_statement + name: (identifier)) @function + ] +""".strip() + + +class LuaSegmenter(TreeSitterSegmenter): + """Code segmenter for Lua.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("lua") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"-- {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/perl.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/perl.py new file mode 100644 index 0000000000000000000000000000000000000000..b68d52cef2b04d61d7666d878185c3f84ef86c72 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/perl.py @@ -0,0 +1,30 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (function_definition) @subroutine + ] +""".strip() + + +class PerlSegmenter(TreeSitterSegmenter): + """Code segmenter for Perl.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("perl") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"# {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/php.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/php.py new file mode 100644 index 0000000000000000000000000000000000000000..e7ec12a5ee8153ea18b78170f1963e3b4f3575ec --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/php.py @@ -0,0 +1,35 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (function_definition) @function + (class_declaration) @class + (interface_declaration) @interface + (trait_declaration) @trait + (enum_declaration) @enum + (namespace_definition) @namespace + ] +""".strip() + + +class PHPSegmenter(TreeSitterSegmenter): + """Code segmenter for PHP.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("php") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"// {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/python.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/python.py new file mode 100644 index 0000000000000000000000000000000000000000..52dbc68352a91962db6a34c71ee01c34f977b93a --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/python.py @@ -0,0 +1,53 @@ +import ast +from typing import Any, List, Tuple + +from langchain_community.document_loaders.parsers.language.code_segmenter import ( + CodeSegmenter, +) + + +class PythonSegmenter(CodeSegmenter): + """Code segmenter for `Python`.""" + + def __init__(self, code: str): + super().__init__(code) + self.source_lines = self.code.splitlines() + + def is_valid(self) -> bool: + try: + ast.parse(self.code) + return True + except SyntaxError: + return False + + def _extract_code(self, node: Any) -> str: + start = node.lineno - 1 + end = node.end_lineno + return "\n".join(self.source_lines[start:end]) + + def extract_functions_classes(self) -> List[str]: + tree = ast.parse(self.code) + functions_classes = [] + + for node in ast.iter_child_nodes(tree): + if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)): + functions_classes.append(self._extract_code(node)) + + return functions_classes + + def simplify_code(self) -> str: + tree = ast.parse(self.code) + simplified_lines = self.source_lines[:] + + indices_to_del: List[Tuple[int, int]] = [] + for node in ast.iter_child_nodes(tree): + if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)): + start, end = node.lineno - 1, node.end_lineno + simplified_lines[start] = f"# Code for: {simplified_lines[start]}" + assert isinstance(end, int) + indices_to_del.append((start + 1, end)) + + for start, end in reversed(indices_to_del): + del simplified_lines[start + 0 : end] + + return "\n".join(simplified_lines) diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/ruby.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/ruby.py new file mode 100644 index 0000000000000000000000000000000000000000..767a1f94a4d378d8917ea8afb8d695b4cb5576b9 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/ruby.py @@ -0,0 +1,32 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (method) @method + (module) @module + (class) @class + ] +""".strip() + + +class RubySegmenter(TreeSitterSegmenter): + """Code segmenter for Ruby.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("ruby") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"# {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/rust.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/rust.py new file mode 100644 index 0000000000000000000000000000000000000000..bb73f96bf6d7cb4f7ea12d83f55576f656db017b --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/rust.py @@ -0,0 +1,34 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (function_item + name: (identifier) + body: (block)) @function + (struct_item) @struct + (trait_item) @trait + ] +""".strip() + + +class RustSegmenter(TreeSitterSegmenter): + """Code segmenter for Rust.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("rust") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"// {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/scala.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/scala.py new file mode 100644 index 0000000000000000000000000000000000000000..af62a4e748fedbe6b9ea86b77958d5e3a3ba81ad --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/scala.py @@ -0,0 +1,33 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (class_definition) @class + (function_definition) @function + (object_definition) @object + (trait_definition) @trait + ] +""".strip() + + +class ScalaSegmenter(TreeSitterSegmenter): + """Code segmenter for Scala.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("scala") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"// {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/sql.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/sql.py new file mode 100644 index 0000000000000000000000000000000000000000..1c11b7b36375869d3cf3d0a0a57295652d2d1079 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/sql.py @@ -0,0 +1,65 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + +CHUNK_QUERY = """ + [ + (create_table_statement) @create + (select_statement) @select + (insert_statement) @insert + (update_statement) @update + (delete_statement) @delete + ] +""" + + +class SQLSegmenter(TreeSitterSegmenter): + """Code segmenter for SQL. + This class uses Tree-sitter to segment SQL code into its + constituent statements (e.g., SELECT, CREATE TABLE). + It also provides functionality to extract these + statements and simplify the code into commented descriptions. + """ + + def get_language(self) -> "Language": + """Return the SQL language grammar for Tree-sitter.""" + from tree_sitter_languages import get_language + + return get_language("sql") + + def get_chunk_query(self) -> str: + """Return the Tree-sitter query for SQL segmentation.""" + return CHUNK_QUERY + + def extract_functions_classes(self) -> list[str]: + """Extract SQL statements from the code. + Ensures that all SQL statements end with a semicolon + for consistency. + """ + extracted = super().extract_functions_classes() + # Ensure all statements end with a semicolon + return [ + stmt.strip() + ";" if not stmt.strip().endswith(";") else stmt.strip() + for stmt in extracted + ] + + def simplify_code(self) -> str: + """Simplify the extracted SQL code into comments. + Converts SQL statements into commented descriptions + for easy readability. + """ + return "\n".join( + [ + f"-- Code for: {stmt.strip()}" + for stmt in self.extract_functions_classes() + ] + ) + + def make_line_comment(self, text: str) -> str: + """Create a line comment in SQL style.""" + return f"-- {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/tree_sitter_segmenter.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/tree_sitter_segmenter.py new file mode 100644 index 0000000000000000000000000000000000000000..a467c269f6ed613cb1485cbe135a4bf7f5c65c71 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/tree_sitter_segmenter.py @@ -0,0 +1,108 @@ +from abc import abstractmethod +from typing import TYPE_CHECKING, List + +from langchain_community.document_loaders.parsers.language.code_segmenter import ( + CodeSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language, Parser + + +class TreeSitterSegmenter(CodeSegmenter): + """Abstract class for `CodeSegmenter`s that use the tree-sitter library.""" + + def __init__(self, code: str): + super().__init__(code) + self.source_lines = self.code.splitlines() + + try: + import tree_sitter # noqa: F401 + import tree_sitter_languages # noqa: F401 + except ImportError: + raise ImportError( + "Could not import tree_sitter/tree_sitter_languages Python packages. " + "Please install them with " + "`pip install tree-sitter tree-sitter-languages`." + ) + + def is_valid(self) -> bool: + language = self.get_language() + error_query = language.query("(ERROR) @error") + + parser = self.get_parser() + tree = parser.parse(bytes(self.code, encoding="UTF-8")) + + return len(error_query.captures(tree.root_node)) == 0 + + def extract_functions_classes(self) -> List[str]: + language = self.get_language() + query = language.query(self.get_chunk_query()) + + parser = self.get_parser() + tree = parser.parse(bytes(self.code, encoding="UTF-8")) + captures = query.captures(tree.root_node) + + processed_lines = set() + chunks = [] + + for node, name in captures: + start_line = node.start_point[0] + end_line = node.end_point[0] + lines = list(range(start_line, end_line + 1)) + + if any(line in processed_lines for line in lines): + continue + + processed_lines.update(lines) + chunk_text = node.text.decode("UTF-8") + chunks.append(chunk_text) + + return chunks + + def simplify_code(self) -> str: + language = self.get_language() + query = language.query(self.get_chunk_query()) + + parser = self.get_parser() + tree = parser.parse(bytes(self.code, encoding="UTF-8")) + processed_lines = set() + + simplified_lines = self.source_lines[:] + for node, name in query.captures(tree.root_node): + start_line = node.start_point[0] + end_line = node.end_point[0] + + lines = list(range(start_line, end_line + 1)) + if any(line in processed_lines for line in lines): + continue + + simplified_lines[start_line] = self.make_line_comment( + f"Code for: {self.source_lines[start_line]}" + ) + + for line_num in range(start_line + 1, end_line + 1): + simplified_lines[line_num] = None # type: ignore[call-overload] + + processed_lines.update(lines) + + return "\n".join(line for line in simplified_lines if line is not None) + + def get_parser(self) -> "Parser": + from tree_sitter import Parser + + parser = Parser() + parser.set_language(self.get_language()) + return parser + + @abstractmethod + def get_language(self) -> "Language": + raise NotImplementedError() # pragma: no cover + + @abstractmethod + def get_chunk_query(self) -> str: + raise NotImplementedError() # pragma: no cover + + @abstractmethod + def make_line_comment(self, text: str) -> str: + raise NotImplementedError() # pragma: no cover diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/typescript.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/typescript.py new file mode 100644 index 0000000000000000000000000000000000000000..ab7158e2e821077c6a3b8ff243c6a95155250a4a --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/language/typescript.py @@ -0,0 +1,33 @@ +from typing import TYPE_CHECKING + +from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 + TreeSitterSegmenter, +) + +if TYPE_CHECKING: + from tree_sitter import Language + + +CHUNK_QUERY = """ + [ + (function_declaration) @function + (class_declaration) @class + (interface_declaration) @interface + (enum_declaration) @enum + ] +""".strip() + + +class TypeScriptSegmenter(TreeSitterSegmenter): + """Code segmenter for TypeScript.""" + + def get_language(self) -> "Language": + from tree_sitter_languages import get_language + + return get_language("typescript") + + def get_chunk_query(self) -> str: + return CHUNK_QUERY + + def make_line_comment(self, text: str) -> str: + return f"// {text}" diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/msword.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/msword.py new file mode 100644 index 0000000000000000000000000000000000000000..f2a03cc37da3cbcc4c0449409b6cc1cacbf7ad0c --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/msword.py @@ -0,0 +1,45 @@ +from typing import Iterator + +from langchain_core.documents import Document + +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.blob_loaders import Blob + + +class MsWordParser(BaseBlobParser): + """Parse the Microsoft Word documents from a blob.""" + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Parse a Microsoft Word document into the Document iterator. + + Args: + blob: The blob to parse. + + Returns: An iterator of Documents. + + """ + try: + from unstructured.partition.doc import partition_doc + from unstructured.partition.docx import partition_docx + except ImportError as e: + raise ImportError( + "Could not import unstructured, please install with `pip install " + "unstructured`." + ) from e + + mime_type_parser = { + "application/msword": partition_doc, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ( + partition_docx + ), + } + if blob.mimetype not in ( + "application/msword", + "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + ): + raise ValueError("This blob type is not supported for this parser.") + with blob.as_bytes_io() as word_document: + elements = mime_type_parser[blob.mimetype](file=word_document) + text = "\n\n".join([str(el) for el in elements]) + metadata = {"source": blob.source} + yield Document(page_content=text, metadata=metadata) diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/pdf.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/pdf.py new file mode 100644 index 0000000000000000000000000000000000000000..4cdfa1b9fa8ba8d879f56039592f67976e95340f --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/pdf.py @@ -0,0 +1,1677 @@ +"""Module contains common parsers for PDFs.""" + +from __future__ import annotations + +import html +import io +import logging +import threading +import warnings +from datetime import datetime +from pathlib import Path +from tempfile import TemporaryDirectory +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Iterable, + Iterator, + Literal, + Mapping, + Optional, + Sequence, + Union, + cast, +) +from urllib.parse import urlparse + +import numpy +import numpy as np +from langchain_core.documents import Document + +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.blob_loaders import Blob +from langchain_community.document_loaders.parsers.images import ( + BaseImageBlobParser, + RapidOCRBlobParser, +) + +if TYPE_CHECKING: + import pdfplumber + import pymupdf + import pypdf + import pypdfium2 + from textractor.data.text_linearization_config import TextLinearizationConfig + +_PDF_FILTER_WITH_LOSS = ["DCTDecode", "DCT", "JPXDecode"] +_PDF_FILTER_WITHOUT_LOSS = [ + "LZWDecode", + "LZW", + "FlateDecode", + "Fl", + "ASCII85Decode", + "A85", + "ASCIIHexDecode", + "AHx", + "RunLengthDecode", + "RL", + "CCITTFaxDecode", + "CCF", + "JBIG2Decode", +] + + +def extract_from_images_with_rapidocr( + images: Sequence[Union[Iterable[np.ndarray], bytes]], +) -> str: + """Extract text from images with RapidOCR. + + Args: + images: Images to extract text from. + + Returns: + Text extracted from images. + + Raises: + ImportError: If `rapidocr-onnxruntime` package is not installed. + """ + try: + from rapidocr_onnxruntime import RapidOCR + except ImportError: + raise ImportError( + "`rapidocr-onnxruntime` package not found, please install it with " + "`pip install rapidocr-onnxruntime`" + ) + ocr = RapidOCR() + text = "" + for img in images: + result, _ = ocr(img) + if result: + result = [text[1] for text in result] + text += "\n".join(result) + return text + + +logger = logging.getLogger(__name__) + +_FORMAT_IMAGE_STR = "\n\n{image_text}\n\n" +_JOIN_IMAGES = "\n" +_JOIN_TABLES = "\n" +_DEFAULT_PAGES_DELIMITER = "\n\f" + +_STD_METADATA_KEYS = {"source", "total_pages", "creationdate", "creator", "producer"} + + +def _format_inner_image(blob: Blob, content: str, format: str) -> str: + """Format the content of the image with the source of the blob. + + blob: The blob containing the image. + format:: + The format for the parsed output. + - "text" = return the content as is + - "markdown-img" = wrap the content into an image markdown link, w/ link + pointing to (`![body)(#)`] + - "html-img" = wrap the content as the `alt` text of an tag and link to + (`{body}`) + """ + if content: + source = blob.source or "#" + if format == "markdown-img": + content = content.replace("]", r"\\]") + content = f"![{content}]({source})" + elif format == "html-img": + content = f'{html.escape(content, quote=True)} src=' + return content + + +def _validate_metadata(metadata: dict[str, Any]) -> dict[str, Any]: + """Validate that the metadata has all the standard keys and the page is an integer. + + The standard keys are: + - source + - total_page + - creationdate + - creator + - producer + + Validate that page is an integer if it is present. + """ + if not _STD_METADATA_KEYS.issubset(metadata.keys()): + raise ValueError("The PDF parser must valorize the standard metadata.") + if not isinstance(metadata.get("page", 0), int): + raise ValueError("The PDF metadata page must be a integer.") + return metadata + + +def _purge_metadata(metadata: dict[str, Any]) -> dict[str, Any]: + """Purge metadata from unwanted keys and normalize key names. + + Args: + metadata: The original metadata dictionary. + + Returns: + The cleaned and normalized the key format of metadata dictionary. + """ + new_metadata: dict[str, Any] = {} + map_key = { + "page_count": "total_pages", + "file_path": "source", + } + for k, v in metadata.items(): + if type(v) not in [str, int]: + v = str(v) + if k.startswith("/"): + k = k[1:] + k = k.lower() + if k in ["creationdate", "moddate"]: + try: + new_metadata[k] = datetime.strptime( + v.replace("'", ""), "D:%Y%m%d%H%M%S%z" + ).isoformat("T") + except ValueError: + new_metadata[k] = v + elif k in map_key: + # Normalize key with others PDF parser + new_metadata[map_key[k]] = v + new_metadata[k] = v + elif isinstance(v, str): + new_metadata[k] = v.strip() + elif isinstance(v, int): + new_metadata[k] = v + return new_metadata + + +_PARAGRAPH_DELIMITER = [ + "\n\n\n", + "\n\n", +] # To insert images or table in the middle of the page. + + +def _merge_text_and_extras(extras: list[str], text_from_page: str) -> str: + """Insert extras such as image/table in a text between two paragraphs if possible, + else at the end of the text. + + Args: + extras: List of extra content (images/tables) to insert. + text_from_page: The text content from the page. + + Returns: + The merged text with extras inserted. + """ + + def _recurs_merge_text_and_extras( + extras: list[str], text_from_page: str, recurs: bool + ) -> Optional[str]: + if extras: + for delim in _PARAGRAPH_DELIMITER: + pos = text_from_page.rfind(delim) + if pos != -1: + # search penultimate, to bypass an error in footer + previous_text = None + if recurs: + previous_text = _recurs_merge_text_and_extras( + extras, text_from_page[:pos], False + ) + if previous_text: + all_text = previous_text + text_from_page[pos:] + else: + all_extras = "" + str_extras = "\n\n".join(filter(lambda x: x, extras)) + if str_extras: + all_extras = delim + str_extras + all_text = ( + text_from_page[:pos] + all_extras + text_from_page[pos:] + ) + break + else: + all_text = None + else: + all_text = text_from_page + return all_text + + all_text = _recurs_merge_text_and_extras(extras, text_from_page, True) + if not all_text: + all_extras = "" + str_extras = "\n\n".join(filter(lambda x: x, extras)) + if str_extras: + all_extras = _PARAGRAPH_DELIMITER[-1] + str_extras + all_text = text_from_page + all_extras + + return all_text + + +class PyPDFParser(BaseBlobParser): + """Parse a blob from a PDF using `pypdf` library. + + This class provides methods to parse a blob from a PDF document, supporting various + configurations such as handling password-protected PDFs, extracting images. + It integrates the 'pypdf' library for PDF processing and offers synchronous blob + parsing. + + Examples: + Setup: + + .. code-block:: bash + + pip install -U langchain-community pypdf + + Load a blob from a PDF file: + + .. code-block:: python + + from langchain_core.documents.base import Blob + + blob = Blob.from_path("./example_data/layout-parser-paper.pdf") + + Instantiate the parser: + + .. code-block:: python + + from langchain_community.document_loaders.parsers import PyPDFParser + + parser = PyPDFParser( + # password = None, + mode = "single", + pages_delimiter = "\n\f", + # images_parser = TesseractBlobParser(), + ) + + Lazily parse the blob: + + .. code-block:: python + + docs = [] + docs_lazy = parser.lazy_parse(blob) + + for doc in docs_lazy: + docs.append(doc) + print(docs[0].page_content[:100]) + print(docs[0].metadata) + """ + + def __init__( + self, + password: Optional[Union[str, bytes]] = None, + extract_images: bool = False, + *, + mode: Literal["single", "page"] = "page", + pages_delimiter: str = _DEFAULT_PAGES_DELIMITER, + images_parser: Optional[BaseImageBlobParser] = None, + images_inner_format: Literal["text", "markdown-img", "html-img"] = "text", + extraction_mode: Literal["plain", "layout"] = "plain", + extraction_kwargs: Optional[dict[str, Any]] = None, + ): + """Initialize a parser based on PyPDF. + + Args: + password: Optional password for opening encrypted PDFs. + extract_images: Whether to extract images from the PDF. + mode: The extraction mode, either "single" for the entire document or "page" + for page-wise extraction. + pages_delimiter: A string delimiter to separate pages in single-mode + extraction. + images_parser: Optional image blob parser. + images_inner_format: The format for the parsed output. + - "text" = return the content as is + - "markdown-img" = wrap the content into an image markdown link, w/ link + pointing to (`![body)(#)`] + - "html-img" = wrap the content as the `alt` text of an tag and link to + (`{body}`) + extraction_mode: “plain” for legacy functionality, “layout” extract text + in a fixed width format that closely adheres to the rendered layout in + the source pdf. + extraction_kwargs: Optional additional parameters for the extraction + process. + + Raises: + ValueError: If the `mode` is not "single" or "page". + """ + super().__init__() + if mode not in ["single", "page"]: + raise ValueError("mode must be single or page") + self.extract_images = extract_images + if extract_images and not images_parser: + images_parser = RapidOCRBlobParser() + self.images_parser = images_parser + self.images_inner_format = images_inner_format + self.password = password + self.mode = mode + self.pages_delimiter = pages_delimiter + self.extraction_mode = extraction_mode + self.extraction_kwargs = extraction_kwargs or {} + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """ + Lazily parse the blob. + Insert image, if possible, between two paragraphs. + In this way, a paragraph can be continued on the next page. + + Args: + blob: The blob to parse. + + Raises: + ImportError: If the `pypdf` package is not found. + + Yield: + An iterator over the parsed documents. + """ + try: + import pypdf + except ImportError: + raise ImportError( + "`pypdf` package not found, please install it with `pip install pypdf`" + ) + + def _extract_text_from_page(page: pypdf.PageObject) -> str: + """ + Extract text from image given the version of pypdf. + + Args: + page: The page object to extract text from. + + Returns: + str: The extracted text. + """ + if pypdf.__version__.startswith("3"): + return page.extract_text() + else: + return page.extract_text( + extraction_mode=self.extraction_mode, + **self.extraction_kwargs, + ) + + with blob.as_bytes_io() as pdf_file_obj: + pdf_reader = pypdf.PdfReader(pdf_file_obj, password=self.password) + + doc_metadata = _purge_metadata( + {"producer": "PyPDF", "creator": "PyPDF", "creationdate": ""} + | cast(dict, pdf_reader.metadata or {}) + | { + "source": blob.source, + "total_pages": len(pdf_reader.pages), + } + ) + single_texts = [] + for page_number, page in enumerate(pdf_reader.pages): + text_from_page = _extract_text_from_page(page=page) + images_from_page = self.extract_images_from_page(page) + all_text = _merge_text_and_extras( + [images_from_page], text_from_page + ).strip() + if self.mode == "page": + yield Document( + page_content=all_text, + metadata=_validate_metadata( + doc_metadata + | { + "page": page_number, + "page_label": pdf_reader.page_labels[page_number], + } + ), + ) + else: + single_texts.append(all_text) + if self.mode == "single": + yield Document( + page_content=self.pages_delimiter.join(single_texts), + metadata=_validate_metadata(doc_metadata), + ) + + def extract_images_from_page(self, page: pypdf._page.PageObject) -> str: + """Extract images from a PDF page and get the text using images_to_text. + + Args: + page: The page object from which to extract images. + + Returns: + str: The extracted text from the images on the page. + """ + if not self.images_parser: + return "" + import pypdf + from PIL import Image + + if "/XObject" not in cast(dict, page["/Resources"]).keys(): + return "" + + xObject = page["/Resources"]["/XObject"].get_object() + images = [] + for obj in xObject: + np_image: Any = None + if xObject[obj]["/Subtype"] == "/Image": + img_filter = ( + xObject[obj]["/Filter"][1:] + if type(xObject[obj]["/Filter"]) is pypdf.generic._base.NameObject + else xObject[obj]["/Filter"][0][1:] + ) + if img_filter in _PDF_FILTER_WITHOUT_LOSS: + height, width = xObject[obj]["/Height"], xObject[obj]["/Width"] + + np_image = np.frombuffer( + xObject[obj].get_data(), dtype=np.uint8 + ).reshape(height, width, -1) + elif img_filter in _PDF_FILTER_WITH_LOSS: + np_image = np.array(Image.open(io.BytesIO(xObject[obj].get_data()))) + + else: + logger.warning("Unknown PDF Filter!") + if np_image is not None: + image_bytes = io.BytesIO() + + if image_bytes.getbuffer().nbytes == 0: + continue + + Image.fromarray(np_image).save(image_bytes, format="PNG") + blob = Blob.from_data(image_bytes.getvalue(), mime_type="image/png") + image_text = next(self.images_parser.lazy_parse(blob)).page_content + images.append( + _format_inner_image(blob, image_text, self.images_inner_format) + ) + return _FORMAT_IMAGE_STR.format( + image_text=_JOIN_IMAGES.join(filter(None, images)) + ) + + +class PDFMinerParser(BaseBlobParser): + """Parse a blob from a PDF using `pdfminer.six` library. + + This class provides methods to parse a blob from a PDF document, supporting various + configurations such as handling password-protected PDFs, extracting images, and + defining extraction mode. + It integrates the 'pdfminer.six' library for PDF processing and offers synchronous + blob parsing. + + Examples: + Setup: + + .. code-block:: bash + + pip install -U langchain-community pdfminer.six pillow + + Load a blob from a PDF file: + + .. code-block:: python + + from langchain_core.documents.base import Blob + + blob = Blob.from_path("./example_data/layout-parser-paper.pdf") + + Instantiate the parser: + + .. code-block:: python + + from langchain_community.document_loaders.parsers import PDFMinerParser + + parser = PDFMinerParser( + # password = None, + mode = "single", + pages_delimiter = "\n\f", + # extract_images = True, + # images_to_text = convert_images_to_text_with_tesseract(), + ) + + Lazily parse the blob: + + .. code-block:: python + + docs = [] + docs_lazy = parser.lazy_parse(blob) + + for doc in docs_lazy: + docs.append(doc) + print(docs[0].page_content[:100]) + print(docs[0].metadata) + """ + + _warn_concatenate_pages = False + + def __init__( + self, + extract_images: bool = False, + *, + password: Optional[str] = None, + mode: Literal["single", "page"] = "single", + pages_delimiter: str = _DEFAULT_PAGES_DELIMITER, + images_parser: Optional[BaseImageBlobParser] = None, + images_inner_format: Literal["text", "markdown-img", "html-img"] = "text", + concatenate_pages: Optional[bool] = None, + ): + """Initialize a parser based on PDFMiner. + + Args: + password: Optional password for opening encrypted PDFs. + mode: Extraction mode to use. Either "single" or "page" for page-wise + extraction. + pages_delimiter: A string delimiter to separate pages in single-mode + extraction. + extract_images: Whether to extract images from PDF. + images_inner_format: The format for the parsed output. + - "text" = return the content as is + - "markdown-img" = wrap the content into an image markdown link, w/ link + pointing to (`![body)(#)`] + - "html-img" = wrap the content as the `alt` text of an tag and link to + (`{body}`) + concatenate_pages: Deprecated. If True, concatenate all PDF pages + into one a single document. Otherwise, return one document per page. + + Returns: + This method does not directly return data. Use the `parse` or `lazy_parse` + methods to retrieve parsed documents with content and metadata. + + Raises: + ValueError: If the `mode` is not "single" or "page". + + Warnings: + `concatenate_pages` parameter is deprecated. Use `mode='single' or 'page' + instead. + """ + super().__init__() + if mode not in ["single", "page"]: + raise ValueError("mode must be single or page") + if extract_images and not images_parser: + images_parser = RapidOCRBlobParser() + self.extract_images = extract_images + self.images_parser = images_parser + self.images_inner_format = images_inner_format + self.password = password + self.mode = mode + self.pages_delimiter = pages_delimiter + if concatenate_pages is not None: + if not PDFMinerParser._warn_concatenate_pages: + PDFMinerParser._warn_concatenate_pages = True + logger.warning( + "`concatenate_pages` parameter is deprecated. " + "Use `mode='single' or 'page'` instead." + ) + self.mode = "single" if concatenate_pages else "page" + + @staticmethod + def decode_text(s: Union[bytes, str]) -> str: + """ + Decodes a PDFDocEncoding string to Unicode. + Adds py3 compatibility to pdfminer's version. + + Args: + s: The string to decode. + + Returns: + str: The decoded Unicode string. + """ + from pdfminer.utils import PDFDocEncoding + + if isinstance(s, bytes) and s.startswith(b"\xfe\xff"): + return str(s[2:], "utf-16be", "ignore") + try: + ords = (ord(c) if isinstance(c, str) else c for c in s) + return "".join(PDFDocEncoding[o] for o in ords) + except IndexError: + return str(s) + + @staticmethod + def resolve_and_decode(obj: Any) -> Any: + """ + Recursively resolve the metadata values. + + Args: + obj: The object to resolve and decode. It can be of any type. + + Returns: + The resolved and decoded object. + """ + from pdfminer.psparser import PSLiteral + + if hasattr(obj, "resolve"): + obj = obj.resolve() + if isinstance(obj, list): + return list(map(PDFMinerParser.resolve_and_decode, obj)) + elif isinstance(obj, PSLiteral): + return PDFMinerParser.decode_text(obj.name) + elif isinstance(obj, (str, bytes)): + return PDFMinerParser.decode_text(obj) + elif isinstance(obj, dict): + for k, v in obj.items(): + obj[k] = PDFMinerParser.resolve_and_decode(v) + return obj + + return obj + + def _get_metadata( + self, + fp: BinaryIO, + password: str = "", + caching: bool = True, + ) -> dict[str, Any]: + """ + Extract metadata from a PDF file. + + Args: + fp: The file pointer to the PDF file. + password: The password for the PDF file, if encrypted. Defaults to an empty + string. + caching: Whether to cache the PDF structure. Defaults to True. + + Returns: + Metadata of the PDF file. + """ + from pdfminer.pdfpage import PDFDocument, PDFPage, PDFParser + + # Create a PDF parser object associated with the file object. + parser = PDFParser(fp) + # Create a PDF document object that stores the document structure. + doc = PDFDocument(parser, password=password, caching=caching) + metadata = {} + + for info in doc.info: + metadata.update(info) + for k, v in metadata.items(): + try: + metadata[k] = PDFMinerParser.resolve_and_decode(v) + except Exception as e: # pragma: nocover + # This metadata value could not be parsed. Instead of failing the PDF + # read, treat it as a warning only if `strict_metadata=False`. + logger.warning( + '[WARNING] Metadata key "%s" could not be parsed due to ' + "exception: %s", + k, + str(e), + ) + + # Count number of pages. + metadata["total_pages"] = len(list(PDFPage.create_pages(doc))) + + return metadata + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """ + Lazily parse the blob. + Insert image, if possible, between two paragraphs. + In this way, a paragraph can be continued on the next page. + + Args: + blob: The blob to parse. + + Raises: + ImportError: If the `pdfminer.six` or `pillow` package is not found. + + Yield: + An iterator over the parsed documents. + """ + try: + import pdfminer + from pdfminer.converter import PDFLayoutAnalyzer + from pdfminer.layout import ( + LAParams, + LTContainer, + LTImage, + LTItem, + LTPage, + LTText, + LTTextBox, + ) + from pdfminer.pdfinterp import PDFPageInterpreter, PDFResourceManager + from pdfminer.pdfpage import PDFPage + + if int(pdfminer.__version__) < 20201018: + raise ImportError( + "This parser is tested with pdfminer.six version 20201018 or " + "later. Remove pdfminer, and install pdfminer.six with " + "`pip uninstall pdfminer && pip install pdfminer.six`." + ) + except ImportError: + raise ImportError( + "pdfminer package not found, please install it " + "with `pip install pdfminer.six`" + ) + + with blob.as_bytes_io() as pdf_file_obj, TemporaryDirectory() as tempdir: + pages = PDFPage.get_pages(pdf_file_obj, password=self.password or "") + rsrcmgr = PDFResourceManager() + doc_metadata = _purge_metadata( + {"producer": "PDFMiner", "creator": "PDFMiner", "creationdate": ""} + | self._get_metadata(pdf_file_obj, password=self.password or "") + ) + doc_metadata["source"] = blob.source + + class Visitor(PDFLayoutAnalyzer): + def __init__( + self, + rsrcmgr: PDFResourceManager, + pageno: int = 1, + laparams: Optional[LAParams] = None, + ) -> None: + super().__init__(rsrcmgr, pageno=pageno, laparams=laparams) + + def receive_layout(me, ltpage: LTPage) -> None: + def render(item: LTItem) -> None: + if isinstance(item, LTContainer): + for child in item: + render(child) + elif isinstance(item, LTText): + text_io.write(item.get_text()) + if isinstance(item, LTTextBox): + text_io.write("\n") + elif isinstance(item, LTImage): + if self.images_parser: + from pdfminer.image import ImageWriter + + image_writer = ImageWriter(tempdir) + filename = image_writer.export_image(item) + blob = Blob.from_path(Path(tempdir) / filename) + blob.metadata["source"] = "#" + image_text = next( + self.images_parser.lazy_parse(blob) + ).page_content + + text_io.write( + _format_inner_image( + blob, image_text, self.images_inner_format + ) + ) + else: + pass + + render(ltpage) + + text_io = io.StringIO() + visitor_for_all = PDFPageInterpreter( + rsrcmgr, Visitor(rsrcmgr, laparams=LAParams()) + ) + all_content = [] + for i, page in enumerate(pages): + text_io.truncate(0) + text_io.seek(0) + visitor_for_all.process_page(page) + + all_text = text_io.getvalue() + # For legacy compatibility, net strip() + all_text = all_text.strip() + if self.mode == "page": + text_io.truncate(0) + text_io.seek(0) + yield Document( + page_content=all_text, + metadata=_validate_metadata(doc_metadata | {"page": i}), + ) + else: + if all_text.endswith("\f"): + all_text = all_text[:-1] + all_content.append(all_text) + if self.mode == "single": + # Add pages_delimiter between pages + document_content = self.pages_delimiter.join(all_content) + yield Document( + page_content=document_content, + metadata=_validate_metadata(doc_metadata), + ) + + +class PyMuPDFParser(BaseBlobParser): + """Parse a blob from a PDF using `PyMuPDF` library. + + This class provides methods to parse a blob from a PDF document, supporting various + configurations such as handling password-protected PDFs, extracting images, and + defining extraction mode. + It integrates the 'PyMuPDF' library for PDF processing and offers synchronous blob + parsing. + + Examples: + Setup: + + .. code-block:: bash + + pip install -U langchain-community pymupdf + + Load a blob from a PDF file: + + .. code-block:: python + + from langchain_core.documents.base import Blob + + blob = Blob.from_path("./example_data/layout-parser-paper.pdf") + + Instantiate the parser: + + .. code-block:: python + + from langchain_community.document_loaders.parsers import PyMuPDFParser + + parser = PyMuPDFParser( + # password = None, + mode = "single", + pages_delimiter = "\n\f", + # images_parser = TesseractBlobParser(), + # extract_tables="markdown", + # extract_tables_settings=None, + # text_kwargs=None, + ) + + Lazily parse the blob: + + .. code-block:: python + + docs = [] + docs_lazy = parser.lazy_parse(blob) + + for doc in docs_lazy: + docs.append(doc) + print(docs[0].page_content[:100]) + print(docs[0].metadata) + """ + + # PyMuPDF is not thread safe. + # See https://pymupdf.readthedocs.io/en/latest/recipes-multiprocessing.html + _lock = threading.Lock() + + def __init__( + self, + text_kwargs: Optional[dict[str, Any]] = None, + extract_images: bool = False, + *, + password: Optional[str] = None, + mode: Literal["single", "page"] = "page", + pages_delimiter: str = _DEFAULT_PAGES_DELIMITER, + images_parser: Optional[BaseImageBlobParser] = None, + images_inner_format: Literal["text", "markdown-img", "html-img"] = "text", + extract_tables: Union[Literal["csv", "markdown", "html"], None] = None, + extract_tables_settings: Optional[dict[str, Any]] = None, + ) -> None: + """Initialize a parser based on PyMuPDF. + + Args: + password: Optional password for opening encrypted PDFs. + mode: The extraction mode, either "single" for the entire document or "page" + for page-wise extraction. + pages_delimiter: A string delimiter to separate pages in single-mode + extraction. + extract_images: Whether to extract images from the PDF. + images_parser: Optional image blob parser. + images_inner_format: The format for the parsed output. + - "text" = return the content as is + - "markdown-img" = wrap the content into an image markdown link, w/ link + pointing to (`![body)(#)`] + - "html-img" = wrap the content as the `alt` text of an tag and link to + (`{body}`) + extract_tables: Whether to extract tables in a specific format, such as + "csv", "markdown", or "html". + extract_tables_settings: Optional dictionary of settings for customizing + table extraction. + + Returns: + This method does not directly return data. Use the `parse` or `lazy_parse` + methods to retrieve parsed documents with content and metadata. + + Raises: + ValueError: If the mode is not "single" or "page". + ValueError: If the extract_tables format is not "markdown", "html", + or "csv". + """ + super().__init__() + if mode not in ["single", "page"]: + raise ValueError("mode must be single or page") + if extract_tables and extract_tables not in ["markdown", "html", "csv"]: + raise ValueError("mode must be markdown") + + self.mode = mode + self.pages_delimiter = pages_delimiter + self.password = password + self.text_kwargs = text_kwargs or {} + if extract_images and not images_parser: + images_parser = RapidOCRBlobParser() + self.extract_images = extract_images + self.images_inner_format = images_inner_format + self.images_parser = images_parser + self.extract_tables = extract_tables + self.extract_tables_settings = extract_tables_settings + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + return self._lazy_parse( + blob, + ) + + def _lazy_parse( + self, + blob: Blob, + # text-kwargs is present for backwards compatibility. + # Users should not use it directly. + text_kwargs: Optional[dict[str, Any]] = None, + ) -> Iterator[Document]: + """Lazily parse the blob. + Insert image, if possible, between two paragraphs. + In this way, a paragraph can be continued on the next page. + + Args: + blob: The blob to parse. + text_kwargs: Optional keyword arguments to pass to the `get_text` method. + If provided at run time, it will override the default text_kwargs. + + Raises: + ImportError: If the `pypdf` package is not found. + + Yield: + An iterator over the parsed documents. + """ + try: + import pymupdf + + text_kwargs = text_kwargs or self.text_kwargs + if not self.extract_tables_settings: + from pymupdf.table import ( + DEFAULT_JOIN_TOLERANCE, + DEFAULT_MIN_WORDS_HORIZONTAL, + DEFAULT_MIN_WORDS_VERTICAL, + DEFAULT_SNAP_TOLERANCE, + ) + + self.extract_tables_settings = { + # See https://pymupdf.readthedocs.io/en/latest/page.html#Page.find_tables + "clip": None, + "vertical_strategy": "lines", + "horizontal_strategy": "lines", + "vertical_lines": None, + "horizontal_lines": None, + "snap_tolerance": DEFAULT_SNAP_TOLERANCE, + "snap_x_tolerance": None, + "snap_y_tolerance": None, + "join_tolerance": DEFAULT_JOIN_TOLERANCE, + "join_x_tolerance": None, + "join_y_tolerance": None, + "edge_min_length": 3, + "min_words_vertical": DEFAULT_MIN_WORDS_VERTICAL, + "min_words_horizontal": DEFAULT_MIN_WORDS_HORIZONTAL, + "intersection_tolerance": 3, + "intersection_x_tolerance": None, + "intersection_y_tolerance": None, + "text_tolerance": 3, + "text_x_tolerance": 3, + "text_y_tolerance": 3, + "strategy": None, # offer abbreviation + "add_lines": None, # optional user-specified lines + } + except ImportError: + raise ImportError( + "pymupdf package not found, please install it " + "with `pip install pymupdf`" + ) + + with PyMuPDFParser._lock: + with blob.as_bytes_io() as file_path: + if blob.data is None: + doc = pymupdf.open(file_path) + else: + doc = pymupdf.open(stream=file_path, filetype="pdf") + if doc.is_encrypted: + doc.authenticate(self.password) + doc_metadata = { + "producer": "PyMuPDF", + "creator": "PyMuPDF", + "creationdate": "", + } | self._extract_metadata(doc, blob) + full_content = [] + for page in doc: + all_text = self._get_page_content(doc, page, text_kwargs).strip() + if self.mode == "page": + yield Document( + page_content=all_text, + metadata=_validate_metadata( + doc_metadata | {"page": page.number} + ), + ) + else: + full_content.append(all_text) + + if self.mode == "single": + yield Document( + page_content=self.pages_delimiter.join(full_content), + metadata=_validate_metadata(doc_metadata), + ) + + def _get_page_content( + self, + doc: pymupdf.Document, + page: pymupdf.Page, + text_kwargs: dict[str, Any], + ) -> str: + """Get the text of the page using PyMuPDF and RapidOCR and issue a warning + if it is empty. + + Args: + doc: The PyMuPDF document object. + page: The PyMuPDF page object. + blob: The blob being parsed. + + Returns: + str: The text content of the page. + """ + text_from_page = page.get_text(**{**self.text_kwargs, **text_kwargs}) + images_from_page = self._extract_images_from_page(doc, page) + tables_from_page = self._extract_tables_from_page(page) + extras = [] + if images_from_page: + extras.append(images_from_page) + if tables_from_page: + extras.append(tables_from_page) + all_text = _merge_text_and_extras(extras, text_from_page) + + return all_text + + def _extract_metadata(self, doc: pymupdf.Document, blob: Blob) -> dict: + """Extract metadata from the document and page. + + Args: + doc: The PyMuPDF document object. + blob: The blob being parsed. + + Returns: + dict: The extracted metadata. + """ + metadata = _purge_metadata( + { + **{ + "producer": "PyMuPDF", + "creator": "PyMuPDF", + "creationdate": "", + "source": blob.source, + "file_path": blob.source, + "total_pages": len(doc), + }, + **{ + k: doc.metadata[k] + for k in doc.metadata + if isinstance(doc.metadata[k], (str, int)) + }, + } + ) + for k in ("modDate", "creationDate"): + if k in doc.metadata: + metadata[k] = doc.metadata[k] + return metadata + + def _extract_images_from_page( + self, doc: pymupdf.Document, page: pymupdf.Page + ) -> str: + """Extract images from a PDF page and get the text using images_to_text. + + Args: + doc: The PyMuPDF document object. + page: The PyMuPDF page object. + + Returns: + str: The extracted text from the images on the page. + """ + if not self.images_parser: + return "" + import pymupdf + + img_list = page.get_images() + images = [] + for img in img_list: + if self.images_parser: + xref = img[0] + pix = pymupdf.Pixmap(doc, xref) + image = np.frombuffer(pix.samples, dtype=np.uint8).reshape( + pix.height, pix.width, -1 + ) + image_bytes = io.BytesIO() + if image_bytes.getbuffer().nbytes == 0: + continue + + numpy.save(image_bytes, image) + blob = Blob.from_data( + image_bytes.getvalue(), mime_type="application/x-npy" + ) + image_text = next(self.images_parser.lazy_parse(blob)).page_content + + images.append( + _format_inner_image(blob, image_text, self.images_inner_format) + ) + return _FORMAT_IMAGE_STR.format( + image_text=_JOIN_IMAGES.join(filter(None, images)) + ) + + def _extract_tables_from_page(self, page: pymupdf.Page) -> str: + """Extract tables from a PDF page. + + Args: + page: The PyMuPDF page object. + + Returns: + str: The extracted tables in the specified format. + """ + if self.extract_tables is None: + return "" + import pymupdf + + tables_list = list( + pymupdf.table.find_tables(page, **self.extract_tables_settings) + ) + if tables_list: + if self.extract_tables == "markdown": + return _JOIN_TABLES.join([table.to_markdown() for table in tables_list]) + elif self.extract_tables == "html": + return _JOIN_TABLES.join( + [ + table.to_pandas().to_html( + header=False, + index=False, + bold_rows=False, + ) + for table in tables_list + ] + ) + elif self.extract_tables == "csv": + return _JOIN_TABLES.join( + [ + table.to_pandas().to_csv( + header=False, + index=False, + ) + for table in tables_list + ] + ) + else: + raise ValueError( + f"extract_tables {self.extract_tables} not implemented" + ) + return "" + + +class PyPDFium2Parser(BaseBlobParser): + """Parse a blob from a PDF using `PyPDFium2` library. + + This class provides methods to parse a blob from a PDF document, supporting various + configurations such as handling password-protected PDFs, extracting images, and + defining extraction mode. + It integrates the 'PyPDFium2' library for PDF processing and offers synchronous + blob parsing. + + Examples: + Setup: + + .. code-block:: bash + + pip install -U langchain-community pypdfium2 + + Load a blob from a PDF file: + + .. code-block:: python + + from langchain_core.documents.base import Blob + + blob = Blob.from_path("./example_data/layout-parser-paper.pdf") + + Instantiate the parser: + + .. code-block:: python + + from langchain_community.document_loaders.parsers import PyPDFium2Parser + + parser = PyPDFium2Parser( + # password=None, + mode="page", + pages_delimiter="\n\f", + # extract_images = True, + # images_to_text = convert_images_to_text_with_tesseract(), + ) + + Lazily parse the blob: + + .. code-block:: python + + docs = [] + docs_lazy = parser.lazy_parse(blob) + + for doc in docs_lazy: + docs.append(doc) + print(docs[0].page_content[:100]) + print(docs[0].metadata) + """ + + # PyPDFium2 is not thread safe. + # See https://pypdfium2.readthedocs.io/en/stable/python_api.html#thread-incompatibility + _lock = threading.Lock() + + def __init__( + self, + extract_images: bool = False, + *, + password: Optional[str] = None, + mode: Literal["single", "page"] = "page", + pages_delimiter: str = _DEFAULT_PAGES_DELIMITER, + images_parser: Optional[BaseImageBlobParser] = None, + images_inner_format: Literal["text", "markdown-img", "html-img"] = "text", + ) -> None: + """Initialize a parser based on PyPDFium2. + + Args: + password: Optional password for opening encrypted PDFs. + mode: The extraction mode, either "single" for the entire document or "page" + for page-wise extraction. + pages_delimiter: A string delimiter to separate pages in single-mode + extraction. + extract_images: Whether to extract images from the PDF. + images_parser: Optional image blob parser. + images_inner_format: The format for the parsed output. + - "text" = return the content as is + - "markdown-img" = wrap the content into an image markdown link, w/ link + pointing to (`![body)(#)`] + - "html-img" = wrap the content as the `alt` text of an tag and link to + (`{body}`) + extraction_mode: “plain” for legacy functionality, “layout” for experimental + layout mode functionality + extraction_kwargs: Optional additional parameters for the extraction + process. + + Returns: + This method does not directly return data. Use the `parse` or `lazy_parse` + methods to retrieve parsed documents with content and metadata. + + Raises: + ValueError: If the mode is not "single" or "page". + """ + super().__init__() + if mode not in ["single", "page"]: + raise ValueError("mode must be single or page") + self.extract_images = extract_images + if extract_images and not images_parser: + images_parser = RapidOCRBlobParser() + self.images_parser = images_parser + self.images_inner_format = images_inner_format + self.password = password + self.mode = mode + self.pages_delimiter = pages_delimiter + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """ + Lazily parse the blob. + Insert image, if possible, between two paragraphs. + In this way, a paragraph can be continued on the next page. + + Args: + blob: The blob to parse. + + Raises: + ImportError: If the `pypdf` package is not found. + + Yield: + An iterator over the parsed documents. + """ + try: + import pypdfium2 + except ImportError: + raise ImportError( + "pypdfium2 package not found, please install it with" + " `pip install pypdfium2`" + ) + + # pypdfium2 is really finicky with respect to closing things, + # if done incorrectly creates seg faults. + with PyPDFium2Parser._lock: + with blob.as_bytes_io() as file_path: + pdf_reader = None + try: + pdf_reader = pypdfium2.PdfDocument( + file_path, password=self.password, autoclose=True + ) + full_content = [] + + doc_metadata = { + "producer": "PyPDFium2", + "creator": "PyPDFium2", + "creationdate": "", + } | _purge_metadata(pdf_reader.get_metadata_dict()) + doc_metadata["source"] = blob.source + doc_metadata["total_pages"] = len(pdf_reader) + + for page_number, page in enumerate(pdf_reader): + text_page = page.get_textpage() + text_from_page = "\n".join( + text_page.get_text_range().splitlines() + ) # Replace \r\n + text_page.close() + image_from_page = self._extract_images_from_page(page) + all_text = _merge_text_and_extras( + [image_from_page], text_from_page + ).strip() + page.close() + + if self.mode == "page": + # For legacy compatibility, add the last '\n' + if not all_text.endswith("\n"): + all_text += "\n" + yield Document( + page_content=all_text, + metadata=_validate_metadata( + { + **doc_metadata, + "page": page_number, + } + ), + ) + else: + full_content.append(all_text) + + if self.mode == "single": + yield Document( + page_content=self.pages_delimiter.join(full_content), + metadata=_validate_metadata(doc_metadata), + ) + finally: + if pdf_reader: + pdf_reader.close() + + def _extract_images_from_page(self, page: pypdfium2._helpers.page.PdfPage) -> str: + """Extract images from a PDF page and get the text using images_to_text. + + Args: + page: The page object from which to extract images. + + Returns: + str: The extracted text from the images on the page. + """ + if not self.images_parser: + return "" + + import pypdfium2.raw as pdfium_c + + images = list(page.get_objects(filter=(pdfium_c.FPDF_PAGEOBJ_IMAGE,))) + if not images: + return "" + str_images = [] + for image in images: + image_bytes = io.BytesIO() + np_image = image.get_bitmap().to_numpy() + if np_image.size < 3: + continue + numpy.save(image_bytes, image.get_bitmap().to_numpy()) + blob = Blob.from_data(image_bytes.getvalue(), mime_type="application/x-npy") + text_from_image = next(self.images_parser.lazy_parse(blob)).page_content + str_images.append( + _format_inner_image(blob, text_from_image, self.images_inner_format) + ) + image.close() + return _FORMAT_IMAGE_STR.format(image_text=_JOIN_IMAGES.join(str_images)) + + +class PDFPlumberParser(BaseBlobParser): + """Parse `PDF` with `PDFPlumber`.""" + + def __init__( + self, + text_kwargs: Optional[Mapping[str, Any]] = None, + dedupe: bool = False, + extract_images: bool = False, + ) -> None: + """Initialize the parser. + + Args: + text_kwargs: Keyword arguments to pass to ``pdfplumber.Page.extract_text()`` + dedupe: Avoiding the error of duplicate characters if `dedupe=True`. + """ + try: + import PIL # noqa:F401 + except ImportError: + raise ImportError( + "pillow package not found, please install it with `pip install pillow`" + ) + self.text_kwargs = text_kwargs or {} + self.dedupe = dedupe + self.extract_images = extract_images + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Lazily parse the blob.""" + import pdfplumber + + with blob.as_bytes_io() as file_path: + doc = pdfplumber.open(file_path) # open document + + yield from [ + Document( + page_content=self._process_page_content(page) + + "\n" + + self._extract_images_from_page(page), + metadata=dict( + { + "source": blob.source, + "file_path": blob.source, + "page": page.page_number - 1, + "total_pages": len(doc.pages), + }, + **{ + k: doc.metadata[k] + for k in doc.metadata + if type(doc.metadata[k]) in [str, int] + }, + ), + ) + for page in doc.pages + ] + + def _process_page_content(self, page: pdfplumber.page.Page) -> str: + """Process the page content based on dedupe.""" + if self.dedupe: + return page.dedupe_chars().extract_text(**self.text_kwargs) + return page.extract_text(**self.text_kwargs) + + def _extract_images_from_page(self, page: pdfplumber.page.Page) -> str: + """Extract images from page and get the text with RapidOCR.""" + from PIL import Image + + if not self.extract_images: + return "" + + images = [] + for img in page.images: + if img["stream"]["Filter"].name in _PDF_FILTER_WITHOUT_LOSS: + if img["stream"]["BitsPerComponent"] == 1: + images.append( + np.array( + Image.frombytes( + "1", + (img["stream"]["Width"], img["stream"]["Height"]), + img["stream"].get_data(), + ).convert("L") + ) + ) + else: + images.append( + np.frombuffer(img["stream"].get_data(), dtype=np.uint8).reshape( + img["stream"]["Height"], img["stream"]["Width"], -1 + ) + ) + elif img["stream"]["Filter"].name in _PDF_FILTER_WITH_LOSS: + images.append(img["stream"].get_data()) + else: + warnings.warn("Unknown PDF Filter!") + + return extract_from_images_with_rapidocr(images) + + +class AmazonTextractPDFParser(BaseBlobParser): + """Send `PDF` files to `Amazon Textract` and parse them. + + For parsing multi-page PDFs, they have to reside on S3. + + The AmazonTextractPDFLoader calls the + [Amazon Textract Service](https://aws.amazon.com/textract/) + to convert PDFs into a Document structure. + Single and multi-page documents are supported with up to 3000 pages + and 512 MB of size. + + For the call to be successful an AWS account is required, + similar to the + [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) + requirements. + + Besides the AWS configuration, it is very similar to the other PDF + loaders, while also supporting JPEG, PNG and TIFF and non-native + PDF formats. + + ```python + from langchain_community.document_loaders import AmazonTextractPDFLoader + loader=AmazonTextractPDFLoader("example_data/alejandro_rosalez_sample-small.jpeg") + documents = loader.load() + ``` + + One feature is the linearization of the output. + When using the features LAYOUT, FORMS or TABLES together with Textract + + ```python + from langchain_community.document_loaders import AmazonTextractPDFLoader + # you can mix and match each of the features + loader=AmazonTextractPDFLoader( + "example_data/alejandro_rosalez_sample-small.jpeg", + textract_features=["TABLES", "LAYOUT"]) + documents = loader.load() + ``` + + it will generate output that formats the text in reading order and + try to output the information in a tabular structure or + output the key/value pairs with a colon (key: value). + This helps most LLMs to achieve better accuracy when + processing these texts. + + ``Document`` objects are returned with metadata that includes the ``source`` and + a 1-based index of the page number in ``page``. Note that ``page`` represents + the index of the result returned from Textract, not necessarily the as-written + page number in the document. + + """ + + def __init__( + self, + textract_features: Optional[Sequence[int]] = None, + client: Optional[Any] = None, + *, + linearization_config: Optional[TextLinearizationConfig] = None, + ) -> None: + """Initializes the parser. + + Args: + textract_features: Features to be used for extraction, each feature + should be passed as an int that conforms to the enum + `Textract_Features`, see `amazon-textract-caller` pkg + client: boto3 textract client + linearization_config: Config to be used for linearization of the output + should be an instance of TextLinearizationConfig from + the `textractor` pkg + """ + + try: + import textractcaller as tc + import textractor.entities.document as textractor + + self.tc = tc + self.textractor = textractor + + if textract_features is not None: + self.textract_features = [ + tc.Textract_Features(f) for f in textract_features + ] + else: + self.textract_features = [] + + if linearization_config is not None: + self.linearization_config = linearization_config + else: + self.linearization_config = self.textractor.TextLinearizationConfig( + hide_figure_layout=True, + title_prefix="# ", + section_header_prefix="## ", + list_element_prefix="*", + ) + except ImportError: + raise ImportError( + "Could not import amazon-textract-caller or " + "amazon-textract-textractor python package. Please install it " + "with `pip install amazon-textract-caller` & " + "`pip install amazon-textract-textractor`." + ) + + if not client: + try: + import boto3 + + self.boto3_textract_client = boto3.client("textract") + except ImportError: + raise ImportError( + "Could not import boto3 python package. " + "Please install it with `pip install boto3`." + ) + else: + self.boto3_textract_client = client + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Iterates over the Blob pages and returns an Iterator with a Document + for each page, like the other parsers If multi-page document, blob.path + has to be set to the S3 URI and for single page docs + the blob.data is taken + """ + + url_parse_result = urlparse(str(blob.path)) if blob.path else None + # Either call with S3 path (multi-page) or with bytes (single-page) + if ( + url_parse_result + and url_parse_result.scheme == "s3" + and url_parse_result.netloc + ): + textract_response_json = self.tc.call_textract( + input_document=str(blob.path), + features=self.textract_features, + boto3_textract_client=self.boto3_textract_client, + ) + else: + textract_response_json = self.tc.call_textract( + input_document=blob.as_bytes(), + features=self.textract_features, + call_mode=self.tc.Textract_Call_Mode.FORCE_SYNC, + boto3_textract_client=self.boto3_textract_client, + ) + + document = self.textractor.Document.open(textract_response_json) + + for idx, page in enumerate(document.pages): + yield Document( + page_content=page.get_text(config=self.linearization_config), + metadata={"source": blob.source, "page": idx + 1}, + ) + + +class DocumentIntelligenceParser(BaseBlobParser): + """Loads a PDF with Azure Document Intelligence + (formerly Form Recognizer) and chunks at character level.""" + + def __init__(self, client: Any, model: str): + warnings.warn( + "langchain_community.document_loaders.parsers.pdf.DocumentIntelligenceParser" + "and langchain_community.document_loaders.pdf.DocumentIntelligenceLoader" + " are deprecated. Please upgrade to " + "langchain_community.document_loaders.DocumentIntelligenceLoader " + "for any file parsing purpose using Azure Document Intelligence " + "service." + ) + self.client = client + self.model = model + + def _generate_docs(self, blob: Blob, result: Any) -> Iterator[Document]: + for p in result.pages: + content = " ".join([line.content for line in p.lines]) + + d = Document( + page_content=content, + metadata={ + "source": blob.source, + "page": p.page_number, + }, + ) + yield d + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Lazily parse the blob.""" + + with blob.as_bytes_io() as file_obj: + poller = self.client.begin_analyze_document(self.model, file_obj) + result = poller.result() + + docs = self._generate_docs(blob, result) + + yield from docs diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/registry.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/registry.py new file mode 100644 index 0000000000000000000000000000000000000000..46074e5e698fdb0c4dfd944432a6c126de4edd73 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/registry.py @@ -0,0 +1,36 @@ +"""Module includes a registry of default parser configurations.""" + +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.parsers.generic import MimeTypeBasedParser +from langchain_community.document_loaders.parsers.msword import MsWordParser +from langchain_community.document_loaders.parsers.pdf import PyMuPDFParser +from langchain_community.document_loaders.parsers.txt import TextParser + + +def _get_default_parser() -> BaseBlobParser: + """Get default mime-type based parser.""" + return MimeTypeBasedParser( + handlers={ + "application/pdf": PyMuPDFParser(), + "text/plain": TextParser(), + "application/msword": MsWordParser(), + "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ( + MsWordParser() + ), + }, + fallback_parser=None, + ) + + +_REGISTRY = { + "default": _get_default_parser, +} + +# PUBLIC API + + +def get_parser(parser_name: str) -> BaseBlobParser: + """Get a parser by parser name.""" + if parser_name not in _REGISTRY: + raise ValueError(f"Unknown parser combination: {parser_name}") + return _REGISTRY[parser_name]() diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/txt.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/txt.py new file mode 100644 index 0000000000000000000000000000000000000000..5b2da3074317d2865dd6393749d6988d88234c6f --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/txt.py @@ -0,0 +1,16 @@ +"""Module for parsing text files..""" + +from typing import Iterator + +from langchain_core.documents import Document + +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.blob_loaders import Blob + + +class TextParser(BaseBlobParser): + """Parser for text blobs.""" + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Lazily parse the blob.""" + yield Document(page_content=blob.as_string(), metadata={"source": blob.source}) diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/vsdx.py b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/vsdx.py new file mode 100644 index 0000000000000000000000000000000000000000..aeb414453ad60c8a3ec79fe97739170f2f3ae4df --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_loaders/parsers/vsdx.py @@ -0,0 +1,207 @@ +import json +import re +import zipfile +from abc import ABC +from pathlib import Path +from typing import Iterator, List, Set, Tuple + +from langchain_community.docstore.document import Document +from langchain_community.document_loaders.base import BaseBlobParser +from langchain_community.document_loaders.blob_loaders import Blob + + +class VsdxParser(BaseBlobParser, ABC): + """Parser for vsdx files.""" + + def parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[override] + """Parse a vsdx file.""" + return self.lazy_parse(blob) + + def lazy_parse(self, blob: Blob) -> Iterator[Document]: + """Retrieve the contents of pages from a .vsdx file + and insert them into documents, one document per page.""" + + with blob.as_bytes_io() as pdf_file_obj: + with zipfile.ZipFile(pdf_file_obj, "r") as zfile: + pages = self.get_pages_content(zfile, blob.source) # type: ignore[arg-type] + + yield from [ + Document( + page_content=page_content, + metadata={ + "source": blob.source, + "page": page_number, + "page_name": page_name, + }, + ) + for page_number, page_name, page_content in pages + ] + + def get_pages_content( + self, zfile: zipfile.ZipFile, source: str + ) -> List[Tuple[int, str, str]]: + """Get the content of the pages of a vsdx file. + + Attributes: + zfile (zipfile.ZipFile): The vsdx file under zip format. + source (str): The path of the vsdx file. + + Returns: + list[tuple[int, str, str]]: A list of tuples containing the page number, + the name of the page and the content of the page + for each page of the vsdx file. + """ + + try: + import xmltodict + except ImportError: + raise ImportError( + "The xmltodict library is required to parse vsdx files. " + "Please install it with `pip install xmltodict`." + ) + + if "visio/pages/pages.xml" not in zfile.namelist(): + print("WARNING - No pages.xml file found in {}".format(source)) # noqa: T201 + return # type: ignore[return-value] + if "visio/pages/_rels/pages.xml.rels" not in zfile.namelist(): + print("WARNING - No pages.xml.rels file found in {}".format(source)) # noqa: T201 + return # type: ignore[return-value] + if "docProps/app.xml" not in zfile.namelist(): + print("WARNING - No app.xml file found in {}".format(source)) # noqa: T201 + return # type: ignore[return-value] + + pagesxml_content: dict = xmltodict.parse(zfile.read("visio/pages/pages.xml")) + appxml_content: dict = xmltodict.parse(zfile.read("docProps/app.xml")) + pagesxmlrels_content: dict = xmltodict.parse( + zfile.read("visio/pages/_rels/pages.xml.rels") + ) + + if isinstance(pagesxml_content["Pages"]["Page"], list): + disordered_names: List[str] = [ + rel["@Name"].strip() for rel in pagesxml_content["Pages"]["Page"] + ] + else: + disordered_names: List[str] = [ # type: ignore[no-redef] + pagesxml_content["Pages"]["Page"]["@Name"].strip() + ] + if isinstance(pagesxmlrels_content["Relationships"]["Relationship"], list): + disordered_paths: List[str] = [ + "visio/pages/" + rel["@Target"] + for rel in pagesxmlrels_content["Relationships"]["Relationship"] + ] + else: + disordered_paths: List[str] = [ # type: ignore[no-redef] + "visio/pages/" + + pagesxmlrels_content["Relationships"]["Relationship"]["@Target"] + ] + ordered_names: List[str] = appxml_content["Properties"]["TitlesOfParts"][ + "vt:vector" + ]["vt:lpstr"][: len(disordered_names)] + ordered_names = [name.strip() for name in ordered_names] + ordered_paths = [ + disordered_paths[disordered_names.index(name.strip())] + for name in ordered_names + ] + + # Pages out of order and without content of their relationships + disordered_pages = [] + for path in ordered_paths: + content = zfile.read(path) + string_content = json.dumps(xmltodict.parse(content)) + + samples = re.findall( + r'"#text"\s*:\s*"([^\\"]*(?:\\.[^\\"]*)*)"', string_content + ) + if len(samples) > 0: + page_content = "\n".join(samples) + map_symboles = { + "\\n": "\n", + "\\t": "\t", + "\\u2013": "-", + "\\u2019": "'", + "\\u00e9r": "é", + "\\u00f4me": "ô", + } + for key, value in map_symboles.items(): + page_content = page_content.replace(key, value) + + disordered_pages.append({"page": path, "page_content": page_content}) + + # Direct relationships of each page in a dict format + pagexml_rels = [ + { + "path": page_path, + "content": xmltodict.parse( + zfile.read(f"visio/pages/_rels/{Path(page_path).stem}.xml.rels") + ), + } + for page_path in ordered_paths + if f"visio/pages/_rels/{Path(page_path).stem}.xml.rels" in zfile.namelist() + ] + + # Pages in order and with content of their relationships (direct and indirect) + ordered_pages: List[Tuple[int, str, str]] = [] + for page_number, (path, page_name) in enumerate( + zip(ordered_paths, ordered_names) + ): + relationships = self.get_relationships( + path, zfile, ordered_paths, pagexml_rels + ) + page_content = "\n".join( + [ + page_["page_content"] + for page_ in disordered_pages + if page_["page"] in relationships + ] + + [ + page_["page_content"] + for page_ in disordered_pages + if page_["page"] == path + ] + ) + ordered_pages.append((page_number, page_name, page_content)) + + return ordered_pages + + def get_relationships( + self, + page: str, + zfile: zipfile.ZipFile, + filelist: List[str], + pagexml_rels: List[dict], + ) -> Set[str]: + """Get the relationships of a page and the relationships of its relationships, + etc... recursively. + Pages are based on other pages (ex: background page), + so we need to get all the relationships to get all the content of a single page. + """ + + name_path = Path(page).name + parent_path = Path(page).parent + rels_path = parent_path / f"_rels/{name_path}.rels" + + if str(rels_path) not in zfile.namelist(): + return set() + + pagexml_rels_content = next( + page_["content"] for page_ in pagexml_rels if page_["path"] == page + ) + + if isinstance(pagexml_rels_content["Relationships"]["Relationship"], list): + targets = [ + rel["@Target"] + for rel in pagexml_rels_content["Relationships"]["Relationship"] + ] + else: + targets = [pagexml_rels_content["Relationships"]["Relationship"]["@Target"]] + + relationships = set( + [str(parent_path / target) for target in targets] + ).intersection(filelist) + + for rel in relationships: + relationships = relationships | self.get_relationships( + rel, zfile, filelist, pagexml_rels + ) + + return relationships diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..95a29d58ca0cb82dea5670647a36aafe1f620f89 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/beautiful_soup_transformer.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/beautiful_soup_transformer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d9b0077778c9aeb61271a7f51fd9fa1858cd001f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/beautiful_soup_transformer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/doctran_text_extract.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/doctran_text_extract.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c3bb5f7cda095e735b58c3a6e53e4521d17968dc Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/doctran_text_extract.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/doctran_text_qa.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/doctran_text_qa.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..173bc68b893476044c1ab20a51acb8505fdef00b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/doctran_text_qa.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/doctran_text_translate.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/doctran_text_translate.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b68eac09a60ba232c72260da180f52f9e1d582d9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/doctran_text_translate.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/embeddings_redundant_filter.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/embeddings_redundant_filter.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..413b64272f760cf0649bd89d8804f877c07b1fa5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/embeddings_redundant_filter.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/google_translate.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/google_translate.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0239651376aa102ef91c2cf2efbc647c50bd87bb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/google_translate.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/html2text.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/html2text.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..73a4c144ed88efda3adacdbce89e31bf071998ce Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/html2text.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/long_context_reorder.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/long_context_reorder.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5423c64e745dbcdc8b71988be705761d0c065485 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/long_context_reorder.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/markdownify.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/markdownify.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d7cf8d41d24ef7b872667edd127ccbde09e694b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/markdownify.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/nuclia_text_transform.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/nuclia_text_transform.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8b6de3a708a7ffcdd044f1b29f042adf61ad47ae Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/nuclia_text_transform.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/openai_functions.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/openai_functions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d136efd9082c7da0e92d7ee3f89ae453b61411a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/__pycache__/openai_functions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/document_transformers/xsl/html_chunks_with_headers.xslt b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/xsl/html_chunks_with_headers.xslt new file mode 100644 index 0000000000000000000000000000000000000000..285edfe892db95c6f27275aa9af0a0f94dd1271f --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/document_transformers/xsl/html_chunks_with_headers.xslt @@ -0,0 +1,199 @@ + + + + + div|p|blockquote|ol|ul + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +

+ +

+
+ + +
+
+ + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + [ + + ]/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..854088d2d392425040db9d3691ce27ab5ea0970b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/aleph_alpha.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/aleph_alpha.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fe0f43c44d3d31f7f5aa3bc85d04ffae95538a04 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/aleph_alpha.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/anyscale.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/anyscale.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dccbf9fd40e3e6030e16eb10db23de2f33aff126 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/anyscale.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ascend.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ascend.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..458dc20b60705509ac846b2f0be6647069f2af7b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ascend.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/awa.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/awa.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b459ee69e77fb1457f02514b1e48b03f1bb86bf1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/awa.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/azure_openai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/azure_openai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..42d964eb3ea65b1bf2c2fa102853239add0a54b9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/azure_openai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/baichuan.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/baichuan.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fd0643c3bbe1cd51e13ad9216dcfa22bd69835fa Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/baichuan.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/baidu_qianfan_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/baidu_qianfan_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a1ee046b1313f637b183df6b5ae9a3580287971c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/baidu_qianfan_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/bedrock.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/bedrock.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..52b95dc27a6fb93a1bb2db2385f3f4a3be0ed7a3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/bedrock.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/bookend.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/bookend.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..66bb0a411040290df4719290221b3d06d8d1f088 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/bookend.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/clarifai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/clarifai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b32b6e8f7314e0c385178daadd41638a363912be Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/clarifai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/cloudflare_workersai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/cloudflare_workersai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..993ab588066a1434410a1e411f7853b4557dc9a9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/cloudflare_workersai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/clova.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/clova.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ec164d92c3429f10a9b1613cbd08fe2ab31b9cad Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/clova.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/cohere.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/cohere.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a9f65f156d902e3e12e1960650a28b106ddffb39 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/cohere.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/dashscope.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/dashscope.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fb198793238af6a01e645e1792f32d7e8e37d860 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/dashscope.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/databricks.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/databricks.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b939252155f6701e8206f9b33ff77c245cab48e9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/databricks.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/deepinfra.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/deepinfra.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8746432c244ed5d8748f6d616fe17405bccc0123 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/deepinfra.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/edenai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/edenai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..55d1e89a4c46f794ec30ed38e2616485e23d61f6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/edenai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/elasticsearch.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/elasticsearch.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..187cf826395b349c7cd83425dcea2fc39414e4c1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/elasticsearch.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/embaas.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/embaas.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf692feadc133e8e7567ecf187a8ad20ba66db08 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/embaas.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ernie.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ernie.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..70364580bd6ad337bfdc840fa909f0cf572aa5bd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ernie.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/fake.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/fake.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..db50e1b7f78277b571cdcf072af60c124a30429d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/fake.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/fastembed.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/fastembed.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c8adcb04f450c8f370908734bd871be6187bbfae Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/fastembed.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/gigachat.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/gigachat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79b77454585ba73db7ced0f6a94c2dcb880e4235 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/gigachat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/google_palm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/google_palm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0a0baec60bf09c364f4ec55e16def60808ce8ade Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/google_palm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/gpt4all.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/gpt4all.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b1fb2cfd464aee339d1c3a7518eb203cf2f32da8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/gpt4all.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/gradient_ai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/gradient_ai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a06780679cbef9069e2262890183367f76970bbe Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/gradient_ai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/huggingface.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/huggingface.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2685bc7937d0d44434b535c0f4121b703c09b2df Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/huggingface.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/huggingface_hub.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/huggingface_hub.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fb2f53fd8a31e103601b0e249a5027885839e167 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/huggingface_hub.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/hunyuan.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/hunyuan.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c93032b8f3b4a85704b98a6387deda06263e6b39 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/hunyuan.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/infinity.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/infinity.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e160a484931409da8e04b0a09574ccd234e6e4cb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/infinity.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/infinity_local.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/infinity_local.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ee2aeb52e7f447494e304c6a64e3488597216cd1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/infinity_local.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ipex_llm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ipex_llm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c88e3238b62929ac7ee119de37641de00cb46f4c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ipex_llm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/itrex.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/itrex.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2789910a91ec62356d96093f56c5e6ce927a40aa Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/itrex.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/javelin_ai_gateway.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/javelin_ai_gateway.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..113b36f5c330e6dc0b40539d73dfefaa9f9d66f3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/javelin_ai_gateway.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/jina.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/jina.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f840075d46f50d03a79c97e40f8c7d83e7276322 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/jina.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/johnsnowlabs.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/johnsnowlabs.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ed464fe1eb6d5c29e6145659a45b78cea41e607b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/johnsnowlabs.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/laser.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/laser.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1c055d6de5ce0447c8a96bdb79efb1298094d1e2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/laser.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/llamacpp.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/llamacpp.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d35589d026e9caff7de2c97357666e6d9e2907ce Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/llamacpp.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/llamafile.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/llamafile.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f228a086811634b00d3cc06e930784f4c035ab42 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/llamafile.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/llm_rails.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/llm_rails.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..deda8fec92398d7357ac63289ddf7d362bc572bd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/llm_rails.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/localai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/localai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c8711013b4f5f8f7b5d2771ea0172fbe6d176418 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/localai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/minimax.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/minimax.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bb2d2848ab2f50dd0ae9b314f834bc0183b957e0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/minimax.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/mlflow.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/mlflow.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..472a38ab770db99543a8b96e8783aa0bd89f73cd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/mlflow.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/mlflow_gateway.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/mlflow_gateway.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dbfd68dec9fdeb937be5448934f32d6231113587 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/mlflow_gateway.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/model2vec.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/model2vec.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d233511f5e2b29d770e7a05072faf0dd9d52c2c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/model2vec.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/modelscope_hub.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/modelscope_hub.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9fa474f98fb529ec89162fc97226472c2a021059 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/modelscope_hub.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/mosaicml.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/mosaicml.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9ba5b29ef99606fea61696183e5ae9d3636984d1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/mosaicml.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/naver.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/naver.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7cdbc83dc001399c1a7f6c1743383bde6ff2e2df Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/naver.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/nemo.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/nemo.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fb38d3152a89ab0a4e23ca1799d5742b8f7e1147 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/nemo.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/nlpcloud.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/nlpcloud.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..94a575539ce9d8d33f90191c6f3f24db4274b083 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/nlpcloud.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/oci_generative_ai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/oci_generative_ai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a253edfc7b0226bfd228981e97ecbd622f3be665 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/oci_generative_ai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/octoai_embeddings.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/octoai_embeddings.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e21f91b1d71298594d4bb061ca2a64dd8c81758 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/octoai_embeddings.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ollama.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ollama.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5ffcaddbaaacfe9ba74525f53d7bd7aca6200be2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ollama.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/openai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/openai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5b63e36a52313e3d040ff492f32045f9a1e21bb7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/openai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/openvino.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/openvino.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0b795ac6fdd3961c5aa578e5acf94f37170b1688 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/openvino.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/optimum_intel.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/optimum_intel.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2431cfb311f56b48fc160313b9f6c4fe62c0bca0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/optimum_intel.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/oracleai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/oracleai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a656dde2a0a4744591e2e73f7fe102eb671c18aa Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/oracleai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ovhcloud.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ovhcloud.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f082269683a7ddf198abc7d27203e04ae5673c1d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/ovhcloud.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/premai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/premai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cf2e9242d2641cecac25a7478383275ff05123db Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/premai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/sagemaker_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/sagemaker_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b0479191c971e257833094b1dce67d6f21bf12cd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/sagemaker_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/sambanova.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/sambanova.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a400811a946bfc32152a95bd38f4d179d500366c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/sambanova.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/self_hosted.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/self_hosted.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d69d23fbae9b12b6763017d353549faf78c9665e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/self_hosted.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/self_hosted_hugging_face.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/self_hosted_hugging_face.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e28ade0dde4da37020b896780a3a8d12766dd2f0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/self_hosted_hugging_face.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/sentence_transformer.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/sentence_transformer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8c05a471348ced80966dc5ac2eaf46049e77f504 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/sentence_transformer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/solar.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/solar.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..940789651e2509eb9317ac16179691223505c7d6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/solar.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/spacy_embeddings.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/spacy_embeddings.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..44226a28cdf068a7dcfe70e4394ce89aae9ce0f9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/spacy_embeddings.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/sparkllm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/sparkllm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..92eb5cede7828936e05ad79c7819a9563da2fa94 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/sparkllm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/tensorflow_hub.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/tensorflow_hub.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4628c284b9ba01267e2c509c1789950d17d8970c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/tensorflow_hub.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/text2vec.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/text2vec.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f854ff05edbf09f241db34c87e945aced832dd63 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/text2vec.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/textembed.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/textembed.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c2247646a1f55eb07e5b499df695da973ddbdc47 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/textembed.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/titan_takeoff.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/titan_takeoff.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fb7184d16e7acb2302d04fd5256401082f244d00 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/titan_takeoff.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/vertexai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/vertexai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41a42fb6f359c4cfa6dc79a4a9952afe5d27d4d3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/vertexai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/volcengine.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/volcengine.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93882cd1a0c1ddd0efda1c332910e8f39ce30ca6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/volcengine.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/voyageai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/voyageai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..417c0e2ad18c49a3009660e0d2af14ead34d591c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/voyageai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/xinference.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/xinference.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93084f7e78c53cd4d12ad495077409151702a8e4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/xinference.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/yandex.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/yandex.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9ab5c5b849a4648801fd2832235182d068c0844e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/yandex.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/zhipuai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/zhipuai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8352716035683c2dc38f51600a9f499bb05f96f1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/embeddings/__pycache__/zhipuai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/example_selectors/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/example_selectors/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af243a547ed56689f5681575a1540d66c6e6f66f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/example_selectors/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/example_selectors/__pycache__/ngram_overlap.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/example_selectors/__pycache__/ngram_overlap.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..53e2c054c72bc2ac0150bfdd73b736fc70ce80ab Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/example_selectors/__pycache__/ngram_overlap.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e123a8816630dd6d8a9be436bcc8f34ab8e7169a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41c7ce2069d216f82310d96e319c43e0cbc3590c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/cassandra.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/cassandra.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cdaddb6c46d0f7de8df56178c2e087d7c7ec436f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/cassandra.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/links.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/links.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1c20c81fde407c986ca77705b03de720fdcd7560 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/links.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/mmr_helper.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/mmr_helper.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..df46dc3ca4b3fa2f340fafbb33929ce807b5c2f9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/mmr_helper.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/networkx.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/networkx.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93b886bc60e5ba819d807a19f3f749f68f54a4c3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/networkx.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/visualize.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/visualize.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b7226f58bcbb8e3a9ab32a3a99192aa449673406 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/__pycache__/visualize.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__init__.py b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8d6a829ef61e8cb4d2b276d86e600eb0a2e3abf1 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__init__.py @@ -0,0 +1,41 @@ +from langchain_community.graph_vectorstores.extractors.gliner_link_extractor import ( + GLiNERInput, + GLiNERLinkExtractor, +) +from langchain_community.graph_vectorstores.extractors.hierarchy_link_extractor import ( + HierarchyInput, + HierarchyLinkExtractor, +) +from langchain_community.graph_vectorstores.extractors.html_link_extractor import ( + HtmlInput, + HtmlLinkExtractor, +) +from langchain_community.graph_vectorstores.extractors.keybert_link_extractor import ( + KeybertInput, + KeybertLinkExtractor, +) +from langchain_community.graph_vectorstores.extractors.link_extractor import ( + LinkExtractor, +) +from langchain_community.graph_vectorstores.extractors.link_extractor_adapter import ( + LinkExtractorAdapter, +) +from langchain_community.graph_vectorstores.extractors.link_extractor_transformer import ( # noqa: E501 + LinkExtractorTransformer, +) + +__all__ = [ + "GLiNERInput", + "GLiNERLinkExtractor", + "HierarchyInput", + "HierarchyLinkExtractor", + "HtmlInput", + "HtmlLinkExtractor", + "KeybertInput", + "KeybertLinkExtractor", + "LinkExtractor", + "LinkExtractor", + "LinkExtractorAdapter", + "LinkExtractorAdapter", + "LinkExtractorTransformer", +] diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e259c6a026b36203063e7511fc4b00919594ceeb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/gliner_link_extractor.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/gliner_link_extractor.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..84c813eafb5b2c1a0df286488d13a73ee4bcd454 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/gliner_link_extractor.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/hierarchy_link_extractor.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/hierarchy_link_extractor.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2bf6824049eea11d5e841260ae131bf6b28f6bf2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/hierarchy_link_extractor.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/html_link_extractor.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/html_link_extractor.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..de11e5cb4a3b70825aca4e0bc9935dc987a40959 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/html_link_extractor.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/keybert_link_extractor.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/keybert_link_extractor.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3d3fca278af228dca1d447fe7902c1cf69c02e18 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/keybert_link_extractor.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/link_extractor.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/link_extractor.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..57e74218e00dee65dc4b1a630d6faec1565f017e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/link_extractor.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/link_extractor_adapter.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/link_extractor_adapter.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..078c0cb5f5f05bbf6c0af9bb808e0855ceef7f59 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/link_extractor_adapter.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/link_extractor_transformer.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/link_extractor_transformer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b25c80f9b1e87b04646f328eda921a1c8b1b9ba1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/__pycache__/link_extractor_transformer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/gliner_link_extractor.py b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/gliner_link_extractor.py new file mode 100644 index 0000000000000000000000000000000000000000..f353ba4a1dc82bf07e2267472ce82934fe9d7154 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/gliner_link_extractor.py @@ -0,0 +1,166 @@ +from typing import Any, Dict, Iterable, List, Optional, Set, Union + +from langchain_core._api import beta +from langchain_core.documents import Document + +from langchain_community.graph_vectorstores.extractors.link_extractor import ( + LinkExtractor, +) +from langchain_community.graph_vectorstores.links import Link + +# TypeAlias is not available in Python 3.9, we can't use that or the newer `type`. +GLiNERInput = Union[str, Document] + + +@beta() +class GLiNERLinkExtractor(LinkExtractor[GLiNERInput]): + """Link documents with common named entities using `GLiNER`_. + + `GLiNER`_ is a Named Entity Recognition (NER) model capable of identifying any + entity type using a bidirectional transformer encoder (BERT-like). + + The ``GLiNERLinkExtractor`` uses GLiNER to create links between documents that + have named entities in common. + + Example:: + + extractor = GLiNERLinkExtractor( + labels=["Person", "Award", "Date", "Competitions", "Teams"] + ) + results = extractor.extract_one("some long text...") + + .. _GLiNER: https://github.com/urchade/GLiNER + + .. seealso:: + + - :mod:`How to use a graph vector store ` + - :class:`How to create links between documents ` + + How to link Documents on common named entities + ============================================== + + Preliminaries + ------------- + + Install the ``gliner`` package: + + .. code-block:: bash + + pip install -q langchain_community gliner + + Usage + ----- + + We load the ``state_of_the_union.txt`` file, chunk it, then for each chunk we + extract named entity links and add them to the chunk. + + Using extract_one() + ^^^^^^^^^^^^^^^^^^^ + + We can use :meth:`extract_one` on a document to get the links and add the links + to the document metadata with + :meth:`~langchain_community.graph_vectorstores.links.add_links`:: + + from langchain_community.document_loaders import TextLoader + from langchain_community.graph_vectorstores import CassandraGraphVectorStore + from langchain_community.graph_vectorstores.extractors import GLiNERLinkExtractor + from langchain_community.graph_vectorstores.links import add_links + from langchain_text_splitters import CharacterTextSplitter + + loader = TextLoader("state_of_the_union.txt") + raw_documents = loader.load() + + text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0) + documents = text_splitter.split_documents(raw_documents) + + ner_extractor = GLiNERLinkExtractor(["Person", "Topic"]) + for document in documents: + links = ner_extractor.extract_one(document) + add_links(document, links) + + print(documents[0].metadata) + + .. code-block:: output + + {'source': 'state_of_the_union.txt', 'links': [Link(kind='entity:Person', direction='bidir', tag='President Zelenskyy'), Link(kind='entity:Person', direction='bidir', tag='Vladimir Putin')]} + + Using LinkExtractorTransformer + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + Using the :class:`~langchain_community.graph_vectorstores.extractors.link_extractor_transformer.LinkExtractorTransformer`, + we can simplify the link extraction:: + + from langchain_community.document_loaders import TextLoader + from langchain_community.graph_vectorstores.extractors import ( + GLiNERLinkExtractor, + LinkExtractorTransformer, + ) + from langchain_text_splitters import CharacterTextSplitter + + loader = TextLoader("state_of_the_union.txt") + raw_documents = loader.load() + + text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0) + documents = text_splitter.split_documents(raw_documents) + + ner_extractor = GLiNERLinkExtractor(["Person", "Topic"]) + transformer = LinkExtractorTransformer([ner_extractor]) + documents = transformer.transform_documents(documents) + + print(documents[0].metadata) + + .. code-block:: output + + {'source': 'state_of_the_union.txt', 'links': [Link(kind='entity:Person', direction='bidir', tag='President Zelenskyy'), Link(kind='entity:Person', direction='bidir', tag='Vladimir Putin')]} + + The documents with named entity links can then be added to a :class:`~langchain_community.graph_vectorstores.base.GraphVectorStore`:: + + from langchain_community.graph_vectorstores import CassandraGraphVectorStore + + store = CassandraGraphVectorStore.from_documents(documents=documents, embedding=...) + + Args: + labels: List of kinds of entities to extract. + kind: Kind of links to produce with this extractor. + model: GLiNER model to use. + extract_kwargs: Keyword arguments to pass to GLiNER. + """ # noqa: E501 + + def __init__( + self, + labels: List[str], + *, + kind: str = "entity", + model: str = "urchade/gliner_mediumv2.1", + extract_kwargs: Optional[Dict[str, Any]] = None, + ): + try: + from gliner import GLiNER + + self._model = GLiNER.from_pretrained(model) + + except ImportError: + raise ImportError( + "gliner is required for GLiNERLinkExtractor. " + "Please install it with `pip install gliner`." + ) from None + + self._labels = labels + self._kind = kind + self._extract_kwargs = extract_kwargs or {} + + def extract_one(self, input: GLiNERInput) -> Set[Link]: # noqa: A002 + return next(iter(self.extract_many([input]))) + + def extract_many( + self, + inputs: Iterable[GLiNERInput], + ) -> Iterable[Set[Link]]: + strs = [i if isinstance(i, str) else i.page_content for i in inputs] + for entities in self._model.batch_predict_entities( + strs, self._labels, **self._extract_kwargs + ): + yield { + Link.bidir(kind=f"{self._kind}:{e['label']}", tag=e["text"]) + for e in entities + } diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/hierarchy_link_extractor.py b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/hierarchy_link_extractor.py new file mode 100644 index 0000000000000000000000000000000000000000..d838210aded319e90b3cd7031feb6c50fee50c21 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/hierarchy_link_extractor.py @@ -0,0 +1,110 @@ +from typing import Callable, List, Set + +from langchain_core._api import beta +from langchain_core.documents import Document + +from langchain_community.graph_vectorstores.extractors.link_extractor import ( + LinkExtractor, +) +from langchain_community.graph_vectorstores.extractors.link_extractor_adapter import ( + LinkExtractorAdapter, +) +from langchain_community.graph_vectorstores.links import Link + +# TypeAlias is not available in Python 3.9, we can't use that or the newer `type`. +HierarchyInput = List[str] + +_PARENT: str = "p:" +_CHILD: str = "c:" +_SIBLING: str = "s:" + + +@beta() +class HierarchyLinkExtractor(LinkExtractor[HierarchyInput]): + def __init__( + self, + *, + kind: str = "hierarchy", + parent_links: bool = True, + child_links: bool = False, + sibling_links: bool = False, + ): + """Extract links from a document hierarchy. + + Example: + + .. code-block:: python + + # Given three paths (in this case, within the "Root" document): + h1 = ["Root", "H1"] + h1a = ["Root", "H1", "a"] + h1b = ["Root", "H1", "b"] + + # Parent links `h1a` and `h1b` to `h1`. + # Child links `h1` to `h1a` and `h1b`. + # Sibling links `h1a` and `h1b` together (both directions). + + Example use with documents: + .. code_block: python + transformer = LinkExtractorTransformer([ + HierarchyLinkExtractor().as_document_extractor( + # Assumes the "path" to each document is in the metadata. + # Could split strings, etc. + lambda doc: doc.metadata.get("path", []) + ) + ]) + linked = transformer.transform_documents(docs) + + Args: + kind: Kind of links to produce with this extractor. + parent_links: Link from a section to its parent. + child_links: Link from a section to its children. + sibling_links: Link from a section to other sections with the same parent. + """ + self._kind = kind + self._parent_links = parent_links + self._child_links = child_links + self._sibling_links = sibling_links + + def as_document_extractor( + self, hierarchy: Callable[[Document], HierarchyInput] + ) -> LinkExtractor[Document]: + """Create a LinkExtractor from `Document`. + + Args: + hierarchy: Function that returns the path for the given document. + + Returns: + A `LinkExtractor[Document]` suitable for application to `Documents` directly + or with `LinkExtractorTransformer`. + """ + return LinkExtractorAdapter(underlying=self, transform=hierarchy) + + def extract_one( + self, + input: HierarchyInput, + ) -> Set[Link]: + this_path = "/".join(input) + parent_path = None + + links = set() + if self._parent_links: + # This is linked from everything with this parent path. + links.add(Link.incoming(kind=self._kind, tag=_PARENT + this_path)) + if self._child_links: + # This is linked to every child with this as it's "parent" path. + links.add(Link.outgoing(kind=self._kind, tag=_CHILD + this_path)) + + if len(input) >= 1: + parent_path = "/".join(input[0:-1]) + if self._parent_links and len(input) > 1: + # This is linked to the nodes with the given parent path. + links.add(Link.outgoing(kind=self._kind, tag=_PARENT + parent_path)) + if self._child_links and len(input) > 1: + # This is linked from every node with the given parent path. + links.add(Link.incoming(kind=self._kind, tag=_CHILD + parent_path)) + if self._sibling_links: + # This is a sibling of everything with the same parent. + links.add(Link.bidir(kind=self._kind, tag=_SIBLING + parent_path)) + + return links diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/html_link_extractor.py b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/html_link_extractor.py new file mode 100644 index 0000000000000000000000000000000000000000..fddb852d6ee057084a73d81c4f72a3637713c8ad --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/html_link_extractor.py @@ -0,0 +1,291 @@ +from __future__ import annotations + +from dataclasses import dataclass +from typing import TYPE_CHECKING, List, Optional, Set, Union +from urllib.parse import urldefrag, urljoin, urlparse + +from langchain_core._api import beta +from langchain_core.documents import Document + +from langchain_community.graph_vectorstores import Link +from langchain_community.graph_vectorstores.extractors.link_extractor import ( + LinkExtractor, +) +from langchain_community.graph_vectorstores.extractors.link_extractor_adapter import ( + LinkExtractorAdapter, +) + +if TYPE_CHECKING: + from bs4 import BeautifulSoup + from bs4.element import Tag + + +def _parse_url(link: Tag, page_url: str, drop_fragments: bool = True) -> Optional[str]: + href = link.get("href") + if href is None: + return None + url = urlparse(href) # type: ignore[arg-type] + if url.scheme not in ["http", "https", ""]: + return None + + # Join the HREF with the page_url to convert relative paths to absolute. + url = str(urljoin(page_url, href)) # type: ignore[type-var, assignment] + + # Fragments would be useful if we chunked a page based on section. + # Then, each chunk would have a different URL based on the fragment. + # Since we aren't doing that yet, they just "break" links. So, drop + # the fragment. + if drop_fragments: + return urldefrag(url).url # type: ignore[call-overload] + return url # type: ignore[return-value] + + +def _parse_hrefs( + soup: BeautifulSoup, url: str, drop_fragments: bool = True +) -> Set[str]: + soup_links: List[Tag] = soup.find_all("a") + links: Set[str] = set() + + for link in soup_links: + parse_url = _parse_url(link, page_url=url, drop_fragments=drop_fragments) + # Remove self links and entries for any 'a' tag that failed to parse + # (didn't have href, or invalid domain, etc.) + if parse_url and parse_url != url: + links.add(parse_url) + + return links + + +@dataclass +class HtmlInput: + content: Union[str, BeautifulSoup] + base_url: str + + +@beta() +class HtmlLinkExtractor(LinkExtractor[HtmlInput]): + def __init__(self, *, kind: str = "hyperlink", drop_fragments: bool = True): + """Extract hyperlinks from HTML content. + + Expects the input to be an HTML string or a `BeautifulSoup` object. + + Example:: + + extractor = HtmlLinkExtractor() + results = extractor.extract_one(HtmlInput(html, url)) + + .. seealso:: + + - :mod:`How to use a graph vector store ` + - :class:`How to create links between documents ` + + How to link Documents on hyperlinks in HTML + =========================================== + + Preliminaries + ------------- + + Install the ``beautifulsoup4`` package: + + .. code-block:: bash + + pip install -q langchain_community beautifulsoup4 + + Usage + ----- + + For this example, we'll scrape 2 HTML pages that have an hyperlink from one + page to the other using an ``AsyncHtmlLoader``. + Then we use the ``HtmlLinkExtractor`` to create the links in the documents. + + Using extract_one() + ^^^^^^^^^^^^^^^^^^^ + + We can use :meth:`extract_one` on a document to get the links and add the links + to the document metadata with + :meth:`~langchain_community.graph_vectorstores.links.add_links`:: + + from langchain_community.document_loaders import AsyncHtmlLoader + from langchain_community.graph_vectorstores.extractors import ( + HtmlInput, + HtmlLinkExtractor, + ) + from langchain_community.graph_vectorstores.links import add_links + from langchain_core.documents import Document + + loader = AsyncHtmlLoader( + [ + "https://python.langchain.com/docs/integrations/providers/astradb/", + "https://docs.datastax.com/en/astra/home/astra.html", + ] + ) + + documents = loader.load() + + html_extractor = HtmlLinkExtractor() + + for doc in documents: + links = html_extractor.extract_one(HtmlInput(doc.page_content, url)) + add_links(doc, links) + + documents[0].metadata["links"][:5] + + .. code-block:: output + + [Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/integrations/providers/spreedly/'), + Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/integrations/providers/nvidia/'), + Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/integrations/providers/ray_serve/'), + Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/integrations/providers/bageldb/'), + Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/introduction/')] + + Using as_document_extractor() + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + If you use a document loader that returns the raw HTML and that sets the source + key in the document metadata such as ``AsyncHtmlLoader``, + you can simplify by using :meth:`as_document_extractor` that takes directly a + ``Document`` as input:: + + from langchain_community.document_loaders import AsyncHtmlLoader + from langchain_community.graph_vectorstores.extractors import HtmlLinkExtractor + from langchain_community.graph_vectorstores.links import add_links + + loader = AsyncHtmlLoader( + [ + "https://python.langchain.com/docs/integrations/providers/astradb/", + "https://docs.datastax.com/en/astra/home/astra.html", + ] + ) + documents = loader.load() + html_extractor = HtmlLinkExtractor().as_document_extractor() + + for document in documents: + links = html_extractor.extract_one(document) + add_links(document, links) + + documents[0].metadata["links"][:5] + + .. code-block:: output + + [Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/integrations/providers/spreedly/'), + Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/integrations/providers/nvidia/'), + Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/integrations/providers/ray_serve/'), + Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/integrations/providers/bageldb/'), + Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/introduction/')] + + Using LinkExtractorTransformer + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + Using the :class:`~langchain_community.graph_vectorstores.extractors.link_extractor_transformer.LinkExtractorTransformer`, + we can simplify the link extraction:: + + from langchain_community.document_loaders import AsyncHtmlLoader + from langchain_community.graph_vectorstores.extractors import ( + HtmlLinkExtractor, + LinkExtractorTransformer, + ) + from langchain_community.graph_vectorstores.links import add_links + + loader = AsyncHtmlLoader( + [ + "https://python.langchain.com/docs/integrations/providers/astradb/", + "https://docs.datastax.com/en/astra/home/astra.html", + ] + ) + + documents = loader.load() + transformer = LinkExtractorTransformer([HtmlLinkExtractor().as_document_extractor()]) + documents = transformer.transform_documents(documents) + + documents[0].metadata["links"][:5] + + .. code-block:: output + + [Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/integrations/providers/spreedly/'), + Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/integrations/providers/nvidia/'), + Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/integrations/providers/ray_serve/'), + Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/integrations/providers/bageldb/'), + Link(kind='hyperlink', direction='out', tag='https://python.langchain.com/docs/introduction/')] + + We can check that there is a link from the first document to the second:: + + for doc_to in documents: + for link_to in doc_to.metadata["links"]: + if link_to.direction == "in": + for doc_from in documents: + for link_from in doc_from.metadata["links"]: + if ( + link_to.direction == "in" + and link_from.direction == "out" + and link_to.tag == link_from.tag + ): + print( + f"Found link from {doc_from.metadata['source']} to {doc_to.metadata['source']}." + ) + + .. code-block:: output + + Found link from https://python.langchain.com/docs/integrations/providers/astradb/ to https://docs.datastax.com/en/astra/home/astra.html. + + The documents with URL links can then be added to a :class:`~langchain_community.graph_vectorstores.base.GraphVectorStore`:: + + from langchain_community.graph_vectorstores import CassandraGraphVectorStore + + store = CassandraGraphVectorStore.from_documents(documents=documents, embedding=...) + + Args: + kind: The kind of edge to extract. Defaults to ``hyperlink``. + drop_fragments: Whether fragments in URLs and links should be + dropped. Defaults to ``True``. + """ # noqa: E501 + try: + import bs4 # noqa:F401 + except ImportError as e: + raise ImportError( + "BeautifulSoup4 is required for HtmlLinkExtractor. " + "Please install it with `pip install beautifulsoup4`." + ) from e + + self._kind = kind + self.drop_fragments = drop_fragments + + def as_document_extractor( + self, url_metadata_key: str = "source" + ) -> LinkExtractor[Document]: + """Return a LinkExtractor that applies to documents. + + Note: + Since the HtmlLinkExtractor parses HTML, if you use with other similar + link extractors it may be more efficient to call the link extractors + directly on the parsed BeautifulSoup object. + + Args: + url_metadata_key: The name of the filed in document metadata with the URL of + the document. + """ + return LinkExtractorAdapter( + underlying=self, + transform=lambda doc: HtmlInput( + doc.page_content, doc.metadata[url_metadata_key] + ), + ) + + def extract_one( + self, + input: HtmlInput, # noqa: A002 + ) -> Set[Link]: + content = input.content + if isinstance(content, str): + from bs4 import BeautifulSoup + + content = BeautifulSoup(content, "html.parser") + + base_url = input.base_url + if self.drop_fragments: + base_url = urldefrag(base_url).url + + hrefs = _parse_hrefs(content, base_url, self.drop_fragments) + + links = {Link.outgoing(kind=self._kind, tag=url) for url in hrefs} + links.add(Link.incoming(kind=self._kind, tag=base_url)) + return links diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/keybert_link_extractor.py b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/keybert_link_extractor.py new file mode 100644 index 0000000000000000000000000000000000000000..3844df84f76ef4f696f7eec68fa77e3e6cf09abe --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/keybert_link_extractor.py @@ -0,0 +1,167 @@ +from typing import Any, Dict, Iterable, Optional, Set, Union + +from langchain_core._api import beta +from langchain_core.documents import Document + +from langchain_community.graph_vectorstores.extractors.link_extractor import ( + LinkExtractor, +) +from langchain_community.graph_vectorstores.links import Link + +KeybertInput = Union[str, Document] + + +@beta() +class KeybertLinkExtractor(LinkExtractor[KeybertInput]): + def __init__( + self, + *, + kind: str = "kw", + embedding_model: str = "all-MiniLM-L6-v2", + extract_keywords_kwargs: Optional[Dict[str, Any]] = None, + ): + """Extract keywords using `KeyBERT `_. + + KeyBERT is a minimal and easy-to-use keyword extraction technique that + leverages BERT embeddings to create keywords and keyphrases that are most + similar to a document. + + The KeybertLinkExtractor uses KeyBERT to create links between documents that + have keywords in common. + + Example:: + + extractor = KeybertLinkExtractor() + results = extractor.extract_one("lorem ipsum...") + + .. seealso:: + + - :mod:`How to use a graph vector store ` + - :class:`How to create links between documents ` + + How to link Documents on common keywords using Keybert + ====================================================== + + Preliminaries + ------------- + + Install the keybert package: + + .. code-block:: bash + + pip install -q langchain_community keybert + + Usage + ----- + + We load the ``state_of_the_union.txt`` file, chunk it, then for each chunk we + extract keyword links and add them to the chunk. + + Using extract_one() + ^^^^^^^^^^^^^^^^^^^ + + We can use :meth:`extract_one` on a document to get the links and add the links + to the document metadata with + :meth:`~langchain_community.graph_vectorstores.links.add_links`:: + + from langchain_community.document_loaders import TextLoader + from langchain_community.graph_vectorstores import CassandraGraphVectorStore + from langchain_community.graph_vectorstores.extractors import KeybertLinkExtractor + from langchain_community.graph_vectorstores.links import add_links + from langchain_text_splitters import CharacterTextSplitter + + loader = TextLoader("state_of_the_union.txt") + + raw_documents = loader.load() + text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0) + + documents = text_splitter.split_documents(raw_documents) + keyword_extractor = KeybertLinkExtractor() + + for document in documents: + links = keyword_extractor.extract_one(document) + add_links(document, links) + + print(documents[0].metadata) + + .. code-block:: output + + {'source': 'state_of_the_union.txt', 'links': [Link(kind='kw', direction='bidir', tag='ukraine'), Link(kind='kw', direction='bidir', tag='ukrainian'), Link(kind='kw', direction='bidir', tag='putin'), Link(kind='kw', direction='bidir', tag='vladimir'), Link(kind='kw', direction='bidir', tag='russia')]} + + Using LinkExtractorTransformer + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + Using the :class:`~langchain_community.graph_vectorstores.extractors.link_extractor_transformer.LinkExtractorTransformer`, + we can simplify the link extraction:: + + from langchain_community.document_loaders import TextLoader + from langchain_community.graph_vectorstores.extractors import ( + KeybertLinkExtractor, + LinkExtractorTransformer, + ) + from langchain_text_splitters import CharacterTextSplitter + + loader = TextLoader("state_of_the_union.txt") + raw_documents = loader.load() + + text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0) + documents = text_splitter.split_documents(raw_documents) + + transformer = LinkExtractorTransformer([KeybertLinkExtractor()]) + documents = transformer.transform_documents(documents) + + print(documents[0].metadata) + + .. code-block:: output + + {'source': 'state_of_the_union.txt', 'links': [Link(kind='kw', direction='bidir', tag='ukraine'), Link(kind='kw', direction='bidir', tag='ukrainian'), Link(kind='kw', direction='bidir', tag='putin'), Link(kind='kw', direction='bidir', tag='vladimir'), Link(kind='kw', direction='bidir', tag='russia')]} + + The documents with keyword links can then be added to a :class:`~langchain_community.graph_vectorstores.base.GraphVectorStore`:: + + from langchain_community.graph_vectorstores import CassandraGraphVectorStore + + store = CassandraGraphVectorStore.from_documents(documents=documents, embedding=...) + + Args: + kind: Kind of links to produce with this extractor. + embedding_model: Name of the embedding model to use with KeyBERT. + extract_keywords_kwargs: Keyword arguments to pass to KeyBERT's + ``extract_keywords`` method. + """ # noqa: E501 + try: + import keybert + + self._kw_model = keybert.KeyBERT(model=embedding_model) + except ImportError: + raise ImportError( + "keybert is required for KeybertLinkExtractor. " + "Please install it with `pip install keybert`." + ) from None + + self._kind = kind + self._extract_keywords_kwargs = extract_keywords_kwargs or {} + + def extract_one(self, input: KeybertInput) -> Set[Link]: # noqa: A002 + keywords = self._kw_model.extract_keywords( + input if isinstance(input, str) else input.page_content, + **self._extract_keywords_kwargs, + ) + return {Link.bidir(kind=self._kind, tag=kw[0]) for kw in keywords} + + def extract_many( + self, + inputs: Iterable[KeybertInput], + ) -> Iterable[Set[Link]]: + inputs = list(inputs) + if len(inputs) == 1: + # Even though we pass a list, if it contains one item, keybert will + # flatten it. This means it's easier to just call the special case + # for one item. + yield self.extract_one(inputs[0]) + elif len(inputs) > 1: + strs = [i if isinstance(i, str) else i.page_content for i in inputs] + extracted = self._kw_model.extract_keywords( + strs, **self._extract_keywords_kwargs + ) + for keywords in extracted: + yield {Link.bidir(kind=self._kind, tag=kw[0]) for kw in keywords} diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/link_extractor.py b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/link_extractor.py new file mode 100644 index 0000000000000000000000000000000000000000..bb141dccc53cddb754fd0082a1d9c9ca1f51cd4a --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/link_extractor.py @@ -0,0 +1,39 @@ +from __future__ import annotations + +from abc import ABC, abstractmethod +from typing import Generic, Iterable, Set, TypeVar + +from langchain_core._api import beta + +from langchain_community.graph_vectorstores import Link + +InputT = TypeVar("InputT") + +METADATA_LINKS_KEY = "links" + + +@beta() +class LinkExtractor(ABC, Generic[InputT]): + """Interface for extracting links (incoming, outgoing, bidirectional).""" + + @abstractmethod + def extract_one(self, input: InputT) -> Set[Link]: + """Add edges from each `input` to the corresponding documents. + + Args: + input: The input content to extract edges from. + + Returns: + Set of links extracted from the input. + """ + + def extract_many(self, inputs: Iterable[InputT]) -> Iterable[Set[Link]]: + """Add edges from each `input` to the corresponding documents. + + Args: + inputs: The input content to extract edges from. + + Returns: + Iterable over the set of links extracted from the input. + """ + return map(self.extract_one, inputs) diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/link_extractor_adapter.py b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/link_extractor_adapter.py new file mode 100644 index 0000000000000000000000000000000000000000..73b6761eff92a117e55259341f9c80e291bc4fc5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/link_extractor_adapter.py @@ -0,0 +1,29 @@ +from typing import Callable, Iterable, Set, TypeVar + +from langchain_core._api import beta + +from langchain_community.graph_vectorstores import Link +from langchain_community.graph_vectorstores.extractors.link_extractor import ( + LinkExtractor, +) + +InputT = TypeVar("InputT") +UnderlyingInputT = TypeVar("UnderlyingInputT") + + +@beta() +class LinkExtractorAdapter(LinkExtractor[InputT]): + def __init__( + self, + underlying: LinkExtractor[UnderlyingInputT], + transform: Callable[[InputT], UnderlyingInputT], + ) -> None: + self._underlying = underlying + self._transform = transform + + def extract_one(self, input: InputT) -> Set[Link]: # noqa: A002 + return self._underlying.extract_one(self._transform(input)) + + def extract_many(self, inputs: Iterable[InputT]) -> Iterable[Set[Link]]: + underlying_inputs = map(self._transform, inputs) + return self._underlying.extract_many(underlying_inputs) diff --git a/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/link_extractor_transformer.py b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/link_extractor_transformer.py new file mode 100644 index 0000000000000000000000000000000000000000..ba78fa2100fb4bb4bb4ccaa1892b9f5f8bab42c2 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/graph_vectorstores/extractors/link_extractor_transformer.py @@ -0,0 +1,45 @@ +from typing import Any, Sequence + +from langchain_core._api import beta +from langchain_core.documents import Document +from langchain_core.documents.transformers import BaseDocumentTransformer + +from langchain_community.graph_vectorstores.extractors.link_extractor import ( + LinkExtractor, +) +from langchain_community.graph_vectorstores.links import copy_with_links + + +@beta() +class LinkExtractorTransformer(BaseDocumentTransformer): + """DocumentTransformer for applying one or more LinkExtractors. + + Example: + .. code-block:: python + + extract_links = LinkExtractorTransformer([ + HtmlLinkExtractor().as_document_extractor(), + ]) + extract_links.transform_documents(docs) + """ + + def __init__(self, link_extractors: Sequence[LinkExtractor[Document]]): + """Create a DocumentTransformer which adds extracted links to each document.""" + self.link_extractors = link_extractors + + def transform_documents( + self, documents: Sequence[Document], **kwargs: Any + ) -> Sequence[Document]: + # Implement `transform_docments` directly, so that LinkExtractors which operate + # better in batch (`extract_many`) get a chance to do so. + + # Run each extractor over all documents. + links_per_extractor = [e.extract_many(documents) for e in self.link_extractors] + + # Transpose the list of lists to pair each document with the tuple of links. + links_per_document = zip(*links_per_extractor) + + return [ + copy_with_links(document, *links) + for document, links in zip(documents, links_per_document) + ] diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b822c951b52628f2d3d0e71a1d3441ccae1bb529 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/age_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/age_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3e2b07b756adc2acb8840fe9feadab757e6e4c77 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/age_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/arangodb_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/arangodb_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..185f0c0e774bc62a0538aab62bb5aaf49026dc34 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/arangodb_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/falkordb_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/falkordb_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..439341690ccb4905417b2025b9116cb384b13162 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/falkordb_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/graph_document.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/graph_document.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1474f4f31880f3071ef54062a384215e9f3d8d83 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/graph_document.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/graph_store.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/graph_store.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ab29bb766fccae7ee232c75fd160cbc06059d5e4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/graph_store.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/gremlin_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/gremlin_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9c041233d62d5f17a5951d211184b86376f497e0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/gremlin_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/hugegraph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/hugegraph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..395cd1c8c360498e565cf09f532a98daaa238782 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/hugegraph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/index_creator.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/index_creator.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..83328ebf5c4abda872edb35971184f622ac81c52 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/index_creator.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/kuzu_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/kuzu_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d932ca9680998987d66fda374d12e4d3606dc43 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/kuzu_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/memgraph_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/memgraph_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fd448cb32966c4377efceaab6d64e7d0f39b28f7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/memgraph_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/nebula_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/nebula_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a3472143342663720b60584fe41e4bf2e833d92a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/nebula_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/neo4j_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/neo4j_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e2046ce2dcace6ef473f45214f09f7c6ee63c2e3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/neo4j_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/neptune_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/neptune_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7ef6c1845824b74c7e4d078990e8887f8db6f62 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/neptune_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/neptune_rdf_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/neptune_rdf_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fa17faef9248fbe373498372c7d579b5724721f4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/neptune_rdf_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/networkx_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/networkx_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e4216043f6e1129f49da1ecaf67b54c797f33b86 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/networkx_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/ontotext_graphdb_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/ontotext_graphdb_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a69a1fa85345700661b1ddea51625149f1fa455b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/ontotext_graphdb_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/rdf_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/rdf_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..392a435fcc7ae4787632db8be27510cb39e354b3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/rdf_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/tigergraph_graph.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/tigergraph_graph.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bd1ad267e8ad0df99d9f5708424a8e715d0103ec Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/graphs/__pycache__/tigergraph_graph.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/indexes/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/indexes/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e779e2782236e00fe94ca425c4a90a25c5b0cd96 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/indexes/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/indexes/__pycache__/_document_manager.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/indexes/__pycache__/_document_manager.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..14a0c35fad5c63b8466ed2ba5de572794ade2e31 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/indexes/__pycache__/_document_manager.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/indexes/__pycache__/_sql_record_manager.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/indexes/__pycache__/_sql_record_manager.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e08e60a71109de1ee8b4cde72dd906bf929cc61b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/indexes/__pycache__/_sql_record_manager.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/indexes/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/indexes/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..861e3368797d7343b63c18f8a4d482c897ddd379 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/indexes/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..919bd7faaee8691e729b4da253029cc98152d185 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ai21.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ai21.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0bd4109f5bc2b6f362b3b8f7356b6892bcb7c7c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ai21.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/aleph_alpha.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/aleph_alpha.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ee498abc5bc22969385947d521e6bb8535d7e68 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/aleph_alpha.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/amazon_api_gateway.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/amazon_api_gateway.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f05b8ccd85ba0520af52ef5387e26ef0580b004 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/amazon_api_gateway.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/anthropic.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/anthropic.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0aeb2e5370468fb1a215b59e6c69047a51b599dd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/anthropic.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/anyscale.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/anyscale.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ec32eb4b0d02a2c58a963eadae08ddd60aaf2041 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/anyscale.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/aphrodite.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/aphrodite.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..95915c96fb2c5f3b5f195997cad1663bd14700ad Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/aphrodite.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/arcee.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/arcee.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ae6f867217858867bb29cd467b3a4804c5016454 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/arcee.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/aviary.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/aviary.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..37979a78d8fcd4b77ba109719135fd2033365ddf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/aviary.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/azureml_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/azureml_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3e1a1280a71020105ffecb592016b92f1b806aaa Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/azureml_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/baichuan.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/baichuan.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7fbc239cc58c64e3f3f1efd3d0c4c2c644aacfde Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/baichuan.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/baidu_qianfan_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/baidu_qianfan_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..00b39f9ac85242956b81c82d3694006bd229dc11 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/baidu_qianfan_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/bananadev.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/bananadev.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b50a5dcb6a02c5cd9b5391c9831379c5fff0f518 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/bananadev.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/baseten.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/baseten.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0b6fd7b4af36d2e8eb26699dcdbc6b93a453844d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/baseten.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/beam.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/beam.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dd5a6e821a02555cb2b9e485e453a3ad87c9700b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/beam.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/bedrock.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/bedrock.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e628805e9c4e178ae4d5cc424e61427e4e63b1ac Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/bedrock.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/bigdl_llm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/bigdl_llm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3e8d06c4af2a67ac18ef4f904268830cd45a3ce8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/bigdl_llm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/bittensor.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/bittensor.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1bcc6b5ac64bd92eabfdaf0db42a2932f96e71be Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/bittensor.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/cerebriumai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/cerebriumai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cde965dcdb13ed0db1feec20a2e7e9a9aea6df74 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/cerebriumai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/chatglm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/chatglm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c297ed9cc468e37f566f7c74734bd3f68cc4b7f6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/chatglm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/chatglm3.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/chatglm3.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7f96d0e8dfe717e855853ff48b2888c37d43e52a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/chatglm3.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/clarifai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/clarifai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fed866741a5cc365fc3cbb8e3732f1903cb97aff Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/clarifai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/cloudflare_workersai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/cloudflare_workersai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6698949252a9c662355ddc7586e27e157ba6c357 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/cloudflare_workersai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/cohere.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/cohere.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..20292b0f9ed51adfef8a3db8b1fdf456d47cc726 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/cohere.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ctransformers.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ctransformers.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b6b7f530f82b8dc8628454006df4d5555dca360b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ctransformers.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ctranslate2.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ctranslate2.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b388746eb838baa0feb30f98b1271117c2e3d62a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ctranslate2.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/databricks.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/databricks.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..be9a420ef3847c99bd6ab8c986097262576c8d5d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/databricks.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/deepinfra.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/deepinfra.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0bae144616effdbdcd4dc0ad8dc1fbdadaa112de Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/deepinfra.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/deepsparse.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/deepsparse.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e7b8a9818092fd840e0d6609873a2067f9776685 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/deepsparse.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/edenai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/edenai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..94fca6d01e7e9c8ff259e899249c0118f2d79702 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/edenai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/exllamav2.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/exllamav2.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6c8a4442129b614d096e2a4b61547726a896d3ee Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/exllamav2.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/fake.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/fake.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68f318204154bdf6a4af85c9264b8af5764017ad Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/fake.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/fireworks.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/fireworks.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2c4f4b77f3585d2dc637193f6709215fc0b04302 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/fireworks.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/forefrontai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/forefrontai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d74f149f61264004374ca9c3b450b0ffe4b2e08 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/forefrontai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/friendli.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/friendli.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b21d931e65785d829f8432d7df90eef974d0ad90 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/friendli.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/gigachat.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/gigachat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b7b45791fad20aabdd265292f01f6c4ba8c23c99 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/gigachat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/google_palm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/google_palm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eaf27229333d91b5dbb27e656e4f46127da89c9b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/google_palm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/gooseai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/gooseai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bd3bd0d979855335f21559b45fb55fef21312bbd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/gooseai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/gpt4all.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/gpt4all.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..29bd9881e5444dccc4745c5079e4d84e42640892 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/gpt4all.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/gradient_ai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/gradient_ai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e2f09009bba6ffb2c9f2f4d0a2d7d85c3cf7e48 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/gradient_ai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/huggingface_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/huggingface_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8767187cf13afa6e50c7962339d6aee0b20359d4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/huggingface_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/huggingface_hub.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/huggingface_hub.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..45f9314e5880230804be60b225b8f20003a384ed Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/huggingface_hub.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/huggingface_pipeline.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/huggingface_pipeline.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1473b6900baac03f6a92bb80ca0a6252ba7447db Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/huggingface_pipeline.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/huggingface_text_gen_inference.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/huggingface_text_gen_inference.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..de86b8699b1ac818bf3e86e1e293e2e4945ad002 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/huggingface_text_gen_inference.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/human.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/human.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5e8fe146badbea5aa34f6ecbcb48356f7d604cc5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/human.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ipex_llm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ipex_llm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7665dcf17b56f87a2bb0a16e7b2cc69cb3e694ef Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ipex_llm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/javelin_ai_gateway.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/javelin_ai_gateway.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ff1f2cab4890ccbe471cec56455ba8ca4357136 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/javelin_ai_gateway.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/koboldai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/koboldai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..00193d35cbdbde00484fb3de302e181aa40f42c9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/koboldai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/konko.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/konko.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f6e83a6fda6259cfd7a3fda5252e24f7b8fb2d52 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/konko.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/layerup_security.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/layerup_security.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93df101eaed75c5f081d2dc2d5719d1f1a0b06fc Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/layerup_security.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/llamacpp.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/llamacpp.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..04cbcfb9659271128ca5a90120ac3f9166313e36 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/llamacpp.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/llamafile.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/llamafile.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e0f09807f7d32d5d562d85de29aa88c722a61240 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/llamafile.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/loading.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/loading.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e285c4364927c0ec3f1505da79554cbfd98bbefb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/loading.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/manifest.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/manifest.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..db59e59fb28f5bb67b14807299aad431bdc1c892 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/manifest.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/minimax.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/minimax.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7729b07c633894e546205e8916cbbd0b8802dbb5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/minimax.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/mlflow.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/mlflow.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..391425b2a74130a025e97fbddc970544dfb84334 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/mlflow.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/mlflow_ai_gateway.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/mlflow_ai_gateway.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e761e4463706dbcefaa774f0d9eebe1c2bd5b21 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/mlflow_ai_gateway.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/mlx_pipeline.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/mlx_pipeline.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1c22dbf26b98d54d05bbed6cebbd8e5cc2a661d4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/mlx_pipeline.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/modal.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/modal.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..640e31445641507d9604784bf473e13175c0773b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/modal.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/moonshot.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/moonshot.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7c5e964af2c2a9ffa4a3f7c59f8a578002cbdc79 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/moonshot.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/mosaicml.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/mosaicml.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dcf89881d78598d0bf65f4086d408bf0d1169e23 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/mosaicml.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/nlpcloud.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/nlpcloud.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3ca047262fc1cc4bb0178d3d11bdce693f62ad55 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/nlpcloud.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/oci_data_science_model_deployment_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/oci_data_science_model_deployment_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8237041532266b0eb75059b8d23ca19d8b4845eb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/oci_data_science_model_deployment_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/oci_generative_ai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/oci_generative_ai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6dd7c533b90a1ef3c5528edb792523a3b6de5b38 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/oci_generative_ai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/octoai_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/octoai_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..07f222f89b2f6924e7fb81594c5e5f3076c96b0c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/octoai_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ollama.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ollama.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e7222a70014c2fe6e69d18a25970b07e795fabcf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/ollama.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/opaqueprompts.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/opaqueprompts.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7c546462a6feae20defde98f4c143612cbd16b29 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/opaqueprompts.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/openai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/openai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3eb36de44938c7617e788bdb7609162b5360b869 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/openai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/openllm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/openllm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..be2ba54b96b8b0fdd3b5b79f70609c6d01c5dc72 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/openllm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/openlm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/openlm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3e3649aaf2078771bb0106b3f535c721c181661f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/openlm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/outlines.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/outlines.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..24169f32e8bf2002caa521f03b065b730fc0b2b7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/outlines.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/pai_eas_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/pai_eas_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..efa0e6e5871758f2bc314bacee471e4da5d86d40 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/pai_eas_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/petals.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/petals.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7c9e8850b75a581cc29d7d8773e53846728bf1a9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/petals.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/pipelineai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/pipelineai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ebcafab2bcf8075723c857d648308c6a9c203a4f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/pipelineai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/predibase.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/predibase.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e362790f84b7c7b54822f343b8605b89264793b6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/predibase.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/predictionguard.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/predictionguard.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4b05fbf0d4d26e70f6f91b8a9c9cf3b76dc7e378 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/predictionguard.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/promptlayer_openai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/promptlayer_openai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..65d0f0ac4e6c4d29b837c2fa4fc48e0dac77f32b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/promptlayer_openai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/replicate.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/replicate.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e6e98a885384994c2225c68e23849dd80dade9a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/replicate.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/rwkv.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/rwkv.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b39e9b9e1781c6522a55db6f58ac9efe18a0a023 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/rwkv.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/sagemaker_endpoint.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/sagemaker_endpoint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f49e607b35b3be7b29f8d3d15f204fb6365a10a3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/sagemaker_endpoint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/sambanova.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/sambanova.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..44af58824657c56a51fb02a2b970ba61b5b44008 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/sambanova.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/self_hosted.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/self_hosted.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..621d893fb0b5fc6f92f63483db194b34bf8fa667 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/self_hosted.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/self_hosted_hugging_face.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/self_hosted_hugging_face.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c1c1dc633e1c21f31a79c294795266bb418c2d85 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/self_hosted_hugging_face.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/solar.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/solar.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a385473ebd8d3a1e7b75895419e642ba3e9ad683 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/solar.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/sparkllm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/sparkllm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ab0ef9c26a6742fb9ea7cb4f3b8a2a1f9bb51f91 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/sparkllm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/stochasticai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/stochasticai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a80f46346fc79f0dfe2b9117f916e2b37eee9e95 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/stochasticai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/symblai_nebula.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/symblai_nebula.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7104cb4d3bb559fd6a5d28e18d8ac009ca5b77a4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/symblai_nebula.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/textgen.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/textgen.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..54c241364c88614dd5497061be2d02e1278d9db8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/textgen.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/titan_takeoff.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/titan_takeoff.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0be228c25b8e701a88d1f89af99583d4edaa28b5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/titan_takeoff.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/together.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/together.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0a50010b5b31a6823de685d0771e09a94c69827a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/together.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/tongyi.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/tongyi.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c63c8a961cb11fb2a363ed552be8a0f21c87e415 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/tongyi.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1e58fd9921b86077d72446e0946dd5c7185fd978 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/vertexai.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/vertexai.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a253a4ebd8d98eb37d11d3e04c7abaa4632f9381 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/vertexai.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/vllm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/vllm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f5ca5a5ae0c361d4f12ec82ef16e952923be8a1f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/vllm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/volcengine_maas.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/volcengine_maas.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79116c4885246151c1678806076a4b841225881d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/volcengine_maas.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/watsonxllm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/watsonxllm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..10d98e999f46ba7353ab85bff5460458e6a00d67 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/watsonxllm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/weight_only_quantization.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/weight_only_quantization.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..62702bc8cc1ba9f23565f8625bc84163a13212bb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/weight_only_quantization.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/writer.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/writer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ab681471cf8f01dd9760ff8b36fed77815ed4c9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/writer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/xinference.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/xinference.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b14a0f4d71ec4f04c7a2904ba475a83137ed432c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/xinference.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/yandex.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/yandex.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a52050eb9ee4cec11e62b33887b8a8555f4962e9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/yandex.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/yi.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/yi.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0c4a7ad1b315539216f8db01b59b806e8a3dfc20 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/yi.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/you.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/you.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cfd85a6b3969f43e18f1c0722ee364deeb1d1252 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/you.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/yuan2.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/yuan2.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7180f0abbdf4fc6c17a9286e61850e47b5e2f6ea Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/llms/__pycache__/yuan2.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/grammars/json.gbnf b/python/user_packages/Python313/site-packages/langchain_community/llms/grammars/json.gbnf new file mode 100644 index 0000000000000000000000000000000000000000..61bd2b2e65bf9c2632dc7713a8bed5420bebef28 --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/llms/grammars/json.gbnf @@ -0,0 +1,29 @@ +# Grammar for subset of JSON - doesn't support full string or number syntax + +root ::= object +value ::= object | array | string | number | boolean | "null" + +object ::= + "{" ws ( + string ":" ws value + ("," ws string ":" ws value)* + )? "}" + +array ::= + "[" ws ( + value + ("," ws value)* + )? "]" + +string ::= + "\"" ( + [^"\\] | + "\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes + )* "\"" ws + +# Only plain integers currently +number ::= "-"? [0-9]+ ws +boolean ::= ("true" | "false") ws + +# Optional space: by convention, applied in this grammar after literal chars when allowed +ws ::= ([ \t\n] ws)? \ No newline at end of file diff --git a/python/user_packages/Python313/site-packages/langchain_community/llms/grammars/list.gbnf b/python/user_packages/Python313/site-packages/langchain_community/llms/grammars/list.gbnf new file mode 100644 index 0000000000000000000000000000000000000000..30ea6e0c8499de5837b52dc55e9be9cbba158f5e --- /dev/null +++ b/python/user_packages/Python313/site-packages/langchain_community/llms/grammars/list.gbnf @@ -0,0 +1,14 @@ +root ::= "[" items "]" EOF + +items ::= item ("," ws* item)* + +item ::= string + +string ::= + "\"" word (ws+ word)* "\"" ws* + +word ::= [a-zA-Z]+ + +ws ::= " " + +EOF ::= "\n" \ No newline at end of file diff --git a/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..94a955565faa563d02842f2fe3b11adf701903b2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/kg.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/kg.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..21491c721edd920d6e7d6a7163a87b0f9dc5659c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/kg.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/motorhead_memory.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/motorhead_memory.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5e87b53d4d2ef807e2d3acaf8a1a8e380f35f965 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/motorhead_memory.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/zep_cloud_memory.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/zep_cloud_memory.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bb2737de38bed307bce9416f4cf951ba01da23d3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/zep_cloud_memory.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/zep_memory.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/zep_memory.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..59f2c56ca7a9354d1ec2b067a340d892c214a300 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/memory/__pycache__/zep_memory.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/output_parsers/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/output_parsers/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2694de49ce23329edc03ae188aa437a31bad6cec Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/output_parsers/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/output_parsers/__pycache__/ernie_functions.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/output_parsers/__pycache__/ernie_functions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f0d0e36c7a25f2f1ec4b8233553d02e3bee9c0bd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/output_parsers/__pycache__/ernie_functions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/output_parsers/__pycache__/rail_parser.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/output_parsers/__pycache__/rail_parser.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e9dc53184a02be3511bddfb4a0e733eda41df9e4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/output_parsers/__pycache__/rail_parser.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6110e0497755cfe26adf7003f175927af3349605 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/astradb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/astradb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c231659a983e983d13da01715e41a69a5968e21b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/astradb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/chroma.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/chroma.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..36dac923d68f7cae68f7371522c47f90a60c89ed Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/chroma.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/dashvector.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/dashvector.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f370097510b155a35cd60cdfad5c7751fa39ed47 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/dashvector.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/databricks_vector_search.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/databricks_vector_search.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dd1ecdf15619788ad27433458ebaa83cf15c7ccb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/databricks_vector_search.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/deeplake.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/deeplake.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e9fcade61e3f99abdf196622ecd4bb464ffb99b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/deeplake.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/dingo.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/dingo.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ea8a46564059850a7aca9da67001d060b7235ee9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/dingo.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/elasticsearch.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/elasticsearch.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..38e91a9855fc9ef75706467dd4a1d6ea4ce3cc1d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/elasticsearch.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/hanavector.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/hanavector.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0ea8de1bbcb3915755f5d1a2678f5f756834653b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/hanavector.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/milvus.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/milvus.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a20694f2a97cbad5acdac97ac04c2af71f4cf1df Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/milvus.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/mongodb_atlas.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/mongodb_atlas.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..da1e6f02a634d7b5795a28430bbe9189238a196d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/mongodb_atlas.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/myscale.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/myscale.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cdb3e1d634051a4ad523f8353165c4ca6aeab9c5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/myscale.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/neo4j.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/neo4j.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..75800e9c3a43309acfa075afb5dfcb0ad417aba0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/neo4j.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/opensearch.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/opensearch.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4208cb7257ce0bb57cc5f76362f17403d742f75c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/opensearch.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/pgvector.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/pgvector.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..020e54169a85ff19cb1dbc45584e1dbc6fc28d29 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/pgvector.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/pinecone.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/pinecone.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..16ff23e877283d1b9bc4aedd61d91cb528631d6a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/pinecone.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/qdrant.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/qdrant.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68d4bbb8a780ddd01bd7a63cf3b411a67802bb0f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/qdrant.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/redis.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/redis.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c1ccb0fdec4ded271b794c2c8e263e021c59c64 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/redis.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/supabase.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/supabase.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1e14a6f23a786cd6ca28ac8b41fa38cf14d24177 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/supabase.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/tencentvectordb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/tencentvectordb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5a787545d75243db7168a6dc63d781d93797bdf8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/tencentvectordb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/timescalevector.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/timescalevector.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a03504321df33b06377718e99260873ccd603ba9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/timescalevector.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/vectara.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/vectara.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..78271068168338aa0e60b21c944a2e23dd1580ef Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/vectara.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/weaviate.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/weaviate.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dff3fa8da0e14e19bb5fa1520e00d9195240a20c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/query_constructors/__pycache__/weaviate.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8ce2c15588823d9197e9de63b8221a512caca86 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/arcee.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/arcee.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..483e6fd35180de545a774c2afb7696921ed226fe Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/arcee.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/arxiv.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/arxiv.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eed5c0681ffded586afd59e6c01e225fd24fc7ff Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/arxiv.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/asknews.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/asknews.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..014dafe8715045007b0a4250fb6d506a960c72df Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/asknews.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/azure_ai_search.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/azure_ai_search.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e93999b1b2e45d0e6b9b8dd0fe9d99332d0aff0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/azure_ai_search.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/bedrock.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/bedrock.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4387bf41ada43ccd036e7310562339d9330f76fa Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/bedrock.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/bm25.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/bm25.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cd7c6c254975513f199a0d7471e317782b09f59f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/bm25.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/breebs.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/breebs.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..12876e8645790546d337d5c1df9d0e1c3826f4b3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/breebs.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/chaindesk.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/chaindesk.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b76f6b1a714e7e17d2bb99b37ca67e499c628276 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/chaindesk.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/chatgpt_plugin_retriever.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/chatgpt_plugin_retriever.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8177874f32884854319f086849f6a70e56383280 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/chatgpt_plugin_retriever.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/cohere_rag_retriever.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/cohere_rag_retriever.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b46257f84c85b4b33cca3d902c9190985daa33b2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/cohere_rag_retriever.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/databerry.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/databerry.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..64a90bcc05cf1d1d86c5d957fde603f35881c566 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/databerry.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/docarray.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/docarray.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..40e15c075656d92342e343c0b956e036af83aea1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/docarray.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/dria_index.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/dria_index.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9bfd6261b14f0fbba793adeb17421338593a6b42 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/dria_index.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/elastic_search_bm25.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/elastic_search_bm25.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2bb88795c315f94eee2bf3eb78a94a971f1983f4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/elastic_search_bm25.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/embedchain.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/embedchain.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..132dded8186a994f8fd7be3c5ff10836c24ee6c3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/embedchain.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/google_cloud_documentai_warehouse.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/google_cloud_documentai_warehouse.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..caff4e052a2ee479e2924608d73128acf7af034b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/google_cloud_documentai_warehouse.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/google_vertex_ai_search.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/google_vertex_ai_search.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..597dd15c83f400bf01ebfa8d3ad28ed9c182b312 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/google_vertex_ai_search.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/kay.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/kay.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..165e474a74a5f4bf896c41053d9944199805ecba Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/kay.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/kendra.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/kendra.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e7e0245a0fd67ee2616d12c450e801d71e8b2671 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/kendra.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/knn.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/knn.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bc8d96e47ce2984e61c2bbf533b2e01deaf35ea0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/knn.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/llama_index.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/llama_index.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68cdf63fe42a9a090b0bbd08ce04f7c45e31a950 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/llama_index.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/metal.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/metal.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..30ef223eff1ffe5e30db91f5d5756e32b59aa373 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/metal.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/milvus.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/milvus.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..11f4bd7ece8e454009b3ced3a1f5b37285a83180 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/milvus.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/nanopq.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/nanopq.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4d459c401242d486f92af27d30edff8ab4ed5a17 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/nanopq.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/needle.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/needle.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dd9edda4cbcb65ae2eaab0b9c3bb4021cb41d088 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/needle.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/outline.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/outline.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c393eee2ef0d80fdbf7ab1e13639902092bc1a06 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/outline.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/pinecone_hybrid_search.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/pinecone_hybrid_search.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a01cf9ea937cd95884055b19e09e4fc640b6d4f1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/pinecone_hybrid_search.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/pubmed.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/pubmed.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5777b9c0b413a351307c6cab185d97e426ba5a00 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/pubmed.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/pupmed.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/pupmed.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..835986dd77a5d79579972b626ba522737a6f4ae1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/pupmed.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/qdrant_sparse_vector_retriever.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/qdrant_sparse_vector_retriever.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..02ea76656a9e966bab428f44a8f902fa163cacf7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/qdrant_sparse_vector_retriever.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/rememberizer.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/rememberizer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..582f7c6335c8eb351eec0382630840589a608c61 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/rememberizer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/remote_retriever.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/remote_retriever.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68359cb0291af45c4e3e214f4815a637e7349a85 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/remote_retriever.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/svm.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/svm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..61a3723bfe9619eb1c9967a7e2cf18a9ecbd7377 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/svm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/tavily_search_api.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/tavily_search_api.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e2d2af9fffb99cc17fb8959d35b4036fd269710e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/tavily_search_api.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/tfidf.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/tfidf.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d5c22346e530facf5c6f39e70a0b6bfd2e72142b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/tfidf.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/thirdai_neuraldb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/thirdai_neuraldb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e51324007f6e560b34b736c3586ca941b5d47311 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/thirdai_neuraldb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/vespa_retriever.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/vespa_retriever.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c8b7078af2f6bb2c98b6efad97cd527c8409c95d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/vespa_retriever.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/weaviate_hybrid_search.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/weaviate_hybrid_search.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2ce00c3333559c5cd2c1035a39ac35a9b4fcf322 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/weaviate_hybrid_search.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/web_research.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/web_research.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cf1032e5ab2d8d72d5fac98cebe0a4f26e2753b3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/web_research.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/wikipedia.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/wikipedia.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..08ded176075ba85a6372cdb77e95f98d6aee8fae Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/wikipedia.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/you.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/you.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81f52c44bb4ed0e779a6ccdd1e502aea8b347f28 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/you.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/zep.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/zep.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e4fd9be59213c82cd1852e05819f671fb5b2398c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/zep.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/zep_cloud.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/zep_cloud.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d66641e610a398e88469a7feb18d766f40b5bed4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/zep_cloud.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/zilliz.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/zilliz.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b4e58c04282e04dbd151deae4a1550de6928ce7f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/retrievers/__pycache__/zilliz.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3f860bd1c207a4a84934417837a46d79174af8b9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/astradb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/astradb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ad442a050cf14a3bf8cddf72cb8709964ed8d905 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/astradb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/cassandra.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/cassandra.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7b5af2ad387df62a75b850fc2ee1787630b2ca16 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/cassandra.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/exceptions.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/exceptions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..518ce0ec9a2f28f83606f9601fd9e60493a9d592 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/exceptions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/mongodb.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/mongodb.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3f0f5b5c5f748a08d19977f566a72eaabfa25f5b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/mongodb.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/redis.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/redis.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9d697801f6ee2ad04f12a643a10041cfa6a6889b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/redis.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/sql.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/sql.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9e61436e97c8da538369542aff7e8907f4231d92 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/sql.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/upstash_redis.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/upstash_redis.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb5651bbccca7613259891a48fd2765fecd81225 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/storage/__pycache__/upstash_redis.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d7ac847f8827ab938d8e6300a3e880f1f888c47 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/app.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/app.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60070779cf54b2df5da50918ff398ab530a97b46 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/app.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ea9f1aec819895d83a9dcbe98ac16a5e5d1895b4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/owner.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/owner.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a5a1ed5b5a655689ec6762de491a9b0808f51cb8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/owner.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/rule.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/rule.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1320384e17342e0c715147e6e64ec2c74268c41b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/rule.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/transfer.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/transfer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..67f78413e451bb17fcf6b89896e00a4ea88fc358 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/transfer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6b0f5709b5201b76aa7023af6f9d1301cd9413e8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/value.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/value.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b2141cdf65bdbb21c09e0a8dac85c1834ab51f8d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/ainetwork/__pycache__/value.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5e0cbe5b0575a9d05f0714ce8da2494a50c57c92 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bca7393c929aac0685cf827b88cdace91038f20a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/closest_airport.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/closest_airport.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7674d6555036920343ba42d15fa96bd5046b62af Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/closest_airport.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/flight_search.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/flight_search.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf01508fea8e0d761cbd7f3bfbe2581aed8d658e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/flight_search.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b05e9aef9240bf04cc71fa0ef249ad9a913539b0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/amadeus/__pycache__/utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/arxiv/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/arxiv/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f2c6657547f3e29c5dd3d5550643b50d9582a27e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/arxiv/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/arxiv/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/arxiv/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..69fa8331ec445b5f11a3e956dae46181dac19971 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/arxiv/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/asknews/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/asknews/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..75a8783fd010ebfae2127390e501a2659817b652 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/asknews/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/asknews/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/asknews/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d9ce8370bdf0c48cebb0ad4593f1018223342bf Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/asknews/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/audio/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/audio/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..13e564229f14375c705d9f20695ea89e38419b97 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/audio/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/audio/__pycache__/huggingface_text_to_speech_inference.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/audio/__pycache__/huggingface_text_to_speech_inference.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7b8a8555900ca719f9cc7c3fc70acdea85bba01 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/audio/__pycache__/huggingface_text_to_speech_inference.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f10f8a0158b78e6d1e51f7a7c8bdf68fc8943197 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/document_intelligence.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/document_intelligence.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7ca9ef396ac3d5404cd78634dc23eedc2c75e9e9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/document_intelligence.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/image_analysis.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/image_analysis.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6bb93589d217c609fbf79854f03dd71ea22600d2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/image_analysis.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/speech_to_text.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/speech_to_text.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c90c4dc133fff5c6ec7d78950609e54d8899d216 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/speech_to_text.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/text_analytics_for_health.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/text_analytics_for_health.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fa47cbb344d90049180bb6187a83130f913d3cd6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/text_analytics_for_health.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/text_to_speech.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/text_to_speech.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..30d9485d1ab60a2acdfbfb0071f43c0fa260ea01 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/text_to_speech.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..de1c116cc2d52d50873f9fb7e6c3a6cf8ea94b8c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_ai_services/__pycache__/utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8cfd1d651d72558670797ca1e59dc502f570c39d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/form_recognizer.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/form_recognizer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..18db77cd67e1e807d3510de7fa99c5dbcdc07b8b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/form_recognizer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/image_analysis.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/image_analysis.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..83e205400e75b7d4a24cb45053a250306194baf8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/image_analysis.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/speech2text.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/speech2text.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8f5f4fb0a8e84eb078bd8e819a0ba4816d20f43c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/speech2text.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/text2speech.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/text2speech.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dd9714ff04b2dbb32a6f2d3dbb14582c7f62986f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/text2speech.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/text_analytics_health.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/text_analytics_health.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2ea487313275b8e0853a71b7c5d288044a331b7b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/text_analytics_health.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ebbaa7e23555dcb8ade309786d2148b858169e3e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/azure_cognitive_services/__pycache__/utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/bearly/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/bearly/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b3b9a6be8a223df53232e5fe0e344099d68fe2b6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/bearly/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/bearly/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/bearly/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a5f2ff390d485bf649e4f880759d463fe4bbb95d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/bearly/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/bing_search/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/bing_search/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a429aa8d4d3efd6cbf248bdc8e3263ab3039652e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/bing_search/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/bing_search/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/bing_search/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..811cf9975a06da7a9d01777fa388b5cd116a3c89 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/bing_search/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/brave_search/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/brave_search/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c425b2e504f74b5bfabbb96871de1b45746314e6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/brave_search/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/brave_search/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/brave_search/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f473ad677d786e96e3cdc744c106dff36735da46 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/brave_search/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/cassandra_database/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/cassandra_database/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..343690b9503a07ffed479d2c8544816dc55cbf98 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/cassandra_database/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/cassandra_database/__pycache__/prompt.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/cassandra_database/__pycache__/prompt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3d1feefd4e918fed9f197a9d93210e2eeb2b8e96 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/cassandra_database/__pycache__/prompt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/cassandra_database/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/cassandra_database/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..066644781bc5487c930c5f7971a3e3c08d309166 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/cassandra_database/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/clickup/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/clickup/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41579d93628358d0a9fc8994229f3459b82e95b8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/clickup/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/clickup/__pycache__/prompt.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/clickup/__pycache__/prompt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e44b7c104d66464b64d06659718bdb7a58867c1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/clickup/__pycache__/prompt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/clickup/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/clickup/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9f202450f129ca0e85c05663112dc73c6342bde7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/clickup/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/cogniswitch/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/cogniswitch/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..052c92dd13dc92440a42cd8ba1ff245ec3337c5a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/cogniswitch/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/cogniswitch/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/cogniswitch/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c325b7729c2e6195064a1ecf3ee0d1479db8b41e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/cogniswitch/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/connery/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/connery/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9fba50ef63e879a20fc0473652fd2d25c4060803 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/connery/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/connery/__pycache__/models.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/connery/__pycache__/models.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ab339bc2cad3d2b1af3dbafd457bde22e3e33b3b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/connery/__pycache__/models.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/connery/__pycache__/service.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/connery/__pycache__/service.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..64a551d804502a4c8bab8c21bc9e8019ef1a56e6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/connery/__pycache__/service.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/connery/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/connery/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09cac878b4b8accbe77a659ea387d6b6a31949e4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/connery/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/databricks/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/databricks/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..11722ad364770c3bd09828ab0e1f69cd7b4ba1e5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/databricks/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/databricks/__pycache__/_execution.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/databricks/__pycache__/_execution.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9d038ae6e280e3ba6d1adb682e0d84583a30d108 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/databricks/__pycache__/_execution.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/databricks/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/databricks/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e5028ef047e288bd35c23674d7192e136a3f617d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/databricks/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/dataforseo_api_search/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/dataforseo_api_search/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5b499bc0514c6fc09d827a5d9b7164ea88374552 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/dataforseo_api_search/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/dataforseo_api_search/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/dataforseo_api_search/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a49c79ecb0eb13b0669b25543b7623715dc7820b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/dataforseo_api_search/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/dataherald/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/dataherald/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dceee1b88a982787bbcef038b0ec0da9f95e7041 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/dataherald/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/dataherald/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/dataherald/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..415e960f56b3b1b289629a695bbb8b7a298ebdc4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/dataherald/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/ddg_search/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/ddg_search/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f03e041e3a15cca8e64057031b17bf61f5aa60ff Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/ddg_search/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/ddg_search/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/ddg_search/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3b975418df8255eebd665a5b63fa14d279b356b9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/ddg_search/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/e2b_data_analysis/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/e2b_data_analysis/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f52cf747e388c6639164b4693a0b8cdc80d6fdc Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/e2b_data_analysis/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/e2b_data_analysis/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/e2b_data_analysis/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79eb90022aed0cbc90bebf5969e63909209aec03 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/e2b_data_analysis/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/e2b_data_analysis/__pycache__/unparse.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/e2b_data_analysis/__pycache__/unparse.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b6e4fbae6b911e4a99ded760db2b1253de3c2256 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/e2b_data_analysis/__pycache__/unparse.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d212089078394a919f2663e193d132278efc14b8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/audio_speech_to_text.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/audio_speech_to_text.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b4cda18fd44589132cb7ba0da3a317e2f66aa2d1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/audio_speech_to_text.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/audio_text_to_speech.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/audio_text_to_speech.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..25587e41cc0e43cb4a0f10a4077b5b4ca27f2479 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/audio_text_to_speech.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/edenai_base_tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/edenai_base_tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..36b89a5190244b45922479f5eeeff1e19eae07e7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/edenai_base_tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/image_explicitcontent.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/image_explicitcontent.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..720ee32cfd05684c2e0d2c5a2aceeffb512c4f5a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/image_explicitcontent.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/image_objectdetection.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/image_objectdetection.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ef7a30910ed50c5be6a8e3bd2e68fb1d53f0ed4f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/image_objectdetection.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/ocr_identityparser.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/ocr_identityparser.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c3aed864060274775b4d61a0c0a2e7c70560b7ad Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/ocr_identityparser.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/ocr_invoiceparser.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/ocr_invoiceparser.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2f5343f29853d1fad36522561862776a136bc713 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/ocr_invoiceparser.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/text_moderation.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/text_moderation.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af8064170bcb336dfce4347b75cc61998df00cb8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/edenai/__pycache__/text_moderation.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/eleven_labs/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/eleven_labs/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a21e4be19fc166ae69bcf9ff4999989c4555ea77 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/eleven_labs/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/eleven_labs/__pycache__/models.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/eleven_labs/__pycache__/models.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f3457d41f5dc1bd8676a3d59dd0ec2621a680d7b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/eleven_labs/__pycache__/models.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/eleven_labs/__pycache__/text2speech.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/eleven_labs/__pycache__/text2speech.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e9726452beaedefe1f24a4903601ad75b1735047 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/eleven_labs/__pycache__/text2speech.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/few_shot/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/few_shot/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80351bcc7306a4429f450031b7c847192ac31e06 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/few_shot/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/few_shot/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/few_shot/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..857ce0b785c9f06122b157a41736cb1042763018 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/few_shot/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5e9ba4910f406209dfc1423f95ab1898928401f7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/copy.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/copy.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8059e606f9d924003fd4b5914826a73de333f67f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/copy.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/delete.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/delete.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c02b4c4084b7b7fc83482eaf74aaf33540c4905b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/delete.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/file_search.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/file_search.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93d5442132ba046513a12ac7338839bff75f7beb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/file_search.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/list_dir.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/list_dir.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8c1f8cdbddbc0c1780b3fffa3ffc37adf49c798a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/list_dir.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/move.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/move.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c39316c877bcfd3d95eea04220ef8c2bcfd8c4e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/move.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/read.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/read.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..77b6794cb7e2353702fe45fbcc562b57fb3a8515 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/read.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c5e32d66e051d57b732726136afd8e850b8b7e5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/write.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/write.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a69337a9a73a88270219429329bffc5d8f98a40a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/file_management/__pycache__/write.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/financial_datasets/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/financial_datasets/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..febba8cafdc9256995a9b0dd83c659cacf26c6d3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/financial_datasets/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/financial_datasets/__pycache__/balance_sheets.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/financial_datasets/__pycache__/balance_sheets.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..725f11f4b8b1f941ed381712f5756b1391cd9c34 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/financial_datasets/__pycache__/balance_sheets.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/financial_datasets/__pycache__/cash_flow_statements.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/financial_datasets/__pycache__/cash_flow_statements.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f17642ebe08c99db1bc0853304c7eb42124f4eea Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/financial_datasets/__pycache__/cash_flow_statements.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/financial_datasets/__pycache__/income_statements.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/financial_datasets/__pycache__/income_statements.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c39964a3f79afae5c571730b1d1e44de41f0a22d Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/financial_datasets/__pycache__/income_statements.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/github/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/github/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ace54dad61388b5f3e44dc7f8156bca6bbadb19e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/github/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/github/__pycache__/prompt.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/github/__pycache__/prompt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ab6a967cf09909c669218b928d9cd3cd68e5d192 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/github/__pycache__/prompt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/github/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/github/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..deafff38ee80d9b3d77bdd5d9a2f537ab5f36e2e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/github/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/gitlab/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/gitlab/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79fc2ff30c998f23d5759eeaf486513199b58adc Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/gitlab/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/gitlab/__pycache__/prompt.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/gitlab/__pycache__/prompt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3869a17240adc0b6e76c202c8b526bb35d7d40fa Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/gitlab/__pycache__/prompt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/gitlab/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/gitlab/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ac1407f026493d7d72f8c88e135bcabe967d52f6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/gitlab/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f929277868cbdbb002c4db0d135f3ff9c9ebfe8e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..277d17ecbfd44b29aa8686ff34fffc748bb5c95b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/create_draft.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/create_draft.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..24e5c34af3850dd70d18a69fae7a72b46dc3cb25 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/create_draft.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/get_message.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/get_message.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b97e7bee2e84f3f3de7a2043876d973e2c4a23d3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/get_message.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/get_thread.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/get_thread.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c2dae58c29fad2841877a1db5abfa65828b83e98 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/get_thread.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/search.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/search.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bac2dd0b0c4816ecb666b51df15b500810ab0081 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/search.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/send_message.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/send_message.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f405934d0066c704feb3d905aecc280a48a567b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/send_message.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..48f37e0e8c90610b4e039623abf1b85306d0a81c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/gmail/__pycache__/utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/golden_query/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/golden_query/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..901f3c7a47a2d1a5023eb8647e45005828bb3416 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/golden_query/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/golden_query/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/golden_query/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bd308ccc0c730911a67a3dad0d9f393319a26ff4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/golden_query/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_cloud/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_cloud/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..df34e6ce1bb22a7b61ad8c1aad5631d2bfd177fd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_cloud/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_cloud/__pycache__/texttospeech.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_cloud/__pycache__/texttospeech.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f70d61bd6d2ea691ebe29dcf02042ffa2617194c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_cloud/__pycache__/texttospeech.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_finance/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_finance/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..20654e48a91f582d0bf39776fa3de903cbd2c1a3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_finance/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_finance/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_finance/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..03d15bb2521832e158530e2dcdc5c8dff4e51bb2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_finance/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_jobs/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_jobs/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..21a07fd0a36a22a89105a7a9468b27f0eb48868b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_jobs/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_jobs/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_jobs/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..88dc2ccff0e031a4669e1037e12e53b626d71f06 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_jobs/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_lens/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_lens/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eec194dddffe1350d8c8f9b93fe61193ecaaac6c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_lens/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_lens/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_lens/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bb3f417ea8376577abc374b46f7ec5b45383104a Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_lens/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_places/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_places/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1014739fa298cae9e9a13fe64bb1c12488412660 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_places/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_places/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_places/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7a9415a9811ac6f81cfea601eb6d7f8b544c5fd9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_places/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_scholar/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_scholar/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..82234a8235823b43bc56bb2c677ed83319b9b758 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_scholar/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_scholar/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_scholar/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..55ec7deb7297303f701028a2414541009f5485ed Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_scholar/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_search/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_search/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..645074d6925324db4e358b0b79f41d8953d43fe0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_search/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_search/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_search/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..82eeb2ebb4fc15f2cbc59d23b938a0d1a14ca182 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_search/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_serper/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_serper/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..48f23f8e7cd127cbedf77cf95e8a08dcfeb3996f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_serper/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_serper/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_serper/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fd076bf4e59077179db44ba53346e531949bc677 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_serper/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_trends/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_trends/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..32c57444692758c34d10cd3d64b0d82316cc8d7f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_trends/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/google_trends/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/google_trends/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf14cf983de49641a0e356d365c04ce8ba7c1b63 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/google_trends/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/graphql/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/graphql/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0af3e3b58112aac7931bf13a639433fc869d7f10 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/graphql/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/graphql/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/graphql/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9c27a5c980c4b4c06cc6234c6fbecd7ef114e39e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/graphql/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/human/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/human/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8cb7a7695b1400732099ff22d212859cceaa416 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/human/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/human/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/human/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..45ee70a22c32c84d1014936680ddb573ab332402 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/human/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/interaction/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/interaction/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8c7b133d7fecc51a218c2fb7257999a7e26c01e1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/interaction/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/interaction/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/interaction/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb80353ecd8a997278bb2a71908c06b4bcb582d2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/interaction/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/jina_search/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/jina_search/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c21094596f8fa9c149217b53fcd408b0ffdd6830 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/jina_search/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/jina_search/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/jina_search/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7adfe7559a1247ba4924def76693473b50ad07bd Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/jina_search/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/jira/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/jira/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6762f5c888d1fc4bd0739337d090e451aff90283 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/jira/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/jira/__pycache__/prompt.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/jira/__pycache__/prompt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..72e3e9056fa7a937318d5134e0dc59e90029a706 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/jira/__pycache__/prompt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/jira/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/jira/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e7b84c3b0d4e7a11e9d4b2ffea13946fa57953f4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/jira/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/json/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/json/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a065379f233561cf237769b4b7a4b71be3544492 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/json/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/json/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/json/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2f4f4eb31c825ee4e3b964c2b57d9ad4db730968 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/json/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/memorize/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/memorize/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6bd57b3baa402fe6712d55e9a0e9508fce522dce Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/memorize/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/memorize/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/memorize/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3d6ba7e6927cb8b68e66a224ad054241ab1850eb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/memorize/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/merriam_webster/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/merriam_webster/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4bbd04ab150d2b773c7067b6a223f7241a799ed1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/merriam_webster/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/merriam_webster/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/merriam_webster/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09db62c3c15e858c8954ee4eadcd55670419a002 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/merriam_webster/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/metaphor_search/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/metaphor_search/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..28de36c245b1ee27a72c2a47c97fb47f8994ad56 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/metaphor_search/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/metaphor_search/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/metaphor_search/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c19dbbfdf047ef4dced89833bb9c03a9c8508b6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/metaphor_search/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/mojeek_search/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/mojeek_search/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..98542b3ad94421f3e0e832791704909de9d53c79 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/mojeek_search/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/mojeek_search/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/mojeek_search/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1a0bb70c7cacaf414eea1674966e67cd9b636c82 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/mojeek_search/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/multion/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/multion/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..47e7e2ab2529679cd7dbe4b6512ff47fb7beaa4b Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/multion/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/multion/__pycache__/close_session.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/multion/__pycache__/close_session.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8aa4c48a0b03465de046975ed214cef36c6b82ba Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/multion/__pycache__/close_session.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/multion/__pycache__/create_session.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/multion/__pycache__/create_session.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fb020e5f68733c614d13d48d07bac14614f49eac Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/multion/__pycache__/create_session.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/multion/__pycache__/update_session.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/multion/__pycache__/update_session.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41f9b9e8636dee10a291bf07e1a74edeafdc23ef Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/multion/__pycache__/update_session.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/nasa/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/nasa/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8fd01339836d14d86d8ac991c261a5dc8652cde5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/nasa/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/nasa/__pycache__/prompt.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/nasa/__pycache__/prompt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f20911fb03d34e3a3e8703e3cbb7406994b68c54 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/nasa/__pycache__/prompt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/nasa/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/nasa/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..552664eddfe2109e9a69cf217e29b6b475131ec7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/nasa/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/nuclia/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/nuclia/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a646b6c418b6b3efaa48aa2226ac776853aff347 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/nuclia/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/nuclia/__pycache__/tool.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/nuclia/__pycache__/tool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f410298e70de7e74ca4df4eef059ef86cc486859 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/nuclia/__pycache__/tool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6eba6441f7b959bdaf75d8434eab91b6c3cbd9fb Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/base.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..46c606ec7e71870294933e1f5df9e9f57ba210df Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/create_draft_message.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/create_draft_message.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a5cc3d077eed62a2857496cb499cc476f17a41db Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/create_draft_message.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/events_search.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/events_search.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c176373f50262d3406e7ca620441a414e773900c Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/events_search.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/messages_search.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/messages_search.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..57e0910cce0def91e9df9696c79098ebacda71ba Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/messages_search.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/send_event.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/send_event.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5d7a3ea726698e6b464f9dc3efb5012e0364995f Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/send_event.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/send_message.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/send_message.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80a68976dbee0972927bf3d2a1a132474dc38c7e Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/send_message.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..012dc75a39255c884e6269f1d516a5ecb79b7ab1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/office365/__pycache__/utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/langchain_community/tools/openai_dalle_image_generation/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/langchain_community/tools/openai_dalle_image_generation/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4396e5adfc4080fff29833742289018d08714e90 Binary files /dev/null and b/python/user_packages/Python313/site-packages/langchain_community/tools/openai_dalle_image_generation/__pycache__/__init__.cpython-313.pyc differ