From ada5dec05ab45e949b1602742c50f0d81fd6ee94 Mon Sep 17 00:00:00 2001 From: Logan Markewich Date: Mon, 23 Dec 2024 10:45:00 -0600 Subject: [PATCH] use asyncio_run --- .../llama_index/vector_stores/opensearch/base.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py b/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py index 7c56873b9bca9..3acb9291c2aab 100644 --- a/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py +++ b/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py @@ -3,9 +3,9 @@ import uuid from datetime import datetime from typing import Any, Dict, Iterable, List, Optional, Union, cast -import asyncio -from llama_index.core.bridge.pydantic import PrivateAttr +from llama_index.core.async_utils import asyncio_run +from llama_index.core.bridge.pydantic import PrivateAttr from llama_index.core.schema import BaseNode, MetadataMode, TextNode from llama_index.core.vector_stores.types import ( FilterCondition, @@ -131,14 +131,14 @@ def __init__( except TypeError: # Probably using async so switch to async client try: - asyncio.run(self._os_async_client.indices.get(index=self._index)) + asyncio_run(self._os_async_client.indices.get(index=self._index)) except not_found_error: - asyncio.run( + asyncio_run( self._os_async_client.indices.create( index=self._index, body=idx_conf ) ) - asyncio.run(self._os_async_client.indices.refresh(index=self._index)) + asyncio_run(self._os_async_client.indices.refresh(index=self._index)) except not_found_error: self._os_client.indices.create(index=self._index, body=idx_conf) self._os_client.indices.refresh(index=self._index)