mirror of
https://github.com/langchain-ai/langchain-experimental.git
synced 2026-07-01 13:20:51 -04:00
chore: sunset package (#88)
This commit is contained in:
@@ -4,6 +4,9 @@ This repository contains 1 package with experimental features of LangChain:
|
||||
|
||||
- [langchain-experimental](https://pypi.org/project/langchain-experimental/)
|
||||
|
||||
> [!WARNING]
|
||||
> **`langchain-experimental` is being sunset.** See [#87](https://github.com/langchain-ai/langchain-experimental/issues/87) for details. Thank you to everyone who has contributed ideas, prototypes, fixes, reviews, and maintenance over the years.
|
||||
|
||||
> [!WARNING]
|
||||
> Portions of the code in this package may be dangerous if not properly deployed
|
||||
> in a sandboxed environment. Please be wary of deploying experimental code
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
This package holds experimental LangChain code, intended for research and experimental
|
||||
uses.
|
||||
|
||||
> [!WARNING]
|
||||
> **`langchain-experimental` is being sunset.** See [#87](https://github.com/langchain-ai/langchain-experimental/issues/87) for details. Thank you to everyone who has contributed ideas, prototypes, fixes, reviews, and maintenance over the years.
|
||||
|
||||
> [!WARNING]
|
||||
> Portions of the code in this package may be dangerous if not properly deployed
|
||||
> in a sandboxed environment. Please be wary of deploying experimental code
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import warnings
|
||||
from importlib import metadata
|
||||
|
||||
try:
|
||||
@@ -6,3 +7,12 @@ except metadata.PackageNotFoundError:
|
||||
# Case where package metadata is not available.
|
||||
__version__ = ""
|
||||
del metadata # optional, avoids polluting the results of dir(__package__)
|
||||
|
||||
warnings.warn(
|
||||
"`langchain-experimental` is being sunset and is no longer actively "
|
||||
"maintained. See "
|
||||
"https://github.com/langchain-ai/langchain-experimental/issues/87 for "
|
||||
"details.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
@@ -7,7 +7,28 @@ from langchain_classic.schema import (
|
||||
ChatGeneration,
|
||||
ChatResult,
|
||||
)
|
||||
from langchain_community.chat_models.anthropic import ChatAnthropic
|
||||
|
||||
try:
|
||||
from langchain_community.chat_models.anthropic import ChatAnthropic
|
||||
except ImportError as e:
|
||||
_IMPORT_ERROR = e
|
||||
|
||||
class ChatAnthropic: # type: ignore[no-redef]
|
||||
"""Stub for environments where `langchain-community` no longer ships
|
||||
`langchain_community.chat_models.anthropic` (removed in 0.4.2)."""
|
||||
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
raise ImportError(
|
||||
"`AnthropicFunctions` depends on `langchain_community.chat_"
|
||||
"models.anthropic.ChatAnthropic`, which was removed in "
|
||||
"`langchain-community>=0.4.2`. Anthropic now supports tool "
|
||||
"calling natively; use `langchain_anthropic.ChatAnthropic` "
|
||||
"with `bind_tools` instead. Note: `langchain-experimental` is "
|
||||
"being sunset; see "
|
||||
"https://github.com/langchain-ai/langchain-experimental/issues/87."
|
||||
) from _IMPORT_ERROR
|
||||
|
||||
|
||||
from langchain_core._api.deprecation import deprecated
|
||||
from langchain_core.callbacks.manager import (
|
||||
CallbackManagerForLLMRun,
|
||||
|
||||
@@ -15,7 +15,26 @@ from typing import (
|
||||
cast,
|
||||
)
|
||||
|
||||
from langchain_community.chat_models.ollama import ChatOllama
|
||||
try:
|
||||
from langchain_community.chat_models.ollama import ChatOllama
|
||||
except ImportError as e:
|
||||
_IMPORT_ERROR = e
|
||||
|
||||
class ChatOllama: # type: ignore[no-redef]
|
||||
"""Stub for environments where `langchain-community` no longer ships
|
||||
`langchain_community.chat_models.ollama` (removed in 0.4.2)."""
|
||||
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
raise ImportError(
|
||||
"`OllamaFunctions` depends on `langchain_community.chat_models."
|
||||
"ollama.ChatOllama`, which was removed in "
|
||||
"`langchain-community>=0.4.2`. Use `langchain_ollama.ChatOllama`"
|
||||
" directly instead. Note: `langchain-experimental` is being "
|
||||
"sunset; see "
|
||||
"https://github.com/langchain-ai/langchain-experimental/issues/87."
|
||||
) from _IMPORT_ERROR
|
||||
|
||||
|
||||
from langchain_core._api import deprecated
|
||||
from langchain_core.callbacks import (
|
||||
AsyncCallbackManagerForLLMRun,
|
||||
|
||||
@@ -2,10 +2,29 @@ from typing import Any, Dict, Optional, Type, Union
|
||||
|
||||
from langchain_classic.chains.openai_functions import create_structured_output_chain
|
||||
from langchain_classic.schema import BaseLLMOutputParser, BasePromptTemplate
|
||||
from langchain_community.chat_models import ChatOpenAI
|
||||
from langchain_core.prompts import PromptTemplate
|
||||
from pydantic import BaseModel
|
||||
|
||||
try:
|
||||
from langchain_community.chat_models import ChatOpenAI
|
||||
except ImportError as e:
|
||||
_IMPORT_ERROR = e
|
||||
|
||||
class ChatOpenAI: # type: ignore[no-redef]
|
||||
"""Stub for environments where `langchain-community` no longer exports
|
||||
`ChatOpenAI` (removed in 0.4.2)."""
|
||||
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
raise ImportError(
|
||||
"`langchain_experimental.tabular_synthetic_data.openai` depends "
|
||||
"on `langchain_community.chat_models.ChatOpenAI`, which was "
|
||||
"removed in `langchain-community>=0.4.2`. Use "
|
||||
"`langchain_openai.ChatOpenAI` directly instead. Note: "
|
||||
"`langchain-experimental` is being sunset; see "
|
||||
"https://github.com/langchain-ai/langchain-experimental/issues/87."
|
||||
) from _IMPORT_ERROR
|
||||
|
||||
|
||||
from langchain_experimental.tabular_synthetic_data.base import SyntheticDataGenerator
|
||||
|
||||
OPENAI_TEMPLATE = PromptTemplate(input_variables=["example"], template="{example}")
|
||||
|
||||
@@ -160,7 +160,7 @@ class SemanticChunker(BaseDocumentTransformer):
|
||||
return cast(
|
||||
float,
|
||||
np.percentile(distance_gradient, self.breakpoint_threshold_amount),
|
||||
), distance_gradient
|
||||
), cast(List[float], distance_gradient)
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Got unexpected `breakpoint_threshold_type`: "
|
||||
|
||||
@@ -7,11 +7,11 @@ authors = []
|
||||
license = {text = "MIT"}
|
||||
requires-python = "<4.0,>=3.10"
|
||||
dependencies = [
|
||||
"langchain-core<2.0.0,>=1.0.0",
|
||||
"langchain-community<1.0.0,>=0.4.0",
|
||||
"langchain-core<2.0.0,>=1.4.0",
|
||||
"langchain-community<1.0.0,>=0.4.2",
|
||||
]
|
||||
name = "langchain-experimental"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
description = "Building applications with LLMs through composability"
|
||||
readme = "README.md"
|
||||
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
import pytest
|
||||
from langchain_community.chat_models import ChatOpenAI
|
||||
from langchain_core.prompts.few_shot import FewShotPromptTemplate
|
||||
from pydantic import BaseModel
|
||||
|
||||
try:
|
||||
from langchain_community.chat_models import ChatOpenAI
|
||||
except ImportError:
|
||||
pytest.skip(
|
||||
"`langchain_community.chat_models.ChatOpenAI` was removed in "
|
||||
"`langchain-community>=0.4.2`; use `langchain_openai.ChatOpenAI` "
|
||||
"instead.",
|
||||
allow_module_level=True,
|
||||
)
|
||||
|
||||
from langchain_core.prompts.few_shot import FewShotPromptTemplate # noqa: E402
|
||||
from pydantic import BaseModel # noqa: E402
|
||||
|
||||
from langchain_experimental.tabular_synthetic_data.base import SyntheticDataGenerator
|
||||
from langchain_experimental.tabular_synthetic_data.openai import (
|
||||
|
||||
@@ -2,10 +2,23 @@
|
||||
|
||||
import unittest
|
||||
|
||||
from langchain_community.chat_models.anthropic import ChatAnthropic
|
||||
from langchain_community.chat_models.bedrock import BedrockChat
|
||||
import pytest
|
||||
|
||||
from langchain_experimental.llms.anthropic_functions import AnthropicFunctions
|
||||
try:
|
||||
from langchain_community.chat_models.anthropic import ChatAnthropic
|
||||
from langchain_community.chat_models.bedrock import BedrockChat
|
||||
except ImportError:
|
||||
pytest.skip(
|
||||
"`langchain_community.chat_models.anthropic` and "
|
||||
"`langchain_community.chat_models.bedrock` were removed in "
|
||||
"`langchain-community>=0.4.2`; use `langchain_anthropic.ChatAnthropic` "
|
||||
"and `langchain_aws.ChatBedrock` instead.",
|
||||
allow_module_level=True,
|
||||
)
|
||||
|
||||
from langchain_experimental.llms.anthropic_functions import ( # noqa: E402
|
||||
AnthropicFunctions,
|
||||
)
|
||||
|
||||
|
||||
class TestAnthropicFunctions(unittest.TestCase):
|
||||
|
||||
@@ -2,10 +2,20 @@ import json
|
||||
from typing import Any
|
||||
from unittest.mock import patch
|
||||
|
||||
from langchain_core.prompts import ChatPromptTemplate
|
||||
from pydantic import BaseModel
|
||||
import pytest
|
||||
|
||||
from langchain_experimental.llms.ollama_functions import OllamaFunctions
|
||||
pytest.importorskip(
|
||||
"langchain_community.chat_models.ollama",
|
||||
reason=(
|
||||
"`langchain_community.chat_models.ollama` was removed in "
|
||||
"`langchain-community>=0.4.2`; `OllamaFunctions` is unusable without it."
|
||||
),
|
||||
)
|
||||
|
||||
from langchain_core.prompts import ChatPromptTemplate # noqa: E402
|
||||
from pydantic import BaseModel # noqa: E402
|
||||
|
||||
from langchain_experimental.llms.ollama_functions import OllamaFunctions # noqa: E402
|
||||
|
||||
|
||||
class Schema(BaseModel):
|
||||
|
||||
Generated
+2412
-1700
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user