From 919d0f3ecfe826f59ee4c53ed706275b62264818 Mon Sep 17 00:00:00 2001 From: Thomas Capelle Date: Wed, 5 Feb 2025 21:18:23 +0100 Subject: [PATCH] rename the file containing the default models --- tests/scorers/test_similarity_scorer.py | 2 +- weave/scorers/{llm_utils.py => default_models.py} | 2 ++ weave/scorers/guardrails/prompt_injection_guardrail.py | 2 +- weave/scorers/hallucination_scorer.py | 2 +- weave/scorers/moderation_scorer.py | 2 +- weave/scorers/ragas_scorer.py | 2 +- weave/scorers/similarity_scorer.py | 2 +- weave/scorers/summarization_scorer.py | 2 +- 8 files changed, 9 insertions(+), 7 deletions(-) rename weave/scorers/{llm_utils.py => default_models.py} (84%) diff --git a/tests/scorers/test_similarity_scorer.py b/tests/scorers/test_similarity_scorer.py index 0bd3260f8bed..30ef38584d62 100644 --- a/tests/scorers/test_similarity_scorer.py +++ b/tests/scorers/test_similarity_scorer.py @@ -3,7 +3,7 @@ import pytest import weave -from weave.scorers.llm_utils import OPENAI_DEFAULT_EMBEDDING_MODEL +from weave.scorers.default_models import OPENAI_DEFAULT_EMBEDDING_MODEL from weave.scorers.similarity_scorer import ( EmbeddingSimilarityScorer, ) diff --git a/weave/scorers/llm_utils.py b/weave/scorers/default_models.py similarity index 84% rename from weave/scorers/llm_utils.py rename to weave/scorers/default_models.py index 99ee31d1be36..76a366217d62 100644 --- a/weave/scorers/llm_utils.py +++ b/weave/scorers/default_models.py @@ -1,3 +1,5 @@ +"""Default model configurations for different LLM providers.""" + OPENAI_DEFAULT_MODEL = "gpt-4o" OPENAI_DEFAULT_EMBEDDING_MODEL = "text-embedding-3-small" OPENAI_DEFAULT_MODERATION_MODEL = "omni-moderation-latest" diff --git a/weave/scorers/guardrails/prompt_injection_guardrail.py b/weave/scorers/guardrails/prompt_injection_guardrail.py index 7a16ed557ec8..8ea95fafd4d4 100644 --- a/weave/scorers/guardrails/prompt_injection_guardrail.py +++ b/weave/scorers/guardrails/prompt_injection_guardrail.py @@ -4,12 +4,12 @@ from pydantic import BaseModel import weave +from weave.scorers.default_models import OPENAI_DEFAULT_MODEL from weave.scorers.guardrails.prompts import ( PROMPT_INJECTION_GUARDRAIL_SYSTEM_PROMPT, PROMPT_INJECTION_SURVEY_PAPER_SUMMARY, ) from weave.scorers.llm_scorer import LLMScorer -from weave.scorers.llm_utils import OPENAI_DEFAULT_MODEL from weave.scorers.utils import stringify diff --git a/weave/scorers/hallucination_scorer.py b/weave/scorers/hallucination_scorer.py index 8e9e37525cda..f21e4370c546 100644 --- a/weave/scorers/hallucination_scorer.py +++ b/weave/scorers/hallucination_scorer.py @@ -2,8 +2,8 @@ from pydantic import BaseModel, Field import weave +from weave.scorers.default_models import OPENAI_DEFAULT_MODEL from weave.scorers.llm_scorer import LLMScorer -from weave.scorers.llm_utils import OPENAI_DEFAULT_MODEL from weave.scorers.utils import stringify DEFAULT_HALLUCINATION_SYSTEM_PROMPT = """ diff --git a/weave/scorers/moderation_scorer.py b/weave/scorers/moderation_scorer.py index 6c66598e777f..52c56bcdf413 100644 --- a/weave/scorers/moderation_scorer.py +++ b/weave/scorers/moderation_scorer.py @@ -3,7 +3,7 @@ from litellm import amoderation import weave -from weave.scorers.llm_utils import OPENAI_DEFAULT_MODERATION_MODEL +from weave.scorers.default_models import OPENAI_DEFAULT_MODERATION_MODEL class OpenAIModerationScorer(weave.Scorer): diff --git a/weave/scorers/ragas_scorer.py b/weave/scorers/ragas_scorer.py index f077ec655d2b..f7fdb229a523 100644 --- a/weave/scorers/ragas_scorer.py +++ b/weave/scorers/ragas_scorer.py @@ -6,8 +6,8 @@ from pydantic import BaseModel, Field import weave +from weave.scorers.default_models import OPENAI_DEFAULT_MODEL from weave.scorers.llm_scorer import LLMScorer -from weave.scorers.llm_utils import OPENAI_DEFAULT_MODEL class EntityExtractionResponse(BaseModel): diff --git a/weave/scorers/similarity_scorer.py b/weave/scorers/similarity_scorer.py index 6aafa07e108c..6e3e4ff7ef80 100644 --- a/weave/scorers/similarity_scorer.py +++ b/weave/scorers/similarity_scorer.py @@ -6,7 +6,7 @@ from pydantic import Field import weave -from weave.scorers.llm_utils import OPENAI_DEFAULT_EMBEDDING_MODEL +from weave.scorers.default_models import OPENAI_DEFAULT_EMBEDDING_MODEL class EmbeddingSimilarityScorer(weave.Scorer): diff --git a/weave/scorers/summarization_scorer.py b/weave/scorers/summarization_scorer.py index f18072dcb59c..a153c81d4267 100644 --- a/weave/scorers/summarization_scorer.py +++ b/weave/scorers/summarization_scorer.py @@ -5,8 +5,8 @@ from pydantic import BaseModel, Field import weave +from weave.scorers.default_models import OPENAI_DEFAULT_MODEL from weave.scorers.llm_scorer import LLMScorer -from weave.scorers.llm_utils import OPENAI_DEFAULT_MODEL DEFAULT_EXTRACTION_SYSTEM_PROMPT = """ Given a , extract all the unique entities from the text without repetition.