-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: RAG API Server to use Async/Await #835
base: main
Are you sure you want to change the base?
Conversation
please take a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async def health_check():
As we discussed, should we remove async here?
"""Common logic for adding a single document.""" | ||
if index_name not in self.index_map: | ||
raise ValueError(f"No such index: '{index_name}' exists.") | ||
llama_doc = LlamaDocument(text=document.text, metadata=document.metadata, id_=doc_id) | ||
self.index_map[index_name].insert(llama_doc) | ||
await self.index_map[index_name].insert(llama_doc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in-memory operation, right? Do we need await?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this one is not awaitable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is llamaindex insert - llama_index/core/indices/base.py
yes it is not awaitable
def insert(self, document: Document, **insert_kwargs: Any) -> None:
"""Insert a document."""
with self._callback_manager.as_trace("insert"):
nodes = run_transformations(
[document],
self._transformations,
show_progress=self._show_progress,
**insert_kwargs,
)
self.insert_nodes(nodes, **insert_kwargs)
self.docstore.set_document_hash(document.get_doc_id(), document.hash)
…haan/sync-async
Reason for Change:
Endpoints are currently sequentially blocking synchronous. After review we use async-await pattern correctly.