Back to All questionsHow do I resolve ValueError: If neither or both examples and example_selector are provided?
Ask questionpython
from langchain_core.prompts import FewShotPromptTemplate
prompt = FewShotPromptTemplate(
examples=[],
example_selector=None,
input_variables=["question"],
suffix="Q: {question}\nA:"
)
Error:
text
ValueError: If neither or both examples and example_selector are provided.
1 answerHelpful solutions from the community
Fix:
python
prompt = FewShotPromptTemplate(
examples=[{"question": "What is AI?", "answer": "Artificial Intelligence"}],
input_variables=["question"],
suffix="Q: {question}\nA:"
)
Need a custom solution?
Tell us about your project and get help tailored to your problem.
Contact usHave an answer? Join the conversation.
Everyone can read. Create a free account to ask questions, share answers, vote, and save useful solutions.