Skip to content

Commit

Permalink
Update index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
TuanaCelik authored Sep 22, 2023
1 parent 4ca3630 commit bd499da
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ There are already enough components available in the Haystack 2.0 preview for us
To build a RAG pipeline that can create a summary for each of the latest _k_ posts on Hacker News, we will use two components from the Haystack 2.0 preview:

- The `PromptBuilder`: This component allows us to create prompt templates using [Jinja](https://jinja.palletsprojects.com/en/3.1.x/) as our templating language.
- The `GPT4Generator`: This component simply prompts GPT4. We can connect the `PromptBuilder` output to this component to customize how we interact with GPT4.
- The `GPTGenerator`: This component simply prompts the specified GPT model. We can connect the `PromptBuilder` output to this component to customize how we interact with our chosen model.

First, we initialize all of the components we will need for the pipeline:

```python
from haystack.preview import Pipeline
from haystack.preview.components.builders.prompt_builder import PromptBuilder
from haystack.preview.components.generators.openai.gpt4 import GPT4Generator
from haystack.preview.components.generators.openai import GPTGenerator
prompt_template = """
You will be provided a few of the latest posts in HackerNews, followed by their URL.
Expand All @@ -130,7 +130,7 @@ Posts:
"""
prompt_builder = PromptBuilder(template=prompt_template)
llm = GPT4Generator(api_key='YOUR_API_KEY')
llm = GPTGenerator(model_name="gpt-4", api_key='YOUR_API_KEY')
fetcher = HackernewsNewestFetcher()
```
Next, we add the components to a Pipeline:
Expand Down

1 comment on commit bd499da

@vercel
Copy link

@vercel vercel bot commented on bd499da Sep 22, 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.