langchain-serpex-python 0.1.5__tar.gz → 0.1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. langchain_serpex_python-0.1.6/.gitignore +5 -0
  2. langchain_serpex_python-0.1.6/CHANGELOG.md +8 -0
  3. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/PKG-INFO +25 -42
  4. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/README.md +19 -37
  5. langchain_serpex_python-0.1.6/langchain_serpex_python/__init__.py +9 -0
  6. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/langchain_serpex_python/tools.py +12 -15
  7. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/pyproject.toml +5 -4
  8. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/tests/integration_tests/test_tools.py +5 -7
  9. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/tests/unit_tests/test_tools.py +8 -8
  10. langchain_serpex_python-0.1.5/langchain_serpex_python/__init__.py +0 -10
  11. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/.github/workflows/publish-pypi.yml +0 -0
  12. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/LICENSE +0 -0
  13. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/Makefile +0 -0
  14. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/langchain_serpex_python/py.typed +0 -0
  15. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/tests/__init__.py +0 -0
  16. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/tests/integration_tests/__init__.py +0 -0
  17. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/tests/unit_tests/__init__.py +0 -0
  18. {langchain_serpex_python-0.1.5 → langchain_serpex_python-0.1.6}/uv.lock +0 -0
@@ -0,0 +1,5 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .pytest_cache/
4
+ dist/
5
+ *.egg-info/
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## 0.1.6 — 2026-09-22
4
+
5
+ - docs: positioning — Serpex is a real-time web search API; README, docstrings and the tool description updated. Docstring examples now use the real package/module names (`langchain-serpex-python` / `langchain_serpex_python`).
6
+ - `engine` deprecated (ignored by the API since 2026-06). The `engine` field is still accepted with the same default; request behaviour is unchanged. Class, tool name and exports unchanged.
7
+ - Tests: engine names removed; integration tests import the real module. Removed committed `__pycache__` files.
8
+ - package description, keywords and repository URLs updated.
@@ -1,13 +1,14 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: langchain-serpex-python
3
- Version: 0.1.5
4
- Summary: An integration package connecting SERPEX and LangChain (Python)
3
+ Version: 0.1.6
4
+ Summary: LangChain integration for Serpex, a real-time web search API (Python)
5
5
  Project-URL: Homepage, https://docs.langchain.com/oss/python/integrations/providers/serpex
6
6
  Project-URL: Documentation, https://serpex.dev/docs
7
- Project-URL: Source, https://github.com/divyeshradadiya/langchain-serpex
8
- Project-URL: Repository, https://github.com/divyeshradadiya/langchain-serpex
7
+ Project-URL: Source, https://github.com/divyeshradadiya/langchain-serpex-python
8
+ Project-URL: Repository, https://github.com/divyeshradadiya/langchain-serpex-python
9
9
  License: MIT
10
10
  License-File: LICENSE
11
+ Keywords: ai-agents,langchain,llm,rag,real-time-search,search,search-api,serpex,web-search
11
12
  Requires-Python: <4.0.0,>=3.9.0
12
13
  Requires-Dist: httpx>=0.27.0
13
14
  Requires-Dist: langchain-core<1.0.0,>=0.3.0
@@ -19,7 +20,7 @@ Description-Content-Type: text/markdown
19
20
  [![PyPI - License](https://img.shields.io/pypi/l/langchain-serpex-python)](https://opensource.org/licenses/MIT)
20
21
  [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchainai.svg?style=social&label=Follow%20%40LangChainAI)](https://twitter.com/langchainai)
21
22
 
22
- This package contains the LangChain integration with SERPEX (Python).
23
+ This package contains the LangChain integration with Serpex (Python).
23
24
 
24
25
  ## Installation
25
26
 
@@ -27,17 +28,19 @@ This package contains the LangChain integration with SERPEX (Python).
27
28
  pip install langchain-serpex-python
28
29
  ```
29
30
 
30
- ## What is SERPEX?
31
+ ## What is Serpex?
31
32
 
32
- SERPEX is a powerful multi-engine search API that provides access to search results from Google, Bing, DuckDuckGo, Baidu, Yandex, and other search engines in JSON format. It's designed for developers building AI applications, SEO tools, market research platforms, and data aggregation services.
33
+ Serpex is a real-time web search API. It returns structured JSON results
34
+ (title, URL, snippet) for any query, and offers page content extraction that
35
+ turns URLs into LLM-ready markdown. It's built for AI agents, LLM tools and
36
+ RAG pipelines.
33
37
 
34
38
  ## Features
35
39
 
36
- - **Multi-Engine Support**: Search across Google, Bing, DuckDuckGo, Baidu, and Yandex
37
- - **Rich Results**: Get organic results, answer boxes, knowledge graphs, news, images, videos, and shopping results
38
- - **Localization**: Support for location-based and language-specific searches
39
- - **Real-time Data**: Access to current search results
40
- - **Easy Integration**: Simple API with comprehensive documentation
40
+ - **Real-time web search**: current results for any query
41
+ - **One search engine**: nothing to configure no engine to pick
42
+ - **LangChain-native**: a drop-in `BaseTool` for agents and chains
43
+ - **Easy integration**: API key via argument or `SERPEX_API_KEY`
41
44
 
42
45
  ## Quick Start
43
46
 
@@ -51,10 +54,7 @@ Sign up at [SERPEX](https://serpex.dev) to get your API key.
51
54
  from langchain_serpex_python import SerpexSearchResults
52
55
 
53
56
  # Initialize the tool
54
- tool = SerpexSearchResults(
55
- api_key="your-serpex-api-key",
56
- engine="google"
57
- )
57
+ tool = SerpexSearchResults(api_key="your-serpex-api-key")
58
58
 
59
59
  # Perform a search
60
60
  results = tool.invoke("latest AI developments")
@@ -69,10 +69,7 @@ from langchain_openai import ChatOpenAI
69
69
  from langchain.agents import initialize_agent, AgentType
70
70
 
71
71
  # Initialize the search tool
72
- search_tool = SerpexSearchResults(
73
- api_key="your-serpex-api-key",
74
- engine="google"
75
- )
72
+ search_tool = SerpexSearchResults(api_key="your-serpex-api-key")
76
73
 
77
74
  # Initialize the LLM
78
75
  llm = ChatOpenAI(temperature=0)
@@ -98,32 +95,18 @@ from langchain_serpex_python import SerpexSearchResults
98
95
  # Configure with advanced parameters
99
96
  tool = SerpexSearchResults(
100
97
  api_key="your-serpex-api-key",
101
- engine="google",
102
98
  time_range="month"
103
99
  )
104
100
 
105
- # Search for location-specific results
106
101
  results = tool.invoke("best restaurants")
107
102
  print(results)
108
103
  ```
109
104
 
110
- ### Different Search Engines
105
+ ### The `engine` parameter (deprecated)
111
106
 
112
- ```python
113
- from langchain_serpex_python import SerpexSearchResults
114
-
115
- # Google Search
116
- google_tool = SerpexSearchResults(api_key="your-key", engine="google")
117
- google_results = google_tool.invoke("Python programming")
118
-
119
- # Bing Search
120
- bing_tool = SerpexSearchResults(api_key="your-key", engine="bing")
121
- bing_results = bing_tool.invoke("Python programming")
122
-
123
- # DuckDuckGo Search
124
- ddg_tool = SerpexSearchResults(api_key="your-key", engine="duckduckgo")
125
- ddg_results = ddg_tool.invoke("Python programming")
126
- ```
107
+ Serpex is one search engine, so there is nothing to select. `engine` is
108
+ deprecated and ignored by the Serpex API since 2026-06; it is still accepted
109
+ so existing code keeps working.
127
110
 
128
111
  ## Configuration
129
112
 
@@ -145,10 +128,10 @@ tool = SerpexSearchResults() # Will use SERPEX_API_KEY from environment
145
128
 
146
129
  ### Parameters
147
130
 
148
- - `api_key` (str): Your SERPEX API key (required)
149
- - `engine` (str): Search engine to use - "auto", "google", "bing", "duckduckgo", "brave", "yahoo", "yandex" (default: "auto")
131
+ - `api_key` (str): Your Serpex API key (required)
132
+ - `engine` (str): **Deprecated** ignored by the Serpex API (default: "auto"); still accepted
150
133
  - `category` (str): Search category - currently only "web" is supported (default: "web")
151
- - `time_range` (str): Time filter - "all", "day", "week", "month", "year" (not supported by Brave)
134
+ - `time_range` (str): Time filter - "all", "day", "week", "month", "year"
152
135
 
153
136
  ## Documentation
154
137
 
@@ -4,7 +4,7 @@
4
4
  [![PyPI - License](https://img.shields.io/pypi/l/langchain-serpex-python)](https://opensource.org/licenses/MIT)
5
5
  [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchainai.svg?style=social&label=Follow%20%40LangChainAI)](https://twitter.com/langchainai)
6
6
 
7
- This package contains the LangChain integration with SERPEX (Python).
7
+ This package contains the LangChain integration with Serpex (Python).
8
8
 
9
9
  ## Installation
10
10
 
@@ -12,17 +12,19 @@ This package contains the LangChain integration with SERPEX (Python).
12
12
  pip install langchain-serpex-python
13
13
  ```
14
14
 
15
- ## What is SERPEX?
15
+ ## What is Serpex?
16
16
 
17
- SERPEX is a powerful multi-engine search API that provides access to search results from Google, Bing, DuckDuckGo, Baidu, Yandex, and other search engines in JSON format. It's designed for developers building AI applications, SEO tools, market research platforms, and data aggregation services.
17
+ Serpex is a real-time web search API. It returns structured JSON results
18
+ (title, URL, snippet) for any query, and offers page content extraction that
19
+ turns URLs into LLM-ready markdown. It's built for AI agents, LLM tools and
20
+ RAG pipelines.
18
21
 
19
22
  ## Features
20
23
 
21
- - **Multi-Engine Support**: Search across Google, Bing, DuckDuckGo, Baidu, and Yandex
22
- - **Rich Results**: Get organic results, answer boxes, knowledge graphs, news, images, videos, and shopping results
23
- - **Localization**: Support for location-based and language-specific searches
24
- - **Real-time Data**: Access to current search results
25
- - **Easy Integration**: Simple API with comprehensive documentation
24
+ - **Real-time web search**: current results for any query
25
+ - **One search engine**: nothing to configure no engine to pick
26
+ - **LangChain-native**: a drop-in `BaseTool` for agents and chains
27
+ - **Easy integration**: API key via argument or `SERPEX_API_KEY`
26
28
 
27
29
  ## Quick Start
28
30
 
@@ -36,10 +38,7 @@ Sign up at [SERPEX](https://serpex.dev) to get your API key.
36
38
  from langchain_serpex_python import SerpexSearchResults
37
39
 
38
40
  # Initialize the tool
39
- tool = SerpexSearchResults(
40
- api_key="your-serpex-api-key",
41
- engine="google"
42
- )
41
+ tool = SerpexSearchResults(api_key="your-serpex-api-key")
43
42
 
44
43
  # Perform a search
45
44
  results = tool.invoke("latest AI developments")
@@ -54,10 +53,7 @@ from langchain_openai import ChatOpenAI
54
53
  from langchain.agents import initialize_agent, AgentType
55
54
 
56
55
  # Initialize the search tool
57
- search_tool = SerpexSearchResults(
58
- api_key="your-serpex-api-key",
59
- engine="google"
60
- )
56
+ search_tool = SerpexSearchResults(api_key="your-serpex-api-key")
61
57
 
62
58
  # Initialize the LLM
63
59
  llm = ChatOpenAI(temperature=0)
@@ -83,32 +79,18 @@ from langchain_serpex_python import SerpexSearchResults
83
79
  # Configure with advanced parameters
84
80
  tool = SerpexSearchResults(
85
81
  api_key="your-serpex-api-key",
86
- engine="google",
87
82
  time_range="month"
88
83
  )
89
84
 
90
- # Search for location-specific results
91
85
  results = tool.invoke("best restaurants")
92
86
  print(results)
93
87
  ```
94
88
 
95
- ### Different Search Engines
89
+ ### The `engine` parameter (deprecated)
96
90
 
97
- ```python
98
- from langchain_serpex_python import SerpexSearchResults
99
-
100
- # Google Search
101
- google_tool = SerpexSearchResults(api_key="your-key", engine="google")
102
- google_results = google_tool.invoke("Python programming")
103
-
104
- # Bing Search
105
- bing_tool = SerpexSearchResults(api_key="your-key", engine="bing")
106
- bing_results = bing_tool.invoke("Python programming")
107
-
108
- # DuckDuckGo Search
109
- ddg_tool = SerpexSearchResults(api_key="your-key", engine="duckduckgo")
110
- ddg_results = ddg_tool.invoke("Python programming")
111
- ```
91
+ Serpex is one search engine, so there is nothing to select. `engine` is
92
+ deprecated and ignored by the Serpex API since 2026-06; it is still accepted
93
+ so existing code keeps working.
112
94
 
113
95
  ## Configuration
114
96
 
@@ -130,10 +112,10 @@ tool = SerpexSearchResults() # Will use SERPEX_API_KEY from environment
130
112
 
131
113
  ### Parameters
132
114
 
133
- - `api_key` (str): Your SERPEX API key (required)
134
- - `engine` (str): Search engine to use - "auto", "google", "bing", "duckduckgo", "brave", "yahoo", "yandex" (default: "auto")
115
+ - `api_key` (str): Your Serpex API key (required)
116
+ - `engine` (str): **Deprecated** ignored by the Serpex API (default: "auto"); still accepted
135
117
  - `category` (str): Search category - currently only "web" is supported (default: "web")
136
- - `time_range` (str): Time filter - "all", "day", "week", "month", "year" (not supported by Brave)
118
+ - `time_range` (str): Time filter - "all", "day", "week", "month", "year"
137
119
 
138
120
  ## Documentation
139
121
 
@@ -0,0 +1,9 @@
1
+ """Serpex integration for LangChain.
2
+
3
+ This module provides a LangChain tool for real-time web search with Serpex,
4
+ a real-time web search API.
5
+ """
6
+
7
+ from langchain_serpex_python.tools import SerpexSearchResults
8
+
9
+ __all__ = ["SerpexSearchResults"]
@@ -10,27 +10,26 @@ from pydantic import Field, SecretStr, model_validator
10
10
 
11
11
 
12
12
  class SerpexSearchResults(BaseTool):
13
- """Tool for searching the web using the SERPEX API.
13
+ """Tool for real-time web search with Serpex.
14
14
 
15
- SERPEX provides multi-engine search results from Google, Bing, DuckDuckGo,
16
- Brave, Yahoo, and Yandex search engines in JSON format.
15
+ Serpex is a real-time web search API that returns results as JSON.
17
16
 
18
17
  Setup:
19
- Install `langchain-serpex` and set environment variable `SERPEX_API_KEY`.
18
+ Install `langchain-serpex-python` and set environment variable
19
+ `SERPEX_API_KEY`.
20
20
 
21
21
  ```bash
22
- pip install -U langchain-serpex
22
+ pip install -U langchain-serpex-python
23
23
  export SERPEX_API_KEY="your-serpex-api-key"
24
24
  ```
25
25
 
26
26
  Instantiation:
27
27
  ```python
28
- from langchain_serpex import SerpexSearchResults
28
+ from langchain_serpex_python import SerpexSearchResults
29
29
 
30
30
  # With explicit API key
31
31
  tool = SerpexSearchResults(
32
32
  api_key="your-serpex-api-key",
33
- engine="auto", # or google, bing, duckduckgo, brave, yahoo, yandex
34
33
  time_range="day" # optional: all, day, week, month, year
35
34
  )
36
35
 
@@ -47,14 +46,13 @@ class SerpexSearchResults(BaseTool):
47
46
  # With specific parameters
48
47
  results = tool.invoke({
49
48
  "query": "Python programming",
50
- "engine": "google",
51
49
  "time_range": "week"
52
50
  })
53
51
  ```
54
52
 
55
53
  Example with Agent:
56
54
  ```python
57
- from langchain_serpex import SerpexSearchResults
55
+ from langchain_serpex_python import SerpexSearchResults
58
56
  from langchain_openai import ChatOpenAI
59
57
  from langchain.agents import initialize_agent, AgentType
60
58
 
@@ -73,19 +71,18 @@ class SerpexSearchResults(BaseTool):
73
71
 
74
72
  name: str = "serpex_search"
75
73
  description: str = (
76
- "A powerful multi-engine web search tool. "
74
+ "A real-time web search tool. "
77
75
  "Useful for answering questions about current events, "
78
76
  "finding information from the web, and getting real-time data. "
79
- "Input should be a search query string. "
80
- "Supports automatic routing with retry logic and multiple search engines "
81
- "(Google, Bing, DuckDuckGo, Brave, Yahoo, Yandex)."
77
+ "Input should be a search query string."
82
78
  )
83
79
 
84
80
  api_key: SecretStr = Field(default_factory=lambda: SecretStr(""))
85
81
  engine: str = Field(
86
82
  default="auto",
87
83
  description=(
88
- "Search engine: auto, google, bing, duckduckgo, brave, yahoo, yandex"
84
+ "Deprecated: ignored by the Serpex API since 2026-06 (Serpex is a "
85
+ "single search engine). Still accepted for backward compatibility."
89
86
  ),
90
87
  )
91
88
  category: str = Field(
@@ -95,7 +92,7 @@ class SerpexSearchResults(BaseTool):
95
92
  time_range: Optional[str] = Field(
96
93
  default=None,
97
94
  description=(
98
- "Time range: all, day, week, month, year (not supported by Brave)"
95
+ "Time range: all, day, week, month, year"
99
96
  ),
100
97
  )
101
98
 
@@ -4,8 +4,9 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "langchain-serpex-python"
7
- version = "0.1.5"
8
- description = "An integration package connecting SERPEX and LangChain (Python)"
7
+ version = "0.1.6"
8
+ description = "LangChain integration for Serpex, a real-time web search API (Python)"
9
+ keywords = ["langchain", "serpex", "search", "search-api", "web-search", "real-time-search", "ai-agents", "llm", "rag"]
9
10
  readme = "README.md"
10
11
  license = {text = "MIT"}
11
12
  authors = []
@@ -18,8 +19,8 @@ dependencies = [
18
19
  [project.urls]
19
20
  Homepage = "https://docs.langchain.com/oss/python/integrations/providers/serpex"
20
21
  Documentation = "https://serpex.dev/docs"
21
- Source = "https://github.com/divyeshradadiya/langchain-serpex"
22
- Repository = "https://github.com/divyeshradadiya/langchain-serpex"
22
+ Source = "https://github.com/divyeshradadiya/langchain-serpex-python"
23
+ Repository = "https://github.com/divyeshradadiya/langchain-serpex-python"
23
24
 
24
25
  [dependency-groups]
25
26
  test = [
@@ -5,13 +5,13 @@ import os
5
5
  import pytest
6
6
  from pydantic import SecretStr
7
7
 
8
- from langchain_serpex import SerpexSearchResults
8
+ from langchain_serpex_python import SerpexSearchResults
9
9
 
10
10
 
11
11
  @pytest.mark.compile
12
12
  def test_import() -> None:
13
13
  """Test that the module can be imported."""
14
- from langchain_serpex import SerpexSearchResults # noqa: F401
14
+ from langchain_serpex_python import SerpexSearchResults # noqa: F401
15
15
 
16
16
 
17
17
  @pytest.mark.skipif("SERPEX_API_KEY" not in os.environ, reason="SERPEX_API_KEY not set")
@@ -30,15 +30,13 @@ def test_serpex_search_integration() -> None:
30
30
 
31
31
 
32
32
  @pytest.mark.skipif("SERPEX_API_KEY" not in os.environ, reason="SERPEX_API_KEY not set")
33
- def test_serpex_different_engines() -> None:
34
- """Test search with different engines."""
33
+ def test_serpex_deprecated_engine_still_accepted() -> None:
34
+ """The deprecated `engine` value is still accepted (and ignored by the API)."""
35
35
  api_key = os.getenv("SERPEX_API_KEY")
36
36
  if not api_key:
37
37
  pytest.skip("SERPEX_API_KEY not set")
38
38
 
39
- engines = ["google", "bing", "duckduckgo"]
40
-
41
- for engine in engines:
39
+ for engine in ["auto", "legacy-value"]:
42
40
  tool = SerpexSearchResults(api_key=SecretStr(api_key), engine=engine)
43
41
  result = tool._run("test query")
44
42
  assert result
@@ -6,7 +6,7 @@ from typing import Any
6
6
  import pytest
7
7
  from pydantic import SecretStr
8
8
 
9
- from langchain_serpex import SerpexSearchResults
9
+ from langchain_serpex_python import SerpexSearchResults
10
10
 
11
11
 
12
12
  def test_serpex_initialization() -> None:
@@ -28,33 +28,33 @@ def test_serpex_custom_parameters() -> None:
28
28
  """Test that Serpex accepts custom parameters."""
29
29
  tool = SerpexSearchResults(
30
30
  api_key=SecretStr("test_api_key"),
31
- engine="google",
31
+ engine="legacy-value",
32
32
  category="web",
33
33
  time_range="day",
34
34
  )
35
- assert tool.engine == "google"
35
+ assert tool.engine == "legacy-value"
36
36
  assert tool.time_range == "day"
37
37
 
38
38
 
39
39
  def test_serpex_build_params() -> None:
40
40
  """Test that _build_params creates correct parameters."""
41
41
  tool = SerpexSearchResults(
42
- api_key=SecretStr("test_key"), engine="bing", time_range="week"
42
+ api_key=SecretStr("test_key"), engine="legacy-a", time_range="week"
43
43
  )
44
44
  params = tool._build_params("test query")
45
45
 
46
46
  assert params["q"] == "test query"
47
- assert params["engine"] == "bing"
47
+ assert params["engine"] == "legacy-a"
48
48
  assert params["category"] == "web"
49
49
  assert params["time_range"] == "week"
50
50
 
51
51
 
52
52
  def test_serpex_build_params_override() -> None:
53
53
  """Test that _build_params allows overrides."""
54
- tool = SerpexSearchResults(api_key=SecretStr("test_key"), engine="google")
55
- params = tool._build_params("test query", engine="duckduckgo", time_range="month")
54
+ tool = SerpexSearchResults(api_key=SecretStr("test_key"), engine="legacy-a")
55
+ params = tool._build_params("test query", engine="legacy-b", time_range="month")
56
56
 
57
- assert params["engine"] == "duckduckgo"
57
+ assert params["engine"] == "legacy-b"
58
58
  assert params["time_range"] == "month"
59
59
 
60
60
 
@@ -1,10 +0,0 @@
1
- """SERPEX integration for LangChain.
2
-
3
- This module provides tools for searching the web using the SERPEX API,
4
- which supports multiple search engines including Google, Bing, DuckDuckGo,
5
- Baidu, and Yandex.
6
- """
7
-
8
- from langchain_serpex_python.tools import SerpexSearchResults
9
-
10
- __all__ = ["SerpexSearchResults"]