Skip to content

Commit

Permalink
Update "Quick Start" page (#212)
Browse files Browse the repository at this point in the history
* Update deepset description in the footer

* Add runnable code snippet to the quick-start page

* Update code explanations
  • Loading branch information
bilgeyucel authored Oct 6, 2023
1 parent ed54845 commit e1dc5de
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 25 deletions.
94 changes: 71 additions & 23 deletions content/overview/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,101 @@ toc: true
aliases: [get-started]
---

## The Haystack Source Code
<!-- ## Haystack Source Code
Haystack is an open source framework that helps developers build NLP empowered search systems.
On our Github, you can find the source code for Haystack.
This is also the main channel for raising issues and contributing to the project.
Haystack is an open source Python framework that helps developers build LLM empowered custom application.
{{< button url="https://github.com/deepset-ai/haystack" text="View Source Code" color="green">}}
You can find the source code for Haystack on GitHub. This is also the main channel for raising issues, asking questions and contributing to the project.
## Quick Installation
{{< button url="https://github.com/deepset-ai/haystack" text="View Source Code" color="green">}} -->

{{< tabs totalTabs="2">}}
{{< tab tabName="Basic Install" >}}
## Installation

The most straightforward way to install the latest release of Haystack is through pip.
These are the instructions for installing Haystack. The most straightforward way to install the latest release of Haystack is through [pip](https://github.com/pypa/pip).

This command will install everything needed for Pipelines that use an Elasticsearch Document Store. See <a href="https://docs.haystack.deepset.ai/docs/installation">Installation</a> for more details.
{{< tabs totalTabs="3">}}

{{< tab tabName="Minimal" >}}

This command installs everything needed for basic Pipelines that use an InMemoryDocumentStore and external LLM provider (e.g. OpenAI).

```python
pip install farm-haystack
```

{{< /tab >}}

{{< tab tabName="Full Install" >}}
{{< tab tabName="Basic" >}}

This command installs everything you need for basic Pipelines that use an InMemoryDocumentStore, as well as all necessary dependencies for model inference on local machine, including torch.

If you plan to be using more advanced features like Milvus, FAISS, Weaviate, OCR or Ray, you will need to install a full version of Haystack.
```python
pip install farm-haystack[inference]
```

The following command will install the latest version on the main branch.
{{< /tab >}}

{{< tab tabName="Full" >}}

This command installs further dependencies for more advanced features, like certain DocumentStores, FileConverters, OCR, or Ray.

```python
git clone https://github.com/deepset-ai/haystack.git
cd haystack
pip install -e .[all]
pip install --upgrade pip
pip install 'farm-haystack[all]' ## or 'all-gpu' for the GPU-enabled dependencies
```

{{< /tab >}}
{{< /tabs >}}

For a more comprehensive guide to installation, see our documentation.
For a more comprehensive installation guide, inlcuding methods for various operating systems, refer to our documentation.

{{< button url="https://docs.haystack.deepset.ai/docs/installation" text="Docs: Installation" color="green">}}

## Build Your First RAG Pipeline

Haystack is built around the concept of pipelines. A pipeline is a powerful structure made up of components that can be used to perform a task.
For example, you can connect together a Retriever and a PromptNode to build a Generative Question Answering pipeline.

{{< button url="https://docs.haystack.deepset.ai/docs/installation" text="Installation" color="green">}}
Try out how Haystack answers questions about Game of Thrones using **Retrieval Augmented Generation (RAG)** approach 👇

## Build Your First Pipeline
Install Haystack in the minimal form:
```bash
pip install farm-haystack
```
Ask a question on your data after indexing your data to the DocumentStore and building a RAG pipeline:
```python
from haystack.document_stores import InMemoryDocumentStore
from haystack.utils import build_pipeline, add_example_data, print_answers

# We are model agnostic :) Here, you can choose from: "anthropic", "cohere", "huggingface", and "openai".
provider = "openai"
API_KEY = "sk-..." # ADD YOUR KEY HERE

# We support many different databases. Here we load a simple and lightweight in-memory database.
document_store = InMemoryDocumentStore(use_bm25=True)

# Download and add Game of Thrones TXT articles to Haystack DocumentStore.
# You can also provide a folder with your local documents.
add_example_data(document_store, "data/GoT_getting_started")

Haystack is built around the concept of Pipelines. A Pipeline is a sequence of connected components that can be used to perform a task.
For example, you can chain together a Reader and a Retriever to build a Question Answering Pipeline.
# Build a pipeline with a Retriever to get relevant documents to the query and a PromptNode interacting with LLMs using a custom prompt.
pipeline = build_pipeline(provider, API_KEY, document_store)

# Ask a question on the data you just added.
result = pipeline.run(query="Who is the father of Arya Stark?")

# For details, like which documents were used to generate the answer, look into the <result> object
print_answers(result, details="medium")
```
The output of the pipeline will look like this, referencing the documents used to generate the answer:

```text
'Query: Who is the father of Arya Stark?'
'Answers:'
[{'answer': 'The father of Arya Stark is Lord Eddard Stark of '
'Winterfell. [Document 1, Document 4, Document 5]'}]
```

For a hands-on guide to building your first Pipeline, see our tutorials
For a hands-on guide to build your first RAG Pipeline, see our tutorial.

{{< button url="/tutorials/" text="Tutorials" color="green">}}
{{< button url="https://haystack.deepset.ai/tutorials/22_pipeline_with_promptnode" text="Tutorial: Creating a RAG Pipeline" color="green">}}
3 changes: 1 addition & 2 deletions themes/haystack/layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ <h3>Sign up for community updates</h3>

{{/* Tagline */}}
<p class="footer-tagline">
Building a semantic layer for the modern tech stack — driven by the
latest NLP and open source.
Building products, technology and solutions for LLM-enabled applications.
</p>

{{/* Social icons */}}
Expand Down

1 comment on commit e1dc5de

@vercel
Copy link

@vercel vercel bot commented on e1dc5de Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.