Skip to content

After upgrading the version from 0.2.15 to 0.3.6, there was an error message displayed. #2351

@jietang00723-cloud

Description

@jietang00723-cloud

[ ] I checked the documentation and related resources and couldn't find an answer to my question.

Your Question
After upgrading my ragas version from 0.2.15 to 0.3.6, I encountered an error message. As follows: LM returned 1 generations instead of requested 3. Proceeding with 1 generations. What should I do?
Code Examples

创建LLM实例

llm = ChatOpenAI(
    api_key=openai_api_key,
    base_url=openai_api_base,
    model="deepseek-chat",
    logprobs=True
)




# 构建评估数据集
eval_data = {
    'user_input': [
        '人工智能的三个主要分支是什么?',
        '什么是向量数据库?它在RAG系统中有什么作用?',
        '解释一下大语言模型的微调过程'
    ],
    'retrieved_contexts': [
        ['人工智能主要包括机器学习、深度学习、自然语言处理和计算机视觉等领域。'],
        ['向量数据库是专门用于向量数据存储和检索的系统。在RAG应用中,向量数据库存储文档嵌入,通过计算相似度快速找到匹配查询的文档。'],
        ['大语言模型微调是在已预训练的模型基础上,使用特定数据集进行额外训练的过程,目的是使模型适应特定任务或领域。']
    ],
    'response': [
        '人工智能的三个主要分支是机器学习、深度学习和自然语言处理。',
        '向量数据库是专门存储和检索向量嵌入的数据库系统,在RAG系统中用于高效地检索语义相似的文档。',
        '大语言模型的微调是在预训练模型的基础上,使用特定任务的数据进一步训练模型的过程。'
    ],
    'reference': [
        '人工智能的三个主要分支是机器学习、自然语言处理和计算机视觉。',
        '向量数据库是专门设计用于存储和检索向量嵌入的数据库系统。在RAG系统中,它用于存储文档的向量表示,并通过相似性搜索快速检索与查询最相关的文档。',
        '大语言模型的微调是一个过程,其中预训练的基础模型使用特定领域或任务的数据进行额外训练,以优化其在特定应用场景的性能。'
    ],
    
}
comprehensive_dataset = Dataset.from_dict(eval_data)


from ragas.metrics import (
    context_recall,
    context_precision,
    answer_correctness,
    answer_similarity,
    answer_relevancy,
    faithfulness
)

# 定义评估指标
metrics = [
    faithfulness,
    answer_relevancy,
    answer_similarity,
    answer_correctness,
    context_precision,
    context_recall,

]

# 综合评估
comprehensive_score = evaluate(
    comprehensive_dataset,
    metrics=metrics,
    llm=llm,
    embeddings=embeddings
    # embeddings=jina_embedding
)
# 结果分析
result_df = comprehensive_score.to_pandas()

Additional context
After upgrading the version from 0.2.15 to 0.3.6, there was an error message displayed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmodule-metricsthis is part of metrics modulequestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions