Skip to content

Commit

Permalink
vertex_location is different between claude and gemini
Browse files Browse the repository at this point in the history
  • Loading branch information
semio committed Sep 21, 2024
1 parent 205c080 commit 8358b67
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

# because all claude models are avaliable in us-east5
VERTEX_LOCATION = "us-east5"


class VertexAIEvaluator(BaseEvaluator):
"""Evaluator using VertexAI's prompt-based evaluation."""
Expand All @@ -48,6 +45,10 @@ class VertexAIEvaluator(BaseEvaluator):
def __init__(self, config: VertexAIEvaluatorConfig):
super().__init__(config)
self.config = config
if "claude" in self.config.model_name:
self.vertex_location = "us-east5"
else:
self.vertex_location = "us-central1"

def evaluate(self, experiment_result: ExperimentResult) -> EvaluatorOutput:
"""Evaluate the experiment result using Vertex AI's prompt-based evaluation."""
Expand All @@ -70,7 +71,7 @@ def evaluate(self, experiment_result: ExperimentResult) -> EvaluatorOutput:
max_tokens=2000,
request_timeout=60,
caching=True,
vertex_ai_location=VERTEX_LOCATION,
vertex_ai_location=self.vertex_location,
vertex_ai_project=os.environ["VERTEXAI_PROJECT"],
)
# response = openai.ChatCompletion.create(
Expand Down Expand Up @@ -114,6 +115,7 @@ def main():
MethodCalculationMethod(MethodCalculationMethod.AVERAGE)
)
],
model_name="gemini-pro-experimental",
prompt=prompt,
choices=choices,
evaluator_type=EvaluatorType.INDIVIDUAL,
Expand Down

0 comments on commit 8358b67

Please sign in to comment.