Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pip install linkup-sdk
SDK.

```bash
export LINKUP_API_KEY='YOUR_LINKUP_API_KEY'
export LINKUP_API_KEY=<your-linkup-api-key>
```

Option 2: Set the `LINKUP_API_KEY` environment variable directly within Python, using for
Expand All @@ -49,7 +49,7 @@ pip install linkup-sdk
import os
from linkup import LinkupClient

os.environ["LINKUP_API_KEY"] = "YOUR_LINKUP_API_KEY"
os.environ["LINKUP_API_KEY"] = "<your-linkup-api-key>"
# or dotenv.load_dotenv()
client = LinkupClient()
...
Expand All @@ -60,7 +60,7 @@ pip install linkup-sdk
```python
from linkup import LinkupClient

client = LinkupClient(api_key="YOUR_LINKUP_API_KEY")
client = LinkupClient(api_key="<your-linkup-api-key>")
...
```

Expand Down Expand Up @@ -111,6 +111,10 @@ print(search_response.model_dump())
# }
```

Check the code or the
[official documentation](https://docs.linkup.so/pages/documentation/api-reference/endpoint/post-search)
for the detailed list of available parameters.

#### 🪝 Fetch

The `fetch` function can be used to retrieve the content of a given web page in a cleaned up
Expand All @@ -136,6 +140,10 @@ print(fetch_response.model_dump())
# }
```

Check the code or the
[official documentation](https://docs.linkup.so/pages/documentation/api-reference/endpoint/post-fetch)
for the detailed list of available parameters.

#### 📚 More Examples

See the `examples/` directory for more examples and documentation, for instance on how to use Linkup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""
"""Example of search results search.

The Linkup search can output raw search results which can then be re-used in different use-cases,
for instance in a RAG system, with the output_type parameter set to "searchResults".
for instance in a RAG system, with the `output_type` parameter set to `searchResults`.

To use this script, copy the `.env.example` file at the root of the repository inside a `.env`, and
fill the missing values, or pass a Linkup API key to the `LinkupClient` initialization.
"""

from dotenv import load_dotenv
Expand Down
10 changes: 7 additions & 3 deletions examples/2_sourced_answer_search.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"""
The Linkup search can also be used to perform direct Question Answering, with output_type set to
"sourcedAnswer". In this case, the API will output an answer to the query in natural language,
"""Example of sourced answer search.

The Linkup search can also be used to perform direct Question Answering, with `output_type` set to
`sourcedAnswer`. In this case, the API will output an answer to the query in natural language,
along with the sources supporting it.

To use this script, copy the `.env.example` file at the root of the repository inside a `.env`, and
fill the missing values, or pass a Linkup API key to the `LinkupClient` initialization.
"""

from dotenv import load_dotenv
Expand Down
12 changes: 8 additions & 4 deletions examples/3_structured_search.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"""
With output_type set to "structured", the Linkup search can be used to require any arbitrary data
structure, based on a JSON schema or a pydantic.BaseModel. This can be used with a well defined and
documented schema to steer the Linkup search in any direction.
"""Example of a structured search.

With `output_type` set to `structured`, the Linkup search can be used to require any arbitrary data
structure, based on a JSON schema or a `pydantic.BaseModel`. This can be used with a well defined
and documented schema to steer the Linkup search in any direction.

To use this script, copy the `.env.example` file at the root of the repository inside a `.env`, and
fill the missing values, or pass a Linkup API key to the `LinkupClient` initialization.
"""

from dotenv import load_dotenv
Expand Down
6 changes: 5 additions & 1 deletion examples/4_asynchronous_search.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"""
"""Example of asynchronous search.

All Linkup entrypoints come with an asynchronous version. This snippet demonstrates how to run
multiple asynchronous searches concurrently, which decreases by a lot the total computation
duration.

To use this script, copy the `.env.example` file at the root of the repository inside a `.env`, and
fill the missing values, or pass a Linkup API key to the `LinkupClient` initialization.
"""

import asyncio
Expand Down
9 changes: 6 additions & 3 deletions examples/5_fetch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
"""
The Linkup fetch can output the raw content of a web page.
"""Example of web page fetch.

The Linkup fetch can output the content of a web page as a cleaned up markdown.

To use this script, copy the `.env.example` file at the root of the repository inside a `.env`, and
fill the missing values, or pass a Linkup API key to the `LinkupClient` initialization.
"""

from dotenv import load_dotenv
Expand All @@ -12,6 +16,5 @@

response = client.fetch(
url="https://docs.linkup.so",
render_js=False,
)
print(response)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
]

dependencies = ["httpx", "pydantic"]
dependencies = ["httpx>=0.23.0", "pydantic>=2.0.0"]

[project.optional-dependencies]
build = ["uv>=0.8.0,<0.9.0"] # For python-semantic-release build command, used in GitHub actions
Expand Down
Loading