Giter Club home page Giter Club logo

haystack-cookbook's People

Contributors

anakin87 avatar annthurium avatar anushreebannadabhavi avatar bilgeyucel avatar davidsbatista avatar jjingrong avatar julian-risch avatar kuzcotopiallm avatar masci avatar nickprock avatar rorcde avatar shademe avatar tuanacelik avatar vblagoje avatar zansara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

haystack-cookbook's Issues

Mixtral 8x7B with Hugging Face TGI for Web QA notebook

one error that was easy to fix is this:

change mistralai/Mistral-7B-Instruct-v0.1 to mistralai/Mistral-7B-Instruct-v0.2

but not sure whats up with this error?


ImportError Traceback (most recent call last)
in <cell line: 5>()
3 from haystack.components.preprocessors import DocumentSplitter
4 from haystack.components.rankers import TransformersSimilarityRanker
----> 5 from haystack.components.generators import GPTGenerator
6 from haystack.components.builders.prompt_builder import PromptBuilder
7 from haystack import Pipeline

ImportError: cannot import name 'GPTGenerator' from 'haystack.components.generators' (/usr/local/lib/python3.10/dist-packages/haystack/components/generators/init.py)

chroma-indexing-and-rag-examples.ipynb

when running, after this:

query = "Should I write documentation for my plugin?"
results = querying.run({"retriever": {"queries": [query], "top_k": 3},
"prompt_builder": {"query": query},
"llm":{"generation_kwargs": {"max_new_tokens": 350}}})

got this:


ValueError Traceback (most recent call last)
in <cell line: 2>()
1 query = "Should I write documentation for my plugin?"
----> 2 results = querying.run({"retriever": {"queries": [query], "top_k": 3},
3 "prompt_builder": {"query": query},
4 "llm":{"generation_kwargs": {"max_new_tokens": 350}}})

1 frames
/usr/local/lib/python3.10/dist-packages/haystack/core/pipeline/pipeline.py in _validate_input(self, data)
602 for socket_name, socket in instance.haystack_input._sockets_dict.items():
603 if socket.senders == [] and socket.is_mandatory and socket_name not in component_inputs:
--> 604 raise ValueError(f"Missing input for component {component_name}: {socket_name}")
605 for input_name in component_inputs.keys():
606 if input_name not in instance.haystack_input._sockets_dict:

ValueError: Missing input for component retriever: query

Refactor cookbooks with Multiplexer

Todo:

  • Rename Multiplexer as BranchJoiner (Multiplexer has been deprecated with 2.2.0 and will be removed in 2.4.0)
  • (if exists) Multiplexer shouldn't be used to distribute output to multiple components; we can remove the multiplexer from the pipeline if that's the case. We can directly connect one output edge to inputs of multiple components

Cookbook showing RAG with references to documents in answers

Haystack 1.x had this prompt template https://prompthub.deepset.ai/?prompt=deepset%2Fquestion-answering-with-references instructing the LLM to provide references "[1]" to documents in the generated answer. It would be great to have a cookbook showing how to do that with Haystack 2.x.

The existing https://github.com/deepset-ai/haystack-cookbook/blob/main/notebooks/prompt_customization_for_Anthropic.ipynb is related but uses quotes from the documents. What I am looking for is a free text generated answer with references to documents not quotes.

Prompt could be the following:

from haystack.components.builders import PromptBuilder

template = """
Create a concise and informative answer (no more than 50 words) for a given question based solely on the given documents. 
You must only use information from the given documents. Use an unbiased and journalistic tone. Do not repeat text. 
Cite the documents using Document[number] notation. 
If multiple documents contain the answer, cite those documents like β€˜as stated in Document[number], Document[number], etc.’. 
If the documents do not contain the answer to the question, say that β€˜answering is not possible given the available information.’

Given the following information, answer the question.

{% for document in documents %}
    Document[{{loop.index}}]: {{ document.content }} \n
{% endfor %}

Question: {{question}}
Answer:
"""

prompt_builder = PromptBuilder(template=template)

multilingual_rag_podcast.ipynb

this:

transcription = whisper.run(audio_files="/content/podcast.mp3")

returns this error:

TypeError: LocalWhisperTranscriber.run() got an unexpected keyword argument 'audio_files'

organize cookbooks

Soon we're going to have enough of these that we should organize them a bit. Should it be by topic? Alphabetical? What would make it easiest to skim and find what you're looking for?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.