Skip to content

Ragas using llamaindexย #1245

@Senthselvi

Description

@Senthselvi

Evaluation failed: 'CustomOllama' object has no attribute 'set_run_config', what is the solution,

Ragas Version: 0.1.7

Code Examples

Define a simple dataset using Pandas DataFrame

data = {
'question': ['When was the first super bowl?', 'Who won the most super bowls?'],
'answer': ['The first superbowl was held on Jan 15, 1967', 'The most super bowls have been won by The New England Patriots'],
'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,'],
['The Green Bay Packers...Green Bay, Wisconsin.','The Packers compete...Football Conference']],
'ground_truth': ['The first superbowl was held on January 15, 1967', 'The New England Patriots have won the Super Bowl a record six times']
}

def evaluate_chat_performance(data, llm, embedding_model):
dataset = Dataset.from_dict(data)
print("Dataset preview:", dataset)

df = pd.DataFrame(data)

if "ground_truth" not in dataset.column_names:
    dataset = dataset.add_column(
        name="ground_truth",
        column=dataset["ground_truth"],
        new_fingerprint=str(uuid4()),
    )

print("Dataset after adding ground_truth:", dataset)

metrics = [
    faithfulness,context_precision,answer_relevancy,
    # Using AnswerRelevancy instance
]


try:
    results = evaluate(
        dataset=dataset,
        metrics=metrics,
        llm=llm,
        embeddings=embedding_model,
        raise_exceptions=False,
    
    )
except Exception as e:
    print("Evaluation failed:", e)
    return

print(results.to_pandas())
results.to_pandas().to_csv(r'C:\TestingBot\Scripts\V1\myfile.csv', sep=',')
return results

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requestedstaleIssue has not had recent activity or appears to be solved. Stale issues will be automatically closed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions