-
Notifications
You must be signed in to change notification settings - Fork 900
Exception raised in Job[2]: RagasOutputParserException(The output parser failed to parse the output including retries.) #1997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
28<00:09, 9.13s/it]output_string: ```json
|
@dosu 解答一下原因谢谢 |
The To address this issue, ensure that the model's output is JSON-parsable and adheres to the expected format. You might need to review the specific outputs causing the exception and adjust the model or prompt to produce valid JSON responses. Additionally, check if the output is being split incorrectly, as mentioned in your JSON output example, and ensure that the statements are correctly formatted before parsing. If you are also encountering NaN values in your evaluation results, this could be due to JSON parsing issues or non-ideal cases for scoring, such as responses that are not suitable for evaluation. Make sure the model's output is structured correctly and consider upgrading to Ragas version 0.2.9 or later, where some NaN issues have been addressed [3]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
同样问题,解决了吗兄弟 |
[ ] I checked the documentation and related resources and couldn't find an answer to my question.
Your Question
what is unclear to you? What would you like to know?
Code Examples
This community speaks code. Share your code snippets to help us understand your question better.
Additional context
Anything else you want to share with us?
ragas 版本 0.2.14
llm_model="qwen2.5:32b"
llm = OllamaLLM(base_url = "http://xxx/", model=llm_model)
llm = ChatOllama(base_url = "http://xxx/", model=llm_model,max_tokens=160000)
evaluator_llm = LangchainLLMWrapper(llm,run_config)
#测试是否调用成功
response = llm.invoke("讲一个笑话")
print(response)
embed_model="quentinz/bge-large-zh-v1.5:f32"
embeding = OllamaEmbeddings(base_url = "http://xxxx",model=embed_model/)
wrapped_embeddings = LangchainEmbeddingsWrapper(embeding)
测试生成嵌入向量
text = "This is a test sentence."
embed_vector = embeding.embed_query(text)
以上代码测试没有问题
questions = [
"自动化技术与应用专业的入学基本要求?"
]
correct_answers = [
"中等职业学校毕业、普通高级中学毕业或具备同等学力"
]
samples = []
对每个问题进行处理
for question, correct_answer in zip(questions, correct_answers):
res = session.ask(question, stream=True)
存储 AI 给出的最终答案及检索召回的文本片段
final_answer = ""
retrieved_contexts = []
for ans in res:
final_answer = ans.content
if ans.reference is not None:
for ref in ans.reference:
retrieved_contexts.append(ref['content'])
print("final_answer:",final_answer)
print("retrieved_contexts:",retrieved_contexts)
创建 SingleTurnSample 对象
sample = SingleTurnSample(
user_input=question,
retrieved_contexts=retrieved_contexts,
response=final_answer,
reference=correct_answer
)
samples.append(sample)
print("samples")
生成评估数据集
eval_dataset = EvaluationDataset(samples=samples)
print(eval_dataset)
选择评估指标进行评估
from ragas.metrics import LLMContextRecall, Faithfulness, FactualCorrectness, SemanticSimilarity
from ragas import evaluate
metrics = [
LLMContextRecall(llm=evaluator_llm),
FactualCorrectness(llm=evaluator_llm),
Faithfulness(llm=evaluator_llm),
SemanticSimilarity(embeddings=wrapped_embeddings)
]
results = evaluate(dataset=eval_dataset, metrics=metrics)
print(results)
设置显示所有列,打印结果
import pandas as pd
pd.set_option('display.max_columns', None)
print(results.to_pandas())
df = results.to_pandas()
print(df.head())
df.head().to_csv('res.csv', index=False,encoding='utf-8-sig')
Image
评估结果也是NAN 太难受了 排查好几天了 也不知道问题
The text was updated successfully, but these errors were encountered: