#C088ZNU7QQ5 problem with _speak_status_update, function not working even after following the guidelines
please check what is the problem
@function_tool
async def kroolo_docs_search(self, context: RunContext, query: str) -> str:
"""Retrieve information about Kroolo using Pinecone and OpenAI embeddings."""
# Generate embedding for the query using OpenAI
async def _speak_status_update(delay: float = 1.0):
await asyncio.sleep(delay)
await context.session.generate_reply(instructions=f"""
You are searching the knowledge base for \"{query}\" but it is taking a little while.
Update the user on your progress, but be very brief.
""")
status_update_task = asyncio.create_task(_speak_status_update(1.0))
loop = asyncio.get_event_loop()
def embed_sync():
response = self._client.embeddings.create(
input=query,
model=self._embedding_model
)
return response.data[0].embedding
query_embedding = await loop.run_in_executor(None, embed_sync)
# Query Pinecone for similar documents
pinecone_result = self._index.query(
vector=query_embedding,
top_k=5,
include_metadata=True,
namespace=self._namespace
)
status_update_task.cancel()
return str(pinecone_result)