deepset-ai / haystack-cookbook Goto Github PK
View Code? Open in Web Editor NEWπ©π»βπ³ A collection of example notebooks
π©π»βπ³ A collection of example notebooks
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)
Create an cookbook showcasing the new Ragas integration. The cookbook should evaluate a RAG pipeline with various metrics:
RagasEvaluator Docs
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
Todo:
Create an cookbook showcasing the new UpTrqain integration. The cookbook should evaluate a RAG pipeline with various metrics:
UpTrainEvaluator Docs
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)
Create an cookbook showcasing the new DeepEval integration. The cookbook should evaluate a RAG pipeline with various metrics:
DeepEval Docs
this:
transcription = whisper.run(audio_files="/content/podcast.mp3")
returns this error:
TypeError: LocalWhisperTranscriber.run() got an unexpected keyword argument 'audio_files'
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.