Skip to content

Commit

Permalink
Code clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
eli64s committed Mar 1, 2024
1 parent c13817d commit 52bc083
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions readmeai/models/vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
from readmeai.models.tokens import token_handler
from readmeai.utils.text_cleaner import clean_response

_location = os.environ.get("VERTEXAI_LOCATION")
_project_id = os.environ.get("VERTEXAI_PROJECT")
vertexai.init(location=_location, project=_project_id)


class VertexAIHandler(BaseModelHandler):
"""Google Cloud Vertex AI LLM API implementation."""
Expand All @@ -35,10 +31,13 @@ def __init__(self, config_loader: ConfigLoader) -> None:

def _model_settings(self):
"""Initializes the Vertex AI LLM settings."""
self.model = GenerativeModel(self.config.llm.model)
self.temperature = self.config.llm.temperature
self.tokens = self.config.llm.tokens
self.top_p = self.config.llm.top_p
self.location = os.environ.get("VERTEXAI_LOCATION")
self.project_id = os.environ.get("VERTEXAI_PROJECT")
vertexai.init(location=self.location, project=self.project_id)
self.model = GenerativeModel(self.config.llm.model)

async def _build_payload(
self, prompt: str, tokens: int
Expand Down

0 comments on commit 52bc083

Please sign in to comment.