Skip to content

Commit

Permalink
Changed the default embedding model to openai. (#1087)
Browse files Browse the repository at this point in the history
* Removed duplicate code in query execution.

* Added nltk download logic to support string metrics.

* Add ragas to imports.

* Added ragas to imports.

* Added string metrics for evaluation.

* Remove dthe unwanted break statement.

* Moves the import to top of file.

* Moved the scorer definitions to the init function.

* Refactoring.

* Removed unused imports.

* Moved async calls to the outer function.

* Refactor to add error handling and change function names.

* Added correctness score to metrics.

* Changed the default embedding model to openai.

* Removed unused imports.

* Removed unused Huggingface embeddings method.
  • Loading branch information
akarshgupta7 authored Dec 27, 2024
1 parent af3c840 commit 5e9b047
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/query-eval/queryeval/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
import asyncio
from ragas.dataset_schema import SingleTurnSample
from ragas.metrics import BleuScore, RougeScore, SemanticSimilarity
from ragas.embeddings.base import HuggingfaceEmbeddings, LangchainEmbeddingsWrapper
from ragas.embeddings.base import (
OpenAIEmbeddings,
LangchainEmbeddingsWrapper,
)
from ragas.metrics._factual_correctness import FactualCorrectness
from langchain_openai.chat_models import ChatOpenAI
from ragas.llms import LangchainLLMWrapper
Expand Down Expand Up @@ -195,7 +198,7 @@ def __init__(
self.rouge_scorer = RougeScore()
self.semantic_similarity_scorer = SemanticSimilarity()
self.semantic_similarity_scorer.embeddings = LangchainEmbeddingsWrapper(
HuggingfaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
OpenAIEmbeddings(model="text-embedding-3-small")
)
self.correctness_scorer = FactualCorrectness()
self.correctness_scorer.llm = LangchainLLMWrapper(ChatOpenAI(model="gpt-4o"))
Expand Down

0 comments on commit 5e9b047

Please sign in to comment.