4747
4848from langchain_vectorize .retrievers import VectorizeRetriever
4949
50+ logger = logging .getLogger (__name__ )
51+
5052
5153@pytest .fixture (scope = "session" )
5254def api_token () -> str :
@@ -69,7 +71,7 @@ def org_id() -> str:
6971@pytest .fixture (scope = "session" )
7072def environment () -> Literal ["prod" , "dev" , "local" , "staging" ]:
7173 env = os .getenv ("VECTORIZE_ENV" , "prod" )
72- if env not in [ "prod" , "dev" , "local" , "staging" ] :
74+ if env not in { "prod" , "dev" , "local" , "staging" } :
7375 msg = "Invalid VECTORIZE_ENV environment variable."
7476 raise ValueError (msg )
7577 return env # type: ignore[return-value]
@@ -108,7 +110,7 @@ def pipeline_id(api_client: ApiClient, org_id: str) -> Iterator[str]:
108110 CreateSourceConnectorRequest (FileUpload (name = "from api" , type = "FILE_UPLOAD" )),
109111 )
110112 source_connector_id = response .connector .id
111- logging .info ("Created source connector %s" , source_connector_id )
113+ logger .info ("Created source connector %s" , source_connector_id )
112114
113115 uploads_api = UploadsApi (api_client )
114116 upload_response = uploads_api .start_file_upload_to_connector (
@@ -139,23 +141,23 @@ def pipeline_id(api_client: ApiClient, org_id: str) -> Iterator[str]:
139141 msg = "Upload failed:"
140142 raise ValueError (msg )
141143 else :
142- logging .info ("Upload successful" )
144+ logger .info ("Upload successful" )
143145
144146 ai_platforms = AIPlatformConnectorsApi (api_client ).get_ai_platform_connectors (
145147 org_id
146148 )
147149 builtin_ai_platform = next (
148150 c .id for c in ai_platforms .ai_platform_connectors if c .type == "VECTORIZE"
149151 )
150- logging .info ("Using AI platform %s" , builtin_ai_platform )
152+ logger .info ("Using AI platform %s" , builtin_ai_platform )
151153
152154 vector_databases = DestinationConnectorsApi (api_client ).get_destination_connectors (
153155 org_id
154156 )
155157 builtin_vector_db = next (
156158 c .id for c in vector_databases .destination_connectors if c .type == "VECTORIZE"
157159 )
158- logging .info ("Using destination connector %s" , builtin_vector_db )
160+ logger .info ("Using destination connector %s" , builtin_vector_db )
159161
160162 pipeline_response = pipelines .create_pipeline (
161163 org_id ,
@@ -182,14 +184,14 @@ def pipeline_id(api_client: ApiClient, org_id: str) -> Iterator[str]:
182184 ),
183185 )
184186 pipeline_id = pipeline_response .data .id
185- logging .info ("Created pipeline %s" , pipeline_id )
187+ logger .info ("Created pipeline %s" , pipeline_id )
186188
187189 yield pipeline_id
188190
189191 try :
190192 pipelines .delete_pipeline (org_id , pipeline_id )
191193 except Exception :
192- logging .exception ("Failed to delete pipeline %s" , pipeline_id )
194+ logger .exception ("Failed to delete pipeline %s" , pipeline_id )
193195
194196
195197def test_retrieve_init_args (
0 commit comments