# ⚡ Langchain Linkup
[![PyPI version](https://badge.fury.io/py/langchain-linkup.svg)](https://pypi.org/project/langchain-linkup/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
A [LangChain](https://www.langchain.com/) integration for the
[Linkup API](https://linkup-api.readme.io/reference/getting-started), allowing easy integration with
Linkup's services. 🔗
## 🌟 Features
- 🔗 **Simple LangChain components to cover all Linkup API use cases.**
- 🔍 **Supports both standard and deep search queries.**
- ⚡ **Supports synchronous and asynchronous requests.**
- 🔒 **Handles authentication and request management.**
## 📦 Installation
Simply install the LangChain integration using `pip`:
```bash
pip install langchain-linkup
```
## 🛠️ Usage
### Setting Up Your Environment
1. **🔑 Obtain an API Key:**
Sign up on Linkup to get your API key.
2. **⚙️ Set-up the API Key:**
Option 1: Export the `LINKUP_API_KEY` environment variable in your shell before using the Linkup
LangChain component.
```bash
export LINKUP_API_KEY='YOUR_LINKUP_API_KEY'
```
Option 2: Set the `LINKUP_API_KEY` environment variable directly within Python, using for
instance `os.environ` or [python-dotenv](https://github.com/theskumar/python-dotenv) with a
`.env` file (`python-dotenv` needs to be installed separately in this case), before creating the
Linkup LangChain component.
```python
import os
from langchain_linkup import LinkupSearchRetriever
os.environ["LINKUP_API_KEY"] = "YOUR_LINKUP_API_KEY"
# or dotenv.load_dotenv()
retriever = LinkupSearchRetriever(...)
...
```
Option 3: Pass the Linkup API key to the Linkup LangChain component when creating it.
```python
from langchain_linkup import LinkupSearchRetriever
retriever = LinkupSearchRetriever(api_key="YOUR_LINKUP_API_KEY", ...)
...
```
## 📋 Example
All search queries can be used with two very different modes:
- with `depth="standard"`, the search will be straightforward and fast, suited for relatively simple
queries (e.g. "What's the weather in Paris today?")
- with `depth="deep"`, the search will use an agentic workflow, which makes it in general slower,
but it will be able to solve more complex queries (e.g. "What is the company profile of LangChain
accross the last few years, and how does it compare to its concurrents?")
### 🔍 Linkup Search Retriever
A retriever is a LangChain component which simply retrieves documents based on a query. It is
typically the first step of a RAG (Retrival Augmented Generation) pipeline. See
[this page](https://python.langchain.com/docs/concepts/retrievers/) for more information. The
`LinkupSearchRetriever` makes available the Linkup API search as a LangChain retriever.
```python
from langchain_linkup import LinkupSearchRetriever
# Initialize the LangChain component (API key can be read from the environment variable or passed as
# an argument)
retriever = LinkupSearchRetriever(
depth="deep", # "standard" or "deep"
)
# Perform a search query
documents = retriever.invoke(input="What is Linkup, the new French AI startup?")
print(documents)
```
### ⚒️ Linkup Search Tool
A tool is a LangChain component which enables agents to perform a specific task, like a web search.
Tools are designed to be called autonomously by the agent, and their output is fed back to the
agent, allowing them to perform some kind of reasoning based on the tool usage. See
[this page](https://python.langchain.com/docs/integrations/tools/) for more information. The
`LinkupSearchTool` makes available the Linkup API search as a LangChain tool.
```python
from langchain_linkup import LinkupSearchTool
# Initialize the LangChain component (API key can be read from the environment variable or passed as
# an argument)
tool = LinkupSearchTool(
depth="deep", # "standard" or "deep"
output_type="searchResults", # "searchResults", "sourcedAnswer" or "structured"
)
# Perform a search query
search_results = tool.invoke(input="What is Linkup, the new French AI startup?")
print(search_results)
```
### 📚 More Examples
See the `examples/` directory for more contextualized examples and documentation, for instance on
how to use the Linkup Search Retriever in a simple RAG pipeline.
Raw data
{
"_id": null,
"home_page": "https://github.com/LinkupPlatform/langchain-linkup",
"name": "langchain-linkup",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "linkup api langchain integration search retriever",
"author": "LINKUP TECHNOLOGIES",
"author_email": "contact@linkup.so",
"download_url": "https://files.pythonhosted.org/packages/8e/51/f0eb62effa4d001ec2cd7f85c22f4759d18fe0e5c238206d9208755556ef/langchain_linkup-0.1.3.tar.gz",
"platform": null,
"description": "# \u26a1 Langchain Linkup\n\n[![PyPI version](https://badge.fury.io/py/langchain-linkup.svg)](https://pypi.org/project/langchain-linkup/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\nA [LangChain](https://www.langchain.com/) integration for the\n[Linkup API](https://linkup-api.readme.io/reference/getting-started), allowing easy integration with\nLinkup's services. \ud83d\udd17\n\n## \ud83c\udf1f Features\n\n- \ud83d\udd17 **Simple LangChain components to cover all Linkup API use cases.**\n- \ud83d\udd0d **Supports both standard and deep search queries.**\n- \u26a1 **Supports synchronous and asynchronous requests.**\n- \ud83d\udd12 **Handles authentication and request management.**\n\n## \ud83d\udce6 Installation\n\nSimply install the LangChain integration using `pip`:\n\n```bash\npip install langchain-linkup\n```\n\n## \ud83d\udee0\ufe0f Usage\n\n### Setting Up Your Environment\n\n1. **\ud83d\udd11 Obtain an API Key:**\n\n Sign up on Linkup to get your API key.\n\n2. **\u2699\ufe0f Set-up the API Key:**\n\n Option 1: Export the `LINKUP_API_KEY` environment variable in your shell before using the Linkup\n LangChain component.\n\n ```bash\n export LINKUP_API_KEY='YOUR_LINKUP_API_KEY'\n ```\n\n Option 2: Set the `LINKUP_API_KEY` environment variable directly within Python, using for\n instance `os.environ` or [python-dotenv](https://github.com/theskumar/python-dotenv) with a\n `.env` file (`python-dotenv` needs to be installed separately in this case), before creating the\n Linkup LangChain component.\n\n ```python\n import os\n from langchain_linkup import LinkupSearchRetriever\n\n os.environ[\"LINKUP_API_KEY\"] = \"YOUR_LINKUP_API_KEY\"\n # or dotenv.load_dotenv()\n retriever = LinkupSearchRetriever(...)\n ...\n ```\n\n Option 3: Pass the Linkup API key to the Linkup LangChain component when creating it.\n\n ```python\n from langchain_linkup import LinkupSearchRetriever\n\n retriever = LinkupSearchRetriever(api_key=\"YOUR_LINKUP_API_KEY\", ...)\n ...\n ```\n\n## \ud83d\udccb Example\n\nAll search queries can be used with two very different modes:\n\n- with `depth=\"standard\"`, the search will be straightforward and fast, suited for relatively simple\n queries (e.g. \"What's the weather in Paris today?\")\n- with `depth=\"deep\"`, the search will use an agentic workflow, which makes it in general slower,\n but it will be able to solve more complex queries (e.g. \"What is the company profile of LangChain\n accross the last few years, and how does it compare to its concurrents?\")\n\n### \ud83d\udd0d Linkup Search Retriever\n\nA retriever is a LangChain component which simply retrieves documents based on a query. It is\ntypically the first step of a RAG (Retrival Augmented Generation) pipeline. See\n[this page](https://python.langchain.com/docs/concepts/retrievers/) for more information. The\n`LinkupSearchRetriever` makes available the Linkup API search as a LangChain retriever.\n\n```python\nfrom langchain_linkup import LinkupSearchRetriever\n\n# Initialize the LangChain component (API key can be read from the environment variable or passed as\n# an argument)\nretriever = LinkupSearchRetriever(\n depth=\"deep\", # \"standard\" or \"deep\"\n)\n\n# Perform a search query\ndocuments = retriever.invoke(input=\"What is Linkup, the new French AI startup?\")\nprint(documents)\n```\n\n### \u2692\ufe0f Linkup Search Tool\n\nA tool is a LangChain component which enables agents to perform a specific task, like a web search.\nTools are designed to be called autonomously by the agent, and their output is fed back to the\nagent, allowing them to perform some kind of reasoning based on the tool usage. See\n[this page](https://python.langchain.com/docs/integrations/tools/) for more information. The\n`LinkupSearchTool` makes available the Linkup API search as a LangChain tool.\n\n```python\nfrom langchain_linkup import LinkupSearchTool\n\n# Initialize the LangChain component (API key can be read from the environment variable or passed as\n# an argument)\ntool = LinkupSearchTool(\n depth=\"deep\", # \"standard\" or \"deep\"\n output_type=\"searchResults\", # \"searchResults\", \"sourcedAnswer\" or \"structured\"\n)\n\n# Perform a search query\nsearch_results = tool.invoke(input=\"What is Linkup, the new French AI startup?\")\nprint(search_results)\n```\n\n### \ud83d\udcda More Examples\n\nSee the `examples/` directory for more contextualized examples and documentation, for instance on\nhow to use the Linkup Search Retriever in a simple RAG pipeline.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Langchain integration for the Linkup API",
"version": "0.1.3",
"project_urls": {
"Documentation": "https://github.com/LinkupPlatform/langchain-linkup#readme",
"Homepage": "https://github.com/LinkupPlatform/langchain-linkup",
"Issue Tracker": "https://github.com/LinkupPlatform/langchain-linkup/issues",
"Source Code": "https://github.com/LinkupPlatform/langchain-linkup"
},
"split_keywords": [
"linkup",
"api",
"langchain",
"integration",
"search",
"retriever"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e9074fa2ef39d7e2fc4c17ddf74f2ba0a800b6a210a8921ceb6eeeaafc3b4b01",
"md5": "29566f72a4a982737dcbc1d0eb0c1582",
"sha256": "b3109911efb941065ab25feafab785f9678af8b08889712a15344467a52d5ba0"
},
"downloads": -1,
"filename": "langchain_linkup-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "29566f72a4a982737dcbc1d0eb0c1582",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 10203,
"upload_time": "2024-11-27T17:02:55",
"upload_time_iso_8601": "2024-11-27T17:02:55.629135Z",
"url": "https://files.pythonhosted.org/packages/e9/07/4fa2ef39d7e2fc4c17ddf74f2ba0a800b6a210a8921ceb6eeeaafc3b4b01/langchain_linkup-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8e51f0eb62effa4d001ec2cd7f85c22f4759d18fe0e5c238206d9208755556ef",
"md5": "1d1d1b5d88492e7ac0872ae253c7a0b4",
"sha256": "b9e463777188cd41d2903d5b9228a29e3399356e87001fa6d14d747ee3e6313a"
},
"downloads": -1,
"filename": "langchain_linkup-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "1d1d1b5d88492e7ac0872ae253c7a0b4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 10616,
"upload_time": "2024-11-27T17:02:57",
"upload_time_iso_8601": "2024-11-27T17:02:57.730806Z",
"url": "https://files.pythonhosted.org/packages/8e/51/f0eb62effa4d001ec2cd7f85c22f4759d18fe0e5c238206d9208755556ef/langchain_linkup-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-27 17:02:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LinkupPlatform",
"github_project": "langchain-linkup",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "langchain-linkup"
}