i'm using livektt agent python version with groq t...
# ask-ai
p
i'm using livektt agent python version with groq text to text i want to give the agent some docs pdf or txt containing my faqs company can you give me example that will work correctly
t
Thanks for reaching out, Yassine. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm glad you're looking to provide your company FAQs in PDF or TXT format to the LiveKit agent using the Python version with Groq text-to-text. A great way to do this is by using Retrieval-Augmented Generation (RAG). Let me walk you through an example implementation:
Copy code
from llama_index.core import SimpleDirectoryReader, VectorStoreIndex

# Load documents
documents = SimpleDirectoryReader(YOUR_DATA_DIR).load_data()
index = VectorStoreIndex.from_documents(documents)

@llm.function_tool
async def query_info(query: str) -> str:
    """Get more information about a specific topic"""
    query_engine = index.as_query_engine(use_async=True)
    res = await query_engine.aquery(query)
    return str(res)
Next, you'll want to add the
query_info
tool to your agent configuration like this:
Copy code
agent = Agent(
    instructions="Your instructions here",
    tools=[query_info],
    llm=groq.LLM()
)
Just remember to replace
YOUR_DATA_DIR
with the path to the directory where your FAQ documents are stored. This setup will enable your agent to effectively query your documents and provide relevant information. If you have any questions or need further assistance, feel free to ask—I'm here to help! Sources: livekit-agents/README.md | README.md