build: fix astra integration tests (#3518)
This commit is contained in:
parent
f4e96b113e
commit
75520729de
3 changed files with 33 additions and 90 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
from typing import List
|
||||
|
||||
from astrapy.admin import parse_api_endpoint
|
||||
from langflow.field_typing import Embeddings
|
||||
|
||||
|
||||
|
|
@ -17,6 +18,22 @@ def check_env_vars(*vars):
|
|||
return all(os.getenv(var) for var in vars)
|
||||
|
||||
|
||||
def valid_nvidia_vectorize_region(api_endpoint: str) -> bool:
|
||||
"""
|
||||
Check if the specified region is valid.
|
||||
|
||||
Args:
|
||||
region (str): The region to check.
|
||||
|
||||
Returns:
|
||||
bool: True if the region is contains hosted nvidia models, False otherwise.
|
||||
"""
|
||||
parsed_endpoint = parse_api_endpoint(api_endpoint)
|
||||
if not parsed_endpoint:
|
||||
raise ValueError("Invalid ASTRA_DB_API_ENDPOINT")
|
||||
return parsed_endpoint.region in ["us-east-2"]
|
||||
|
||||
|
||||
class MockEmbeddings(Embeddings):
|
||||
def __init__(self):
|
||||
self.embedded_documents = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue