Skip to content

Get an error 'Invalid n value (currently only n = 1 is supported)' when calculating the score of metric named 'answer_relevancy' #1432

@francescofan

Description

@francescofan

[ ] I have checked the documentation and related resources and couldn't resolve my bug.

Describe the bug
Error message is "Invalid n value (currently only n = 1 is supported)".

Ragas version: 0.1.20
Python version: 3.11.9
Python Environment: Anaconda 3
LLM: Deepseek v2.0
System: Windows 10 Enterprise
Develop Env:Visual Studio Code 1.85.0

Code to Reproduce

deepseek_llm = ChatOpenAI(
    model = model,
    openai_api_key = api_key,
    openai_api_base = base_url
)
embeddings = MyCustomEmbeddings("http://customized.embedding")
data= {
'question': ['When was the first super bowl?'],
'answer': ['The first superbowl was held on Jan 15, 1967'],
'contexts' : [['The First AFL–NFL World Championship Game was an American football game played on January 15, 1967, at the Los Angeles Memorial Coliseum in Los Angeles,']],
'ground_truth': ['The first superbowl was held on January 15, 1967']
}
dataset = Dataset.from_dict(data)
score = evaluate(dataset,metrics=[faithfulness,context_recall,context_precision,answer_correctness,answer_similarity,answer_relevancy],llm=deepseek_llm,embeddings=embeddings)

Error trace
xception raised in Job[5]: BadRequestError(Error code: 400 - {'error': {'message': 'Invalid n value (currently only n = 1 is supported)', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}})

Expected behavior
get the score of answer_relevancy with no error

Additional context
'answer_relevancy': nan when i use llm=deepseek_llm,embeddings=embeddings
but 'answer_relevancy': 0.980756386361107 when i use OpenAI LLM and Embedding.

Is there any difference between OpenAI and Deepseek API or anything else. Multiple Completions abilities? How can confirm it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions