From 0adf1be8df84e26e2ba31cdd9ee71c1cd984fb6f Mon Sep 17 00:00:00 2001
From: Emanuel Ferreira <contatoferreirads@gmail.com>
Date: Sat, 23 Mar 2024 13:57:06 -0300
Subject: [PATCH] fix: _service_context managed index (#12199)

---
 .../llama_index/indices/managed/llama_cloud/base.py          | 5 +++++
 .../llama-index-indices-managed-llama-cloud/pyproject.toml   | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/llama_index/indices/managed/llama_cloud/base.py b/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/llama_index/indices/managed/llama_cloud/base.py
index 25ecd1f31..28daf28d0 100644
--- a/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/llama_index/indices/managed/llama_cloud/base.py
+++ b/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/llama_index/indices/managed/llama_cloud/base.py
@@ -12,6 +12,7 @@ from llama_index_client import PipelineType, ProjectCreate, StatusEnum
 
 from llama_index.core.base.base_query_engine import BaseQueryEngine
 from llama_index.core.base.base_retriever import BaseRetriever
+from llama_index.core.callbacks.base import CallbackManager
 from llama_index.core.constants import DEFAULT_APP_URL, DEFAULT_PROJECT_NAME
 from llama_index.core.indices.managed.base import BaseManagedIndex
 from llama_index.core.ingestion.api_utils import (
@@ -21,6 +22,7 @@ from llama_index.core.ingestion.api_utils import (
     get_pipeline_create,
 )
 from llama_index.core.schema import BaseNode, Document, TransformComponent
+from llama_index.core.settings import Settings
 
 
 class LlamaCloudIndex(BaseManagedIndex):
@@ -37,6 +39,7 @@ class LlamaCloudIndex(BaseManagedIndex):
         base_url: Optional[str] = None,
         app_url: Optional[str] = None,
         show_progress: bool = False,
+        callback_manager: Optional[CallbackManager] = None,
         **kwargs: Any,
     ) -> None:
         """Initialize the Platform Index."""
@@ -56,6 +59,8 @@ class LlamaCloudIndex(BaseManagedIndex):
         self._app_url = app_url
         self._timeout = timeout
         self._show_progress = show_progress
+        self._service_context = None
+        self._callback_manager = callback_manager or Settings.callback_manager
 
     @classmethod
     def from_documents(  # type: ignore
diff --git a/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/pyproject.toml b/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/pyproject.toml
index 4ec183892..02fa362ac 100644
--- a/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/pyproject.toml
+++ b/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/pyproject.toml
@@ -30,7 +30,7 @@ exclude = ["**/BUILD"]
 license = "MIT"
 name = "llama-index-indices-managed-llama-cloud"
 readme = "README.md"
-version = "0.1.4"
+version = "0.1.5"
 
 [tool.poetry.dependencies]
 python = ">=3.8.1,<4.0"
-- 
GitLab