build: fix mypy build issues

This commit is contained in:
Krrish Dholakia 2024-03-21 08:27:23 -07:00
parent 8e8c4e214e
commit 84a540f2d6
5 changed files with 18 additions and 18 deletions

View file

@ -16,11 +16,11 @@ repos:
name: Check if files match name: Check if files match
entry: python3 ci_cd/check_files_match.py entry: python3 ci_cd/check_files_match.py
language: system language: system
# - repo: local - repo: local
# hooks: hooks:
# - id: mypy - id: mypy
# name: mypy name: mypy
# entry: python3 -m mypy --ignore-missing-imports entry: python3 -m mypy --ignore-missing-imports
# language: system language: system
# types: [python] types: [python]
# files: ^litellm/ files: ^litellm/

View file

@ -118,7 +118,7 @@ def completion(
logger_fn=None, logger_fn=None,
): ):
try: try:
import google.generativeai as genai import google.generativeai as genai # type: ignore
except: except:
raise Exception( raise Exception(
"Importing google.generativeai failed, please run 'pip install -q google-generativeai" "Importing google.generativeai failed, please run 'pip install -q google-generativeai"
@ -308,7 +308,7 @@ async def async_completion(
messages, messages,
encoding, encoding,
): ):
import google.generativeai as genai import google.generativeai as genai # type: ignore
response = await _model.generate_content_async( response = await _model.generate_content_async(
contents=prompt, contents=prompt,

View file

@ -98,7 +98,7 @@ def completion(
logger_fn=None, logger_fn=None,
): ):
try: try:
import google.generativeai as palm import google.generativeai as palm # type: ignore
except: except:
raise Exception( raise Exception(
"Importing google.generativeai failed, please run 'pip install -q google-generativeai" "Importing google.generativeai failed, please run 'pip install -q google-generativeai"

View file

@ -923,7 +923,7 @@ def gemini_text_image_pt(messages: list):
} }
""" """
try: try:
import google.generativeai as genai import google.generativeai as genai # type: ignore
except: except:
raise Exception( raise Exception(
"Importing google.generativeai failed, please run 'pip install -q google-generativeai" "Importing google.generativeai failed, please run 'pip install -q google-generativeai"

View file

@ -289,11 +289,11 @@ def completion(
Part, Part,
GenerationConfig, GenerationConfig,
) )
from google.cloud import aiplatform from google.cloud import aiplatform # type: ignore
from google.protobuf import json_format # type: ignore from google.protobuf import json_format # type: ignore
from google.protobuf.struct_pb2 import Value # type: ignore from google.protobuf.struct_pb2 import Value # type: ignore
from google.cloud.aiplatform_v1beta1.types import content as gapic_content_types from google.cloud.aiplatform_v1beta1.types import content as gapic_content_types # type: ignore
import google.auth import google.auth # type: ignore
## Load credentials with the correct quota project ref: https://github.com/googleapis/python-aiplatform/issues/2557#issuecomment-1709284744 ## Load credentials with the correct quota project ref: https://github.com/googleapis/python-aiplatform/issues/2557#issuecomment-1709284744
print_verbose( print_verbose(
@ -783,7 +783,7 @@ async def async_completion(
""" """
Vertex AI Model Garden Vertex AI Model Garden
""" """
from google.cloud import aiplatform from google.cloud import aiplatform # type: ignore
## LOGGING ## LOGGING
logging_obj.pre_call( logging_obj.pre_call(
@ -969,7 +969,7 @@ async def async_streaming(
) )
response = llm_model.predict_streaming_async(prompt, **optional_params) response = llm_model.predict_streaming_async(prompt, **optional_params)
elif mode == "custom": elif mode == "custom":
from google.cloud import aiplatform from google.cloud import aiplatform # type: ignore
stream = optional_params.pop("stream", None) stream = optional_params.pop("stream", None)
@ -1059,7 +1059,7 @@ def embedding(
) )
from vertexai.language_models import TextEmbeddingModel from vertexai.language_models import TextEmbeddingModel
import google.auth import google.auth # type: ignore
## Load credentials with the correct quota project ref: https://github.com/googleapis/python-aiplatform/issues/2557#issuecomment-1709284744 ## Load credentials with the correct quota project ref: https://github.com/googleapis/python-aiplatform/issues/2557#issuecomment-1709284744
try: try: