-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added all code snippets and sidebars.js
- Loading branch information
Showing
6 changed files
with
158 additions
and
15 deletions.
There are no files selected for viewing
Empty file.
51 changes: 51 additions & 0 deletions
51
docs/examples/docs/examples/qdrant_zendeskdocs/examples/qdrant_zendesk/code/qdrant.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import dlt | ||
from dlt.destinations.qdrant import qdrant_adapter | ||
from qdrant_client import QdrantClient | ||
|
||
from zendesk import zendesk_support | ||
|
||
def main(): | ||
# 1. Create a pipeline | ||
pipeline = dlt.pipeline( | ||
pipeline_name="qdrant_zendesk_pipeline", | ||
destination="qdrant", | ||
dataset_name="zendesk_data_tickets", | ||
) | ||
|
||
# 2. Initialize Zendesk source to get the ticket data | ||
zendesk_source = zendesk_support(load_all=False) | ||
tickets = zendesk_source.tickets | ||
|
||
# 3. Run the dlt pipeline | ||
info = pipeline.run( | ||
# 4. Here we use a special function to tell Qdrant | ||
# which fields to embed | ||
qdrant_adapter( | ||
tickets, | ||
embed=["subject", "description"], | ||
) | ||
) | ||
|
||
return info | ||
|
||
if __name__ == "__main__": | ||
load_info = main() | ||
print(load_info) | ||
|
||
|
||
# running the Qdrant client | ||
qdrant_client = QdrantClient( | ||
url="https://your-qdrant-url", | ||
api_key="your-qdrant-api-key", | ||
) | ||
|
||
# view Qdrant collections | ||
print(qdrant_client.get_collections()) | ||
|
||
response = qdrant_client.query( | ||
"zendesk_data_tickets", # collection/dataset name | ||
query_text=["cancel", "cancel subscription"], # prompt to search | ||
limit=3 # limit the number of results to the nearest 3 embeddings | ||
) | ||
|
||
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Admonition from "@theme/Admonition"; | ||
import CodeBlock from '@theme/CodeBlock'; | ||
|
||
<Admonition> | ||
The source code for this example can be found in our repository at: <a href={"https://github.com/dlt-hub/dlt/tree/devel/docs/examples/" + props.slug}>{"https://github.com/dlt-hub/dlt/tree/devel/docs/examples/" + props.slug}</a>. | ||
</Admonition> | ||
|
||
## TLDR | ||
<div>{props.intro}</div> | ||
|
||
## Setup: Running this example on your machine | ||
<CodeBlock language="sh"> | ||
{`# clone the dlt repository | ||
git clone [email protected]:dlt-hub/dlt.git | ||
# go to example directory | ||
cd ./dlt/docs/examples/${props.slug} | ||
# install dlt with qdrant | ||
pip install "dlt[qdrant]" | ||
# run the example script | ||
python ${props.run_file}.py`} | ||
</CodeBlock> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters