From e8edd4872bdeb173bea2726266ffe3702be17164 Mon Sep 17 00:00:00 2001 From: SHIVAM <93383164+ShivamGoyal03@users.noreply.github.com> Date: Wed, 19 Feb 2025 14:24:19 +0530 Subject: [PATCH 1/6] Added 05 Autogen NB --- 05-agentic-rag/code_samples/05-autogen.ipynb | 458 +++++++++++++++++++ 1 file changed, 458 insertions(+) create mode 100644 05-agentic-rag/code_samples/05-autogen.ipynb diff --git a/05-agentic-rag/code_samples/05-autogen.ipynb b/05-agentic-rag/code_samples/05-autogen.ipynb new file mode 100644 index 00000000..3dc293db --- /dev/null +++ b/05-agentic-rag/code_samples/05-autogen.ipynb @@ -0,0 +1,458 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Agentic RAG with Autogen\n", + "\n", + "This notebook demonstrates implementing Retrieval-Augmented Generation (RAG) using Autogen agents with enhanced evaluation capabilities." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Make sure to run this cell before running the rest of the notebook\n", + "!pip install chromadb" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from typing import List, Dict\n", + "import time\n", + "import os\n", + "from autogen_agentchat.agents import AssistantAgent\n", + "from autogen_core.models import UserMessage\n", + "from autogen_core import CancellationToken\n", + "from autogen_agentchat.messages import TextMessage\n", + "from azure.core.credentials import AzureKeyCredential\n", + "from autogen_ext.models.azure import AzureAIChatCompletionClient\n", + "import chromadb\n", + "import asyncio" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Create the Client \n", + "\n", + "First, we initialize the Azure AI Chat Completion Client. This client will be used to interact with the Azure OpenAI service to generate responses to user queries." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finish_reason='stop' content='The capital of France is Paris.' usage=RequestUsage(prompt_tokens=14, completion_tokens=7) cached=False logprobs=None thought=None\n" + ] + } + ], + "source": [ + "client = AzureAIChatCompletionClient(\n", + " model=\"gpt-4o-mini\",\n", + " endpoint=\"https://models.inference.ai.azure.com\",\n", + " credential=AzureKeyCredential(os.environ[\"GITHUB_TOKEN\"]),\n", + " model_info={\n", + " \"json_output\": True,\n", + " \"function_calling\": True,\n", + " \"vision\": True,\n", + " \"family\": \"unknown\",\n", + " },\n", + ")\n", + "result = await client.create([UserMessage(content=\"What is the capital of France?\", source=\"user\")])\n", + "print(result)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Initialize Assistant Agent\n", + "\n", + "Next, we create an instance of the `AssistantAgent`. This agent will use the Azure AI Chat Completion Client to generate responses to user queries." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "assistant = AssistantAgent(\n", + " name=\"assistant\",\n", + " model_client=client,\n", + " system_message=\"You are a helpful assistant.\",\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Vector Database Initialization\n", + "\n", + "We initialize ChromaDB with persistent storage and add enhanced sample documents. ChromaDB will be used to store and retrieve documents that provide context for generating accurate responses." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Add of existing embedding ID: doc_0\n", + "Add of existing embedding ID: doc_1\n", + "Add of existing embedding ID: doc_2\n", + "Add of existing embedding ID: doc_3\n", + "Add of existing embedding ID: doc_4\n", + "Add of existing embedding ID: doc_0\n", + "Add of existing embedding ID: doc_1\n", + "Add of existing embedding ID: doc_2\n", + "Add of existing embedding ID: doc_3\n", + "Add of existing embedding ID: doc_4\n", + "Add of existing embedding ID: doc_0\n", + "Add of existing embedding ID: doc_1\n", + "Add of existing embedding ID: doc_2\n", + "Add of existing embedding ID: doc_3\n", + "Add of existing embedding ID: doc_4\n", + "Add of existing embedding ID: doc_0\n", + "Add of existing embedding ID: doc_1\n", + "Add of existing embedding ID: doc_2\n", + "Add of existing embedding ID: doc_3\n", + "Add of existing embedding ID: doc_4\n", + "Add of existing embedding ID: doc_0\n", + "Add of existing embedding ID: doc_1\n", + "Add of existing embedding ID: doc_2\n", + "Add of existing embedding ID: doc_3\n", + "Add of existing embedding ID: doc_4\n", + "Add of existing embedding ID: doc_0\n", + "Add of existing embedding ID: doc_1\n", + "Add of existing embedding ID: doc_2\n", + "Add of existing embedding ID: doc_3\n", + "Add of existing embedding ID: doc_4\n", + "Add of existing embedding ID: doc_0\n", + "Add of existing embedding ID: doc_1\n", + "Add of existing embedding ID: doc_2\n", + "Add of existing embedding ID: doc_3\n", + "Add of existing embedding ID: doc_4\n", + "Insert of existing embedding ID: doc_0\n", + "Insert of existing embedding ID: doc_1\n", + "Insert of existing embedding ID: doc_2\n", + "Insert of existing embedding ID: doc_3\n", + "Insert of existing embedding ID: doc_4\n" + ] + } + ], + "source": [ + "# Initialize ChromaDB with persistent storage\n", + "chroma_client = chromadb.PersistentClient(path=\"./chroma_db\")\n", + "collection = chroma_client.create_collection(\n", + " name=\"documents\",\n", + " metadata={\"description\": \"RAG documentation\"},\n", + " get_or_create=True\n", + ")\n", + "\n", + "# Enhanced sample documents\n", + "documents = [\n", + " \"RAG combines retrieval with generative AI for accurate responses.\",\n", + " \"Key features of RAG include document indexing and contextual generation.\",\n", + " \"RAG helps reduce hallucinations by grounding responses in source documents.\",\n", + " \"RAG systems use vector embeddings to find relevant context.\",\n", + " \"The retrieval component ensures factual accuracy in responses.\"\n", + "]\n", + "\n", + "# Add documents with metadata\n", + "collection.add(\n", + " documents=documents,\n", + " ids=[f\"doc_{i}\" for i in range(len(documents))],\n", + " metadatas=[{\"source\": \"training\", \"type\": \"explanation\"} for _ in documents]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Agent Configuration\n", + "\n", + "We configure the retrieval and assistant agents. The retrieval agent is specialized in finding relevant information using semantic search, while the assistant generates detailed responses based on the retrieved information." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "# Create agents with enhanced capabilities\n", + "retrieval_agent = AssistantAgent(\n", + " name=\"retrieval_agent\",\n", + " model_client=client,\n", + " system_message=\"\"\"I am a retrieval agent specialized in finding relevant information.\n", + " I use semantic search to find the most pertinent context for queries.\"\"\",\n", + ")\n", + "\n", + "assistant = AssistantAgent(\n", + " name=\"assistant\",\n", + " system_message=\"\"\"I am an AI assistant that generates detailed responses based on retrieved information.\n", + " I cite sources and explain my reasoning process.\"\"\",\n", + " model_client=client,\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## RAGEvaluator Class\n", + "\n", + "We define the `RAGEvaluator` class to evaluate the response based on various metrics like response length, source citations, response time, and context relevance." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "class RAGEvaluator:\n", + " def __init__(self):\n", + " self.responses = []\n", + " self.metrics = {}\n", + " \n", + " def evaluate_response(self, query: str, response: str, context: List[str]) -> Dict:\n", + " # Calculate response time\n", + " start_time = time.time()\n", + " \n", + " metrics = {\n", + " 'response_length': len(response),\n", + " 'source_citations': sum(1 for doc in context if doc in response),\n", + " 'response_time': time.time() - start_time,\n", + " 'context_relevance': self._calculate_relevance(query, context)\n", + " }\n", + " \n", + " self.responses.append({\n", + " 'query': query,\n", + " 'response': response,\n", + " 'metrics': metrics\n", + " })\n", + " \n", + " return metrics\n", + " \n", + " def _calculate_relevance(self, query: str, context: List[str]) -> float:\n", + " # Simple relevance scoring\n", + " return sum(1 for c in context if query.lower() in c.lower()) / len(context)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Query Processing with RAG\n", + "\n", + "We define the `ask_rag` function to send the query to the assistant, process the response, and evaluate it. This function handles the interaction with the assistant and uses the evaluator to measure the quality of the response." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "async def ask_rag(query: str, evaluator: RAGEvaluator):\n", + " try:\n", + " # Get response with timing\n", + " start_time = time.time()\n", + " response = await assistant.on_messages(\n", + " [TextMessage(content=query, source=\"user\")],\n", + " cancellation_token=CancellationToken(),\n", + " )\n", + " processing_time = time.time() - start_time\n", + " \n", + " # Evaluate response\n", + " metrics = evaluator.evaluate_response(\n", + " query=query,\n", + " response=response.chat_message.content,\n", + " context=documents\n", + " )\n", + " \n", + " return {\n", + " 'response': response.chat_message.content,\n", + " }\n", + " except Exception as e:\n", + " print(f\"Error processing query: {e}\")\n", + " return None" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example usage\n", + "\n", + "We initialize the evaluator and define the queries that we want to process and evaluate." + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "evaluator = RAGEvaluator()\n", + "queries = [\n", + " \"What are the key features of RAG?\",\n", + " \"How does RAG improve response accuracy?\",\n", + " \"Explain the retrieval process in RAG\"\n", + "]" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "async def main():\n", + " for query in queries:\n", + " print(f\"\\nProcessing Query: {query}\")\n", + " result = await ask_rag(query, evaluator)\n", + " if result:\n", + " print(f\"Response: {result['response']}\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Run the Script\n", + "\n", + "We check if the script is running in an interactive environment or a standard script, and run the main function accordingly." + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Processing Query: What are the key features of RAG?\n", + "Response: RAG, or Retrieval-Augmented Generation, is a model architecture that combines the strengths of information retrieval and generative language models. Here are some key features of RAG:\n", + "\n", + "1. **Dual Components**: RAG integrates two main components: a retriever and a generator. The retriever fetches relevant documents or pieces of information from a knowledge base, while the generator produces human-like text based on the retrieved information.\n", + "\n", + "2. **Retrieval-Augmented Generation**: The generator uses the documents retrieved by the retriever to inform its responses, effectively enhancing the model's ability to provide accurate and contextually relevant answers.\n", + "\n", + "3. **End-to-End Training**: RAG models allow for joint training, where both the retriever and generator can be tuned together. This approach helps optimize the interaction between the two components for improved performance.\n", + "\n", + "4. **Flexible Knowledge Sources**: RAG can utilize various external knowledge sources, such as databases or document collections, making it adaptable for different applications. This allows it to pull in current and diverse information, thus staying relevant and informed.\n", + "\n", + "5. **Scalability**: RAG architectures can retrieve from large data stores efficiently. The use of techniques like dense embeddings allows the retriever to quickly find relevant documents even in extensive datasets.\n", + "\n", + "6. **Applications**: RAG is particularly useful in applications requiring up-to-date knowledge, such as question answering, conversational agents, and content creation, where the information landscape is constantly evolving.\n", + "\n", + "7. **Masking and Generation**: The generator can take a masked input (like specific placeholders indicating where information is needed) along with retrieved documents to create coherent and contextually accurate outputs.\n", + "\n", + "8. **Performance**: RAG models tend to outperform traditional generative models when it comes to fact-based questions and tasks, as they leverage the additional information retrieved from external sources.\n", + "\n", + "These features help RAG effectively bridge the gap between static knowledge representation in traditional language models and the dynamic, content-driven needs of real-world applications. For further details on RAG's architecture and implications, refer to the original implementation published by Facebook AI Research (FAIR) in January 2020.\n", + "\n", + "Processing Query: How does RAG improve response accuracy?\n", + "Response: Retrieval-Augmented Generation (RAG) improves response accuracy in several key ways:\n", + "\n", + "1. **Utilization of External Knowledge**: By integrating a retrieval mechanism, RAG can pull in up-to-date and contextually relevant information from external documents or databases. This is particularly important for tasks requiring specific knowledge, as traditional generative models are limited to their training data, which may become outdated or lack specificity.\n", + "\n", + "2. **Contextual Relevance**: The retriever fetches documents that are closely related to the user query, ensuring the generator has access to pertinent information. This helps the model produce responses that are directly relevant to the inquiry, thereby enhancing accuracy.\n", + "\n", + "3. **Reduction of Hallucination**: Standard language models sometimes generate plausible-sounding yet factually incorrect statements, a phenomenon known as \"hallucination.\" By grounding the generation process in retrieved content, RAG reduces the chance of hallucinations, as the generated responses are directly tied to concrete information sources.\n", + "\n", + "4. **Improved Fact Recall**: RAG’s architecture allows for the generation to incorporate factual data directly from retrieved sources, which enhances the ability to recall specific information accurately. The generator modifies and contextualizes this information for human-like responses.\n", + "\n", + "5. **Joint Training**: In RAG, both the retriever and generator can be jointly trained. This means that the retriever can learn to prioritize the most useful documents for the specific kinds of questions the generator will encounter, optimizing their interaction and improving overall response quality.\n", + "\n", + "6. **Clarification and Specificity**: When responding to complex queries, the generator can refer to multiple retrieved documents, allowing it to synthesize information from various sources to create a more comprehensive and specific response.\n", + "\n", + "7. **Scalability with Diverse Data**: RAG can be scaled to work with large datasets, which translates to accessing a broader range of knowledge. This ensures that responses can cover a wider scope of topics and are anchored in more intricate and varied information, leading to better-informed outputs.\n", + "\n", + "8. **User Feedback and Continuous Learning**: RAG systems can be designed to incorporate user feedback to improve retrieval effectiveness continually. For example, if users indicate that certain types of responses are more accurate or relevant, the system can refine its retrieval strategies over time.\n", + "\n", + "Overall, RAG’s architecture allows it to leverage a combination of real-time information retrieval and sophisticated language generation, leading to improved accuracy, relevance, and user experience in generated responses. This framework not only addresses the limitations found in traditional generative models but also enhances their capabilities in managing dynamic and context-dependent queries.\n", + "\n", + "Processing Query: Explain the retrieval process in RAG\n", + "Response: The retrieval process in Retrieval-Augmented Generation (RAG) is a critical component that involves finding and selecting relevant documents or pieces of information from a knowledge base or external dataset, which will then be used to inform the generative model's response. Here’s a detailed breakdown of the retrieval process in RAG:\n", + "\n", + "1. **Input Processing**: The retrieval process begins when a user query or input text is received. This query may include intent information or context that helps indicate what kind of information is needed.\n", + "\n", + "2. **Query Representation**: The input query is transformed into a vector representation. This is typically done through embedding techniques using models like BERT or other transformer-based models. The embedding captures the semantic meaning of the query in a form that can be compared to the stored documents or knowledge.\n", + "\n", + "3. **Document Indexing**: Prior to retrieval, the documents available in the knowledge base are indexed. This involves converting each document into a vector representation, similar to how the input query is represented. Depending on the implementation, this may be done using dense vector embeddings or more traditional keyword-based methods.\n", + "\n", + "4. **Retrieval Mechanism**: The next step involves comparing the query vector against the indexed document vectors to identify the most relevant documents. Common approaches to this include:\n", + " - **Nearest Neighbor Search**: This can be performed using algorithms like FAISS (Facebook AI Similarity Search) or Annoy (Approximate Nearest Neighbors Oh Yeah), which efficiently retrieve documents that are closest to the input query in the vector space.\n", + " - **Cosine Similarity**: A common similarity measure used to determine how closely related the document vectors are to the query vector. Higher similarity scores indicate greater relevance.\n", + "\n", + "5. **Ranking the Results**: The retrieved documents are ranked based on their similarity scores relative to the query. The highest-ranking documents are selected for further processing. This ranking helps to ensure that the most contextually relevant information is provided to the generator.\n", + "\n", + "6. **Return Top-k Documents**: A predefined number (k) of top documents are returned to the generative model. The value of k can vary based on the application, but it typically ranges from a few relevant documents to potentially dozens, depending on how much context the model might need.\n", + "\n", + "7. **Contextual Fusion**: Once the relevant documents are retrieved, they are passed on to the generation component. The generator uses these documents to inform and enhance the output. The documents can be used in a few ways, such as directly quoting, summarizing, or integrating information to construct a coherent response.\n", + "\n", + "8. **Feedback Loop (optional)**: Some implementations of RAG include mechanisms for learning from user interactions, allowing for continuous improvement of the retrieval portion of the system. This may involve re-evaluating the effectiveness of retrieved documents or refining the embedding process based on user feedback.\n", + "\n", + "By ensuring that the generator has access to specific and relevant information through this structured retrieval process, RAG improves the accuracy and relevance of the responses it generates. The combination of effective input processing, robust indexing, and advanced ranking techniques forms the backbone of the successful retrieval operation in RAG models.\n" + ] + } + ], + "source": [ + "if __name__ == \"__main__\":\n", + " if asyncio.get_event_loop().is_running():\n", + " # Running in an interactive environment, use await main()\n", + " await main()\n", + " else:\n", + " # Running in a standard script, use asyncio.run()\n", + " asyncio.run(main())" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.4" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} From b1847726cbb9ffaa46f34d8f3e9a6573732149b4 Mon Sep 17 00:00:00 2001 From: SHIVAM <93383164+ShivamGoyal03@users.noreply.github.com> Date: Wed, 19 Feb 2025 14:28:42 +0530 Subject: [PATCH 2/6] Update README.md --- 00-course-setup/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/00-course-setup/README.md b/00-course-setup/README.md index 5f810114..4b8f2f79 100644 --- a/00-course-setup/README.md +++ b/00-course-setup/README.md @@ -13,7 +13,7 @@ This lesson will cover how to run the code samples of this course. To begin, please clone or fork the GitHub Repository. This will make your own version of the course material so that you can run, test and tweak the code! -This can be done by clicking link to [fork the repo](https://github.com/microsoft/ai-agents-for-beginners/fork){target="_blank"}. +This can be done by clicking link to fork the repo You should now have your own forked version of this course in the following link: From 9210112166bca904fa3d2e1a8e7685336c859ede Mon Sep 17 00:00:00 2001 From: SHIVAM <93383164+ShivamGoyal03@users.noreply.github.com> Date: Wed, 19 Feb 2025 14:41:04 +0530 Subject: [PATCH 3/6] Update README.md --- 00-course-setup/README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/00-course-setup/README.md b/00-course-setup/README.md index 4b8f2f79..7d7e2f86 100644 --- a/00-course-setup/README.md +++ b/00-course-setup/README.md @@ -25,7 +25,7 @@ Currently this course uses the Github Models Marketplace to offer free access to To access this service, you will need to create a GitHub Personal Access Token. -This can be done by going to your [Personal Access Tokens settings](https://github.com/settings/personal-access-tokens){target="_blank"} in your GitHub Account. +This can be done by going to your Personal Access Tokens settings in your GitHub Account. Select the `Fine-grained tokens` options on the left side of your screen. @@ -61,8 +61,4 @@ This should install the required Python packages. You are now ready to run the code of this code, happy learning more about the world of AI Agents! -If you have any issue running this setup, hop into our [Azure AI Community Discord](https://discord.gg/kzRShWzttr){target="_blank"} or [create an issue](https://github.com/microsoft/ai-agents-for-beginners/issues?WT.mc_id=academic-105485-koreyst){target="_blank"}. - - - - +If you have any issue running this setup, hop into our Azure AI Community Discord or create an issue. \ No newline at end of file From 0fafe872867f558a7e88814fc0642ebeadfdbeab Mon Sep 17 00:00:00 2001 From: SHIVAM <93383164+ShivamGoyal03@users.noreply.github.com> Date: Wed, 19 Feb 2025 16:31:35 +0530 Subject: [PATCH 4/6] Update 05-autogen.ipynb --- 05-agentic-rag/code_samples/05-autogen.ipynb | 281 ++++++++++++------- 1 file changed, 175 insertions(+), 106 deletions(-) diff --git a/05-agentic-rag/code_samples/05-autogen.ipynb b/05-agentic-rag/code_samples/05-autogen.ipynb index 3dc293db..fca3c7cb 100644 --- a/05-agentic-rag/code_samples/05-autogen.ipynb +++ b/05-agentic-rag/code_samples/05-autogen.ipynb @@ -11,9 +11,113 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: chromadb in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (0.6.3)\n", + "Requirement already satisfied: build>=1.0.3 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (1.2.2.post1)\n", + "Requirement already satisfied: pydantic>=1.9 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (2.10.6)\n", + "Requirement already satisfied: chroma-hnswlib==0.7.6 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.7.6)\n", + "Requirement already satisfied: fastapi>=0.95.2 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.115.8)\n", + "Requirement already satisfied: uvicorn>=0.18.3 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.34.0)\n", + "Requirement already satisfied: numpy>=1.22.5 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (2.2.3)\n", + "Requirement already satisfied: posthog>=2.4.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (3.14.1)\n", + "Requirement already satisfied: typing_extensions>=4.5.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (4.12.2)\n", + "Requirement already satisfied: onnxruntime>=1.14.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (1.20.1)\n", + "Requirement already satisfied: opentelemetry-api>=1.2.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (1.30.0)\n", + "Requirement already satisfied: opentelemetry-exporter-otlp-proto-grpc>=1.2.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (1.30.0)\n", + "Requirement already satisfied: opentelemetry-instrumentation-fastapi>=0.41b0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.51b0)\n", + "Requirement already satisfied: opentelemetry-sdk>=1.2.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (1.30.0)\n", + "Requirement already satisfied: tokenizers>=0.13.2 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.21.0)\n", + "Requirement already satisfied: pypika>=0.48.9 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.48.9)\n", + "Requirement already satisfied: tqdm>=4.65.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (4.67.1)\n", + "Requirement already satisfied: overrides>=7.3.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (7.7.0)\n", + "Requirement already satisfied: importlib-resources in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (6.5.2)\n", + "Requirement already satisfied: grpcio>=1.58.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (1.70.0)\n", + "Requirement already satisfied: bcrypt>=4.0.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (4.2.1)\n", + "Requirement already satisfied: typer>=0.9.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.15.1)\n", + "Requirement already satisfied: kubernetes>=28.1.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (32.0.0)\n", + "Requirement already satisfied: tenacity>=8.2.3 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (9.0.0)\n", + "Requirement already satisfied: PyYAML>=6.0.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (6.0.2)\n", + "Requirement already satisfied: mmh3>=4.0.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (5.1.0)\n", + "Requirement already satisfied: orjson>=3.9.12 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (3.10.15)\n", + "Requirement already satisfied: httpx>=0.27.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.28.1)\n", + "Requirement already satisfied: rich>=10.11.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (13.9.4)\n", + "Requirement already satisfied: packaging>=19.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from build>=1.0.3->chromadb) (24.2)\n", + "Requirement already satisfied: pyproject_hooks in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from build>=1.0.3->chromadb) (1.2.0)\n", + "Requirement already satisfied: colorama in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from build>=1.0.3->chromadb) (0.4.6)\n", + "Requirement already satisfied: starlette<0.46.0,>=0.40.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from fastapi>=0.95.2->chromadb) (0.45.3)\n", + "Requirement already satisfied: anyio in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from httpx>=0.27.0->chromadb) (4.8.0)\n", + "Requirement already satisfied: certifi in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from httpx>=0.27.0->chromadb) (2025.1.31)\n", + "Requirement already satisfied: httpcore==1.* in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from httpx>=0.27.0->chromadb) (1.0.7)\n", + "Requirement already satisfied: idna in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from httpx>=0.27.0->chromadb) (3.10)\n", + "Requirement already satisfied: h11<0.15,>=0.13 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from httpcore==1.*->httpx>=0.27.0->chromadb) (0.14.0)\n", + "Requirement already satisfied: six>=1.9.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (1.17.0)\n", + "Requirement already satisfied: python-dateutil>=2.5.3 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (2.9.0.post0)\n", + "Requirement already satisfied: google-auth>=1.0.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (2.38.0)\n", + "Requirement already satisfied: websocket-client!=0.40.0,!=0.41.*,!=0.42.*,>=0.32.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (1.8.0)\n", + "Requirement already satisfied: requests in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (2.32.3)\n", + "Requirement already satisfied: requests-oauthlib in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (2.0.0)\n", + "Requirement already satisfied: oauthlib>=3.2.2 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (3.2.2)\n", + "Requirement already satisfied: urllib3>=1.24.2 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (2.3.0)\n", + "Requirement already satisfied: durationpy>=0.7 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (0.9)\n", + "Requirement already satisfied: coloredlogs in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from onnxruntime>=1.14.1->chromadb) (15.0.1)\n", + "Requirement already satisfied: flatbuffers in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from onnxruntime>=1.14.1->chromadb) (25.2.10)\n", + "Requirement already satisfied: protobuf in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from onnxruntime>=1.14.1->chromadb) (5.29.3)\n", + "Requirement already satisfied: sympy in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from onnxruntime>=1.14.1->chromadb) (1.13.3)\n", + "Requirement already satisfied: deprecated>=1.2.6 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-api>=1.2.0->chromadb) (1.2.18)\n", + "Requirement already satisfied: importlib-metadata<=8.5.0,>=6.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-api>=1.2.0->chromadb) (8.5.0)\n", + "Requirement already satisfied: googleapis-common-protos~=1.52 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb) (1.67.0)\n", + "Requirement already satisfied: opentelemetry-exporter-otlp-proto-common==1.30.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb) (1.30.0)\n", + "Requirement already satisfied: opentelemetry-proto==1.30.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb) (1.30.0)\n", + "Requirement already satisfied: opentelemetry-instrumentation-asgi==0.51b0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (0.51b0)\n", + "Requirement already satisfied: opentelemetry-instrumentation==0.51b0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (0.51b0)\n", + "Requirement already satisfied: opentelemetry-semantic-conventions==0.51b0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (0.51b0)\n", + "Requirement already satisfied: opentelemetry-util-http==0.51b0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (0.51b0)\n", + "Requirement already satisfied: wrapt<2.0.0,>=1.0.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-instrumentation==0.51b0->opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (1.17.2)\n", + "Requirement already satisfied: asgiref~=3.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-instrumentation-asgi==0.51b0->opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (3.8.1)\n", + "Requirement already satisfied: monotonic>=1.5 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from posthog>=2.4.0->chromadb) (1.6)\n", + "Requirement already satisfied: backoff>=1.10.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from posthog>=2.4.0->chromadb) (2.2.1)\n", + "Requirement already satisfied: annotated-types>=0.6.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from pydantic>=1.9->chromadb) (0.7.0)\n", + "Requirement already satisfied: pydantic-core==2.27.2 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from pydantic>=1.9->chromadb) (2.27.2)\n", + "Requirement already satisfied: markdown-it-py>=2.2.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from rich>=10.11.0->chromadb) (3.0.0)\n", + "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from rich>=10.11.0->chromadb) (2.19.1)\n", + "Requirement already satisfied: huggingface-hub<1.0,>=0.16.4 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from tokenizers>=0.13.2->chromadb) (0.28.1)\n", + "Requirement already satisfied: click>=8.0.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from typer>=0.9.0->chromadb) (8.1.8)\n", + "Requirement already satisfied: shellingham>=1.3.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from typer>=0.9.0->chromadb) (1.5.4)\n", + "Requirement already satisfied: httptools>=0.6.3 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.6.4)\n", + "Requirement already satisfied: python-dotenv>=0.13 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from uvicorn[standard]>=0.18.3->chromadb) (1.0.1)\n", + "Requirement already satisfied: watchfiles>=0.13 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from uvicorn[standard]>=0.18.3->chromadb) (1.0.4)\n", + "Requirement already satisfied: websockets>=10.4 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from uvicorn[standard]>=0.18.3->chromadb) (15.0)\n", + "Requirement already satisfied: cachetools<6.0,>=2.0.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (5.5.1)\n", + "Requirement already satisfied: pyasn1-modules>=0.2.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (0.4.1)\n", + "Requirement already satisfied: rsa<5,>=3.1.4 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (4.9)\n", + "Requirement already satisfied: filelock in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.13.2->chromadb) (3.17.0)\n", + "Requirement already satisfied: fsspec>=2023.5.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.13.2->chromadb) (2025.2.0)\n", + "Requirement already satisfied: zipp>=3.20 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from importlib-metadata<=8.5.0,>=6.0->opentelemetry-api>=1.2.0->chromadb) (3.21.0)\n", + "Requirement already satisfied: mdurl~=0.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from markdown-it-py>=2.2.0->rich>=10.11.0->chromadb) (0.1.2)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from requests->kubernetes>=28.1.0->chromadb) (3.4.1)\n", + "Requirement already satisfied: sniffio>=1.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from anyio->httpx>=0.27.0->chromadb) (1.3.1)\n", + "Requirement already satisfied: humanfriendly>=9.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from coloredlogs->onnxruntime>=1.14.1->chromadb) (10.0)\n", + "Requirement already satisfied: mpmath<1.4,>=1.1.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from sympy->onnxruntime>=1.14.1->chromadb) (1.3.0)\n", + "Requirement already satisfied: pyreadline3 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from humanfriendly>=9.1->coloredlogs->onnxruntime>=1.14.1->chromadb) (3.5.4)\n", + "Requirement already satisfied: pyasn1<0.7.0,>=0.4.6 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from pyasn1-modules>=0.2.1->google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (0.6.1)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\n", + "[notice] A new release of pip is available: 24.0 -> 25.0.1\n", + "[notice] To update, run: python.exe -m pip install --upgrade pip\n" + ] + } + ], "source": [ "# Make sure to run this cell before running the rest of the notebook\n", "!pip install chromadb" @@ -21,7 +125,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -49,7 +153,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -87,7 +191,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -109,72 +213,25 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Add of existing embedding ID: doc_0\n", - "Add of existing embedding ID: doc_1\n", - "Add of existing embedding ID: doc_2\n", - "Add of existing embedding ID: doc_3\n", - "Add of existing embedding ID: doc_4\n", - "Add of existing embedding ID: doc_0\n", - "Add of existing embedding ID: doc_1\n", - "Add of existing embedding ID: doc_2\n", - "Add of existing embedding ID: doc_3\n", - "Add of existing embedding ID: doc_4\n", - "Add of existing embedding ID: doc_0\n", - "Add of existing embedding ID: doc_1\n", - "Add of existing embedding ID: doc_2\n", - "Add of existing embedding ID: doc_3\n", - "Add of existing embedding ID: doc_4\n", - "Add of existing embedding ID: doc_0\n", - "Add of existing embedding ID: doc_1\n", - "Add of existing embedding ID: doc_2\n", - "Add of existing embedding ID: doc_3\n", - "Add of existing embedding ID: doc_4\n", - "Add of existing embedding ID: doc_0\n", - "Add of existing embedding ID: doc_1\n", - "Add of existing embedding ID: doc_2\n", - "Add of existing embedding ID: doc_3\n", - "Add of existing embedding ID: doc_4\n", - "Add of existing embedding ID: doc_0\n", - "Add of existing embedding ID: doc_1\n", - "Add of existing embedding ID: doc_2\n", - "Add of existing embedding ID: doc_3\n", - "Add of existing embedding ID: doc_4\n", - "Add of existing embedding ID: doc_0\n", - "Add of existing embedding ID: doc_1\n", - "Add of existing embedding ID: doc_2\n", - "Add of existing embedding ID: doc_3\n", - "Add of existing embedding ID: doc_4\n", - "Insert of existing embedding ID: doc_0\n", - "Insert of existing embedding ID: doc_1\n", - "Insert of existing embedding ID: doc_2\n", - "Insert of existing embedding ID: doc_3\n", - "Insert of existing embedding ID: doc_4\n" - ] - } - ], + "outputs": [], "source": [ "# Initialize ChromaDB with persistent storage\n", "chroma_client = chromadb.PersistentClient(path=\"./chroma_db\")\n", "collection = chroma_client.create_collection(\n", - " name=\"documents\",\n", - " metadata={\"description\": \"RAG documentation\"},\n", + " name=\"travel_documents\",\n", + " metadata={\"description\": \"travel_service\"},\n", " get_or_create=True\n", ")\n", "\n", "# Enhanced sample documents\n", "documents = [\n", - " \"RAG combines retrieval with generative AI for accurate responses.\",\n", - " \"Key features of RAG include document indexing and contextual generation.\",\n", - " \"RAG helps reduce hallucinations by grounding responses in source documents.\",\n", - " \"RAG systems use vector embeddings to find relevant context.\",\n", - " \"The retrieval component ensures factual accuracy in responses.\"\n", + " \"Contoso Travel offers luxury vacation packages to exotic destinations worldwide.\",\n", + " \"Our premium travel services include personalized itinerary planning and 24/7 concierge support.\",\n", + " \"Contoso's travel insurance covers medical emergencies, trip cancellations, and lost baggage.\",\n", + " \"Popular destinations include the Maldives, Swiss Alps, and African safaris.\",\n", + " \"Contoso Travel provides exclusive access to boutique hotels and private guided tours.\"\n", "]\n", "\n", "# Add documents with metadata\n", @@ -196,7 +253,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -227,7 +284,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -271,7 +328,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -311,21 +368,21 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "evaluator = RAGEvaluator()\n", "queries = [\n", - " \"What are the key features of RAG?\",\n", - " \"How does RAG improve response accuracy?\",\n", - " \"Explain the retrieval process in RAG\"\n", + " \"What luxury vacation packages does Contoso Travel offer?\",\n", + " \"Can you explain Contoso's travel insurance coverage?\",\n", + " \"What destinations and experiences are available through Contoso Travel?\"\n", "]" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -348,7 +405,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -356,70 +413,82 @@ "output_type": "stream", "text": [ "\n", - "Processing Query: What are the key features of RAG?\n", - "Response: RAG, or Retrieval-Augmented Generation, is a model architecture that combines the strengths of information retrieval and generative language models. Here are some key features of RAG:\n", - "\n", - "1. **Dual Components**: RAG integrates two main components: a retriever and a generator. The retriever fetches relevant documents or pieces of information from a knowledge base, while the generator produces human-like text based on the retrieved information.\n", + "Processing Query: What luxury vacation packages does Contoso Travel offer?\n", + "Response: As of my last knowledge update in October 2023, Contoso Travel is a fictional company often used as a placeholder in various business scenarios, particularly in Microsoft documentation and examples. Because it doesn't exist in reality, there are no actual luxury vacation packages offered by Contoso Travel.\n", "\n", - "2. **Retrieval-Augmented Generation**: The generator uses the documents retrieved by the retriever to inform its responses, effectively enhancing the model's ability to provide accurate and contextually relevant answers.\n", + "However, if we consider a real travel company, typical luxury vacation packages might include:\n", "\n", - "3. **End-to-End Training**: RAG models allow for joint training, where both the retriever and generator can be tuned together. This approach helps optimize the interaction between the two components for improved performance.\n", + "1. **Luxury Cruises:** All-inclusive packages featuring gourmet dining, spacious suites, and excursions to exotic destinations.\n", + " \n", + "2. **Private Villas or Estates:** Exclusive stays at luxurious properties, often with personal chefs and concierge service.\n", "\n", - "4. **Flexible Knowledge Sources**: RAG can utilize various external knowledge sources, such as databases or document collections, making it adaptable for different applications. This allows it to pull in current and diverse information, thus staying relevant and informed.\n", + "3. **Custom Itineraries:** Tailored travel experiences that include private tours, fine dining, and unique cultural experiences, such as a guided trip through Italy or a safari in Africa.\n", "\n", - "5. **Scalability**: RAG architectures can retrieve from large data stores efficiently. The use of techniques like dense embeddings allows the retriever to quickly find relevant documents even in extensive datasets.\n", + "4. **Wellness Retreats:** Packages focused on relaxation and self-care, offering spa treatments, yoga sessions, and wellness consultations in beautiful settings.\n", "\n", - "6. **Applications**: RAG is particularly useful in applications requiring up-to-date knowledge, such as question answering, conversational agents, and content creation, where the information landscape is constantly evolving.\n", + "5. **Adventure Travel:** High-end adventure experiences like guided treks in the Himalayas or luxury camping (glamping) in national parks.\n", "\n", - "7. **Masking and Generation**: The generator can take a masked input (like specific placeholders indicating where information is needed) along with retrieved documents to create coherent and contextually accurate outputs.\n", + "To find specific luxury vacation packages, it would be best to visit the website of a real travel agency that specializes in luxury travel, where you can browse their current offerings and promotions.\n", "\n", - "8. **Performance**: RAG models tend to outperform traditional generative models when it comes to fact-based questions and tasks, as they leverage the additional information retrieved from external sources.\n", + "Processing Query: Can you explain Contoso's travel insurance coverage?\n", + "Response: As mentioned earlier, Contoso Travel is a fictional entity primarily used for illustrative purposes in business and tech examples, particularly by Microsoft. Therefore, it does not offer actual products or services, including travel insurance. This means that there isn't specific information about Contoso's travel insurance coverage available; it exists only in hypothetical contexts.\n", "\n", - "These features help RAG effectively bridge the gap between static knowledge representation in traditional language models and the dynamic, content-driven needs of real-world applications. For further details on RAG's architecture and implications, refer to the original implementation published by Facebook AI Research (FAIR) in January 2020.\n", + "However, if we were to describe what typical travel insurance coverage might look like for a real travel company, it would generally include several key components:\n", "\n", - "Processing Query: How does RAG improve response accuracy?\n", - "Response: Retrieval-Augmented Generation (RAG) improves response accuracy in several key ways:\n", + "1. **Trip Cancellation/Interruption Insurance:** This coverage reimburses travelers for non-refundable costs if they have to cancel or interrupt their trip due to covered reasons such as illness, death in the family, or natural disasters.\n", "\n", - "1. **Utilization of External Knowledge**: By integrating a retrieval mechanism, RAG can pull in up-to-date and contextually relevant information from external documents or databases. This is particularly important for tasks requiring specific knowledge, as traditional generative models are limited to their training data, which may become outdated or lack specificity.\n", + "2. **Medical Expenses Coverage:** This includes coverage for medical emergencies that may occur while traveling, including hospital stays, surgeries, and other necessary medical services.\n", "\n", - "2. **Contextual Relevance**: The retriever fetches documents that are closely related to the user query, ensuring the generator has access to pertinent information. This helps the model produce responses that are directly relevant to the inquiry, thereby enhancing accuracy.\n", + "3. **Emergency Evacuation Coverage:** This provides transportation to the nearest medical facility if a traveler encounters a medical emergency and needs urgent care.\n", "\n", - "3. **Reduction of Hallucination**: Standard language models sometimes generate plausible-sounding yet factually incorrect statements, a phenomenon known as \"hallucination.\" By grounding the generation process in retrieved content, RAG reduces the chance of hallucinations, as the generated responses are directly tied to concrete information sources.\n", + "4. **Baggage Loss/Delay Coverage:** This protects against the loss, theft, or damage of luggage and personal belongings during travel. It may also provide compensation for essential items if baggage is delayed.\n", "\n", - "4. **Improved Fact Recall**: RAG’s architecture allows for the generation to incorporate factual data directly from retrieved sources, which enhances the ability to recall specific information accurately. The generator modifies and contextualizes this information for human-like responses.\n", + "5. **Travel Delay Coverage:** This reimburses travelers for additional expenses incurred due to delays, such as accommodations and meals, especially when delays exceed a certain period.\n", "\n", - "5. **Joint Training**: In RAG, both the retriever and generator can be jointly trained. This means that the retriever can learn to prioritize the most useful documents for the specific kinds of questions the generator will encounter, optimizing their interaction and improving overall response quality.\n", + "6. **24/7 Assistance Services:** Many travel insurance providers offer round-the-clock assistance services to help travelers deal with emergencies, such as replacing lost passports, finding medical care, or arranging travel home.\n", "\n", - "6. **Clarification and Specificity**: When responding to complex queries, the generator can refer to multiple retrieved documents, allowing it to synthesize information from various sources to create a more comprehensive and specific response.\n", + "7. **Optional Add-ons:** Many policies offer optional add-ons like coverage for adventure sports, Cancel for Any Reason (CFAR) coverage, and more.\n", "\n", - "7. **Scalability with Diverse Data**: RAG can be scaled to work with large datasets, which translates to accessing a broader range of knowledge. This ensures that responses can cover a wider scope of topics and are anchored in more intricate and varied information, leading to better-informed outputs.\n", + "If you're looking for detailed and specific travel insurance products, it would be best to consult a reputable travel insurance provider or financial services company. Be sure to carefully review policy details to understand coverage limits, exclusions, and claims processes.\n", "\n", - "8. **User Feedback and Continuous Learning**: RAG systems can be designed to incorporate user feedback to improve retrieval effectiveness continually. For example, if users indicate that certain types of responses are more accurate or relevant, the system can refine its retrieval strategies over time.\n", + "Processing Query: What destinations and experiences are available through Contoso Travel?\n", + "Response: As Contoso Travel is a fictional company typically used in instructional materials, it does not offer real destinations or experiences. However, if we were to envision what a travel company like Contoso Travel might offer in terms of destinations and experiences, it would likely include a wide range of popular and exotic locations along with unique activities catered to different types of travelers. Here are some examples:\n", "\n", - "Overall, RAG’s architecture allows it to leverage a combination of real-time information retrieval and sophisticated language generation, leading to improved accuracy, relevance, and user experience in generated responses. This framework not only addresses the limitations found in traditional generative models but also enhances their capabilities in managing dynamic and context-dependent queries.\n", + "### Destinations:\n", + "1. **European Cities:** \n", + " - Paris, France - Sightseeing at the Eiffel Tower, visits to world-class museums like the Louvre, and enjoying gourmet dining.\n", + " - Rome, Italy - Exploring ancient ruins, enjoying authentic Italian cuisine, and taking cooking classes.\n", + " - Barcelona, Spain - Discovering Gaudi's architecture, indulging in local tapas tours, and soaking up beach culture.\n", "\n", - "Processing Query: Explain the retrieval process in RAG\n", - "Response: The retrieval process in Retrieval-Augmented Generation (RAG) is a critical component that involves finding and selecting relevant documents or pieces of information from a knowledge base or external dataset, which will then be used to inform the generative model's response. Here’s a detailed breakdown of the retrieval process in RAG:\n", + "2. **Tropical Getaways:**\n", + " - Bali, Indonesia - Relaxing in luxury resorts, engaging in yoga retreats, and exploring vibrant local culture.\n", + " - Maldives - Private overwater villas, snorkeling in coral reefs, and exclusive spa treatments.\n", "\n", - "1. **Input Processing**: The retrieval process begins when a user query or input text is received. This query may include intent information or context that helps indicate what kind of information is needed.\n", + "3. **Adventure Destinations:**\n", + " - New Zealand - Bungee jumping, hiking in national parks, and exploring Maori culture.\n", + " - Costa Rica - Zip-lining through rainforests, surfing, and wildlife tours.\n", "\n", - "2. **Query Representation**: The input query is transformed into a vector representation. This is typically done through embedding techniques using models like BERT or other transformer-based models. The embedding captures the semantic meaning of the query in a form that can be compared to the stored documents or knowledge.\n", + "4. **Cultural Experiences:**\n", + " - Kyoto, Japan - Attending tea ceremonies, visiting historic temples, and experiencing traditional kaiseki dining.\n", + " - Marrakech, Morocco - Exploring souks, staying in luxury riads, and taking guided tours of the Atlas Mountains.\n", "\n", - "3. **Document Indexing**: Prior to retrieval, the documents available in the knowledge base are indexed. This involves converting each document into a vector representation, similar to how the input query is represented. Depending on the implementation, this may be done using dense vector embeddings or more traditional keyword-based methods.\n", + "5. **Safari Adventures:**\n", + " - Kenya - Guided safari tours in Maasai Mara, hot air balloon rides, and cultural visits to Maasai villages.\n", + " - South Africa - Game drives in Kruger National Park, vineyard tours in Stellenbosch, and exploring Cape Town.\n", "\n", - "4. **Retrieval Mechanism**: The next step involves comparing the query vector against the indexed document vectors to identify the most relevant documents. Common approaches to this include:\n", - " - **Nearest Neighbor Search**: This can be performed using algorithms like FAISS (Facebook AI Similarity Search) or Annoy (Approximate Nearest Neighbors Oh Yeah), which efficiently retrieve documents that are closest to the input query in the vector space.\n", - " - **Cosine Similarity**: A common similarity measure used to determine how closely related the document vectors are to the query vector. Higher similarity scores indicate greater relevance.\n", + "### Unique Experiences:\n", + "1. **Culinary Tours:** Guided tours that focus on local cuisine, including cooking classes, market visits, and wine tastings.\n", "\n", - "5. **Ranking the Results**: The retrieved documents are ranked based on their similarity scores relative to the query. The highest-ranking documents are selected for further processing. This ranking helps to ensure that the most contextually relevant information is provided to the generator.\n", + "2. **Wellness Retreats:** Packages that include yoga, meditation, spa treatments, and healthy meals in serene settings.\n", "\n", - "6. **Return Top-k Documents**: A predefined number (k) of top documents are returned to the generative model. The value of k can vary based on the application, but it typically ranges from a few relevant documents to potentially dozens, depending on how much context the model might need.\n", + "3. **Luxury Cruises:** Experiences on cruise ships with premium cabins, gourmet dining options, and curated shore excursions.\n", "\n", - "7. **Contextual Fusion**: Once the relevant documents are retrieved, they are passed on to the generation component. The generator uses these documents to inform and enhance the output. The documents can be used in a few ways, such as directly quoting, summarizing, or integrating information to construct a coherent response.\n", + "4. **Custom Itineraries:** Tailored travel plans based on individual interests, from art and history to outdoor adventures and family-friendly activities.\n", "\n", - "8. **Feedback Loop (optional)**: Some implementations of RAG include mechanisms for learning from user interactions, allowing for continuous improvement of the retrieval portion of the system. This may involve re-evaluating the effectiveness of retrieved documents or refining the embedding process based on user feedback.\n", + "5. **Cultural Immersion:** Opportunities to engage with local communities, including home stays, volunteer projects, and participation in local festivals.\n", "\n", - "By ensuring that the generator has access to specific and relevant information through this structured retrieval process, RAG improves the accuracy and relevance of the responses it generates. The combination of effective input processing, robust indexing, and advanced ranking techniques forms the backbone of the successful retrieval operation in RAG models.\n" + "### Conclusion:\n", + "While the above examples offer a glimpse into what a travel agency like Contoso Travel might provide, it’s important to specify that no actual services are available from Contoso. For real travel experiences and packages, it is best to consult an established travel agency or explore reputable online travel platforms.\n" ] } ], From d9c70fb40e1ee6e13c82962340141240c480f71c Mon Sep 17 00:00:00 2001 From: SHIVAM <93383164+ShivamGoyal03@users.noreply.github.com> Date: Wed, 19 Feb 2025 17:07:46 +0530 Subject: [PATCH 5/6] SQLite Fix added --- 05-agentic-rag/code_samples/05-autogen.ipynb | 291 ++++++++----------- 1 file changed, 128 insertions(+), 163 deletions(-) diff --git a/05-agentic-rag/code_samples/05-autogen.ipynb b/05-agentic-rag/code_samples/05-autogen.ipynb index fca3c7cb..804f2185 100644 --- a/05-agentic-rag/code_samples/05-autogen.ipynb +++ b/05-agentic-rag/code_samples/05-autogen.ipynb @@ -11,121 +11,43 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: chromadb in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (0.6.3)\n", - "Requirement already satisfied: build>=1.0.3 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (1.2.2.post1)\n", - "Requirement already satisfied: pydantic>=1.9 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (2.10.6)\n", - "Requirement already satisfied: chroma-hnswlib==0.7.6 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.7.6)\n", - "Requirement already satisfied: fastapi>=0.95.2 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.115.8)\n", - "Requirement already satisfied: uvicorn>=0.18.3 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.34.0)\n", - "Requirement already satisfied: numpy>=1.22.5 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (2.2.3)\n", - "Requirement already satisfied: posthog>=2.4.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (3.14.1)\n", - "Requirement already satisfied: typing_extensions>=4.5.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (4.12.2)\n", - "Requirement already satisfied: onnxruntime>=1.14.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (1.20.1)\n", - "Requirement already satisfied: opentelemetry-api>=1.2.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (1.30.0)\n", - "Requirement already satisfied: opentelemetry-exporter-otlp-proto-grpc>=1.2.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (1.30.0)\n", - "Requirement already satisfied: opentelemetry-instrumentation-fastapi>=0.41b0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.51b0)\n", - "Requirement already satisfied: opentelemetry-sdk>=1.2.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (1.30.0)\n", - "Requirement already satisfied: tokenizers>=0.13.2 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.21.0)\n", - "Requirement already satisfied: pypika>=0.48.9 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.48.9)\n", - "Requirement already satisfied: tqdm>=4.65.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (4.67.1)\n", - "Requirement already satisfied: overrides>=7.3.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (7.7.0)\n", - "Requirement already satisfied: importlib-resources in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (6.5.2)\n", - "Requirement already satisfied: grpcio>=1.58.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (1.70.0)\n", - "Requirement already satisfied: bcrypt>=4.0.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (4.2.1)\n", - "Requirement already satisfied: typer>=0.9.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.15.1)\n", - "Requirement already satisfied: kubernetes>=28.1.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (32.0.0)\n", - "Requirement already satisfied: tenacity>=8.2.3 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (9.0.0)\n", - "Requirement already satisfied: PyYAML>=6.0.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (6.0.2)\n", - "Requirement already satisfied: mmh3>=4.0.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (5.1.0)\n", - "Requirement already satisfied: orjson>=3.9.12 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (3.10.15)\n", - "Requirement already satisfied: httpx>=0.27.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (0.28.1)\n", - "Requirement already satisfied: rich>=10.11.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from chromadb) (13.9.4)\n", - "Requirement already satisfied: packaging>=19.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from build>=1.0.3->chromadb) (24.2)\n", - "Requirement already satisfied: pyproject_hooks in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from build>=1.0.3->chromadb) (1.2.0)\n", - "Requirement already satisfied: colorama in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from build>=1.0.3->chromadb) (0.4.6)\n", - "Requirement already satisfied: starlette<0.46.0,>=0.40.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from fastapi>=0.95.2->chromadb) (0.45.3)\n", - "Requirement already satisfied: anyio in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from httpx>=0.27.0->chromadb) (4.8.0)\n", - "Requirement already satisfied: certifi in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from httpx>=0.27.0->chromadb) (2025.1.31)\n", - "Requirement already satisfied: httpcore==1.* in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from httpx>=0.27.0->chromadb) (1.0.7)\n", - "Requirement already satisfied: idna in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from httpx>=0.27.0->chromadb) (3.10)\n", - "Requirement already satisfied: h11<0.15,>=0.13 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from httpcore==1.*->httpx>=0.27.0->chromadb) (0.14.0)\n", - "Requirement already satisfied: six>=1.9.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (1.17.0)\n", - "Requirement already satisfied: python-dateutil>=2.5.3 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (2.9.0.post0)\n", - "Requirement already satisfied: google-auth>=1.0.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (2.38.0)\n", - "Requirement already satisfied: websocket-client!=0.40.0,!=0.41.*,!=0.42.*,>=0.32.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (1.8.0)\n", - "Requirement already satisfied: requests in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (2.32.3)\n", - "Requirement already satisfied: requests-oauthlib in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (2.0.0)\n", - "Requirement already satisfied: oauthlib>=3.2.2 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (3.2.2)\n", - "Requirement already satisfied: urllib3>=1.24.2 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (2.3.0)\n", - "Requirement already satisfied: durationpy>=0.7 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from kubernetes>=28.1.0->chromadb) (0.9)\n", - "Requirement already satisfied: coloredlogs in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from onnxruntime>=1.14.1->chromadb) (15.0.1)\n", - "Requirement already satisfied: flatbuffers in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from onnxruntime>=1.14.1->chromadb) (25.2.10)\n", - "Requirement already satisfied: protobuf in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from onnxruntime>=1.14.1->chromadb) (5.29.3)\n", - "Requirement already satisfied: sympy in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from onnxruntime>=1.14.1->chromadb) (1.13.3)\n", - "Requirement already satisfied: deprecated>=1.2.6 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-api>=1.2.0->chromadb) (1.2.18)\n", - "Requirement already satisfied: importlib-metadata<=8.5.0,>=6.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-api>=1.2.0->chromadb) (8.5.0)\n", - "Requirement already satisfied: googleapis-common-protos~=1.52 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb) (1.67.0)\n", - "Requirement already satisfied: opentelemetry-exporter-otlp-proto-common==1.30.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb) (1.30.0)\n", - "Requirement already satisfied: opentelemetry-proto==1.30.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb) (1.30.0)\n", - "Requirement already satisfied: opentelemetry-instrumentation-asgi==0.51b0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (0.51b0)\n", - "Requirement already satisfied: opentelemetry-instrumentation==0.51b0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (0.51b0)\n", - "Requirement already satisfied: opentelemetry-semantic-conventions==0.51b0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (0.51b0)\n", - "Requirement already satisfied: opentelemetry-util-http==0.51b0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (0.51b0)\n", - "Requirement already satisfied: wrapt<2.0.0,>=1.0.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-instrumentation==0.51b0->opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (1.17.2)\n", - "Requirement already satisfied: asgiref~=3.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from opentelemetry-instrumentation-asgi==0.51b0->opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (3.8.1)\n", - "Requirement already satisfied: monotonic>=1.5 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from posthog>=2.4.0->chromadb) (1.6)\n", - "Requirement already satisfied: backoff>=1.10.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from posthog>=2.4.0->chromadb) (2.2.1)\n", - "Requirement already satisfied: annotated-types>=0.6.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from pydantic>=1.9->chromadb) (0.7.0)\n", - "Requirement already satisfied: pydantic-core==2.27.2 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from pydantic>=1.9->chromadb) (2.27.2)\n", - "Requirement already satisfied: markdown-it-py>=2.2.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from rich>=10.11.0->chromadb) (3.0.0)\n", - "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from rich>=10.11.0->chromadb) (2.19.1)\n", - "Requirement already satisfied: huggingface-hub<1.0,>=0.16.4 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from tokenizers>=0.13.2->chromadb) (0.28.1)\n", - "Requirement already satisfied: click>=8.0.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from typer>=0.9.0->chromadb) (8.1.8)\n", - "Requirement already satisfied: shellingham>=1.3.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from typer>=0.9.0->chromadb) (1.5.4)\n", - "Requirement already satisfied: httptools>=0.6.3 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.6.4)\n", - "Requirement already satisfied: python-dotenv>=0.13 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from uvicorn[standard]>=0.18.3->chromadb) (1.0.1)\n", - "Requirement already satisfied: watchfiles>=0.13 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from uvicorn[standard]>=0.18.3->chromadb) (1.0.4)\n", - "Requirement already satisfied: websockets>=10.4 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from uvicorn[standard]>=0.18.3->chromadb) (15.0)\n", - "Requirement already satisfied: cachetools<6.0,>=2.0.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (5.5.1)\n", - "Requirement already satisfied: pyasn1-modules>=0.2.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (0.4.1)\n", - "Requirement already satisfied: rsa<5,>=3.1.4 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (4.9)\n", - "Requirement already satisfied: filelock in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.13.2->chromadb) (3.17.0)\n", - "Requirement already satisfied: fsspec>=2023.5.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.13.2->chromadb) (2025.2.0)\n", - "Requirement already satisfied: zipp>=3.20 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from importlib-metadata<=8.5.0,>=6.0->opentelemetry-api>=1.2.0->chromadb) (3.21.0)\n", - "Requirement already satisfied: mdurl~=0.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from markdown-it-py>=2.2.0->rich>=10.11.0->chromadb) (0.1.2)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from requests->kubernetes>=28.1.0->chromadb) (3.4.1)\n", - "Requirement already satisfied: sniffio>=1.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from anyio->httpx>=0.27.0->chromadb) (1.3.1)\n", - "Requirement already satisfied: humanfriendly>=9.1 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from coloredlogs->onnxruntime>=1.14.1->chromadb) (10.0)\n", - "Requirement already satisfied: mpmath<1.4,>=1.1.0 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from sympy->onnxruntime>=1.14.1->chromadb) (1.3.0)\n", - "Requirement already satisfied: pyreadline3 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from humanfriendly>=9.1->coloredlogs->onnxruntime>=1.14.1->chromadb) (3.5.4)\n", - "Requirement already satisfied: pyasn1<0.7.0,>=0.4.6 in e:\\coding material\\python pr\\mlsa blog\\github\\ai-agents-for-beginners\\venv\\lib\\site-packages (from pyasn1-modules>=0.2.1->google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (0.6.1)\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\n", - "[notice] A new release of pip is available: 24.0 -> 25.0.1\n", - "[notice] To update, run: python.exe -m pip install --upgrade pip\n" - ] - } - ], + "outputs": [], "source": [ "# Make sure to run this cell before running the rest of the notebook\n", - "!pip install chromadb" + "%pip install chromadb" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "SQLite Version Fix\n", + "If you encounter the error:\n", + "```\n", + "RuntimeError: Your system has an unsupported version of sqlite3. Chroma requires sqlite3 >= 3.35.0\n", + "```\n", + "\n", + "Uncomment this code block at the start of your notebook:" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [], + "source": [ + "# %pip install pysqlite3-binary\n", + "# import pyqlite3\n", + "# __import__('pysqlite3')\n", + "# import sys\n", + "# sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ @@ -153,7 +75,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -191,7 +113,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 20, "metadata": {}, "outputs": [], "source": [ @@ -213,9 +135,26 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 21, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Insert of existing embedding ID: doc_0\n", + "Insert of existing embedding ID: doc_1\n", + "Insert of existing embedding ID: doc_2\n", + "Insert of existing embedding ID: doc_3\n", + "Insert of existing embedding ID: doc_4\n", + "Add of existing embedding ID: doc_0\n", + "Add of existing embedding ID: doc_1\n", + "Add of existing embedding ID: doc_2\n", + "Add of existing embedding ID: doc_3\n", + "Add of existing embedding ID: doc_4\n" + ] + } + ], "source": [ "# Initialize ChromaDB with persistent storage\n", "chroma_client = chromadb.PersistentClient(path=\"./chroma_db\")\n", @@ -253,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -284,7 +223,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -328,7 +267,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -368,7 +307,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -382,7 +321,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ @@ -405,7 +344,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -414,81 +353,107 @@ "text": [ "\n", "Processing Query: What luxury vacation packages does Contoso Travel offer?\n", - "Response: As of my last knowledge update in October 2023, Contoso Travel is a fictional company often used as a placeholder in various business scenarios, particularly in Microsoft documentation and examples. Because it doesn't exist in reality, there are no actual luxury vacation packages offered by Contoso Travel.\n", + "Response: Contoso Travel, which typically represents a fictional or illustrative example in training materials, often provides a range of luxury vacation packages that cater to various tastes and preferences. While I don't have access to specific current offerings from a real company named Contoso Travel, I can outline some common features and types of luxury vacation packages that similar travel agencies might provide.\n", + "\n", + "1. **All-Inclusive Resorts**: Packages that include accommodations, meals, drinks, and activities at high-end resorts. Popular destinations might include the Caribbean, Maldives, and Tahiti.\n", "\n", - "However, if we consider a real travel company, typical luxury vacation packages might include:\n", + "2. **Private Yacht Charters**: Luxury vacation packages that offer private yacht rentals, including crewed charters that can explore exotic locales while providing personalized services.\n", "\n", - "1. **Luxury Cruises:** All-inclusive packages featuring gourmet dining, spacious suites, and excursions to exotic destinations.\n", - " \n", - "2. **Private Villas or Estates:** Exclusive stays at luxurious properties, often with personal chefs and concierge service.\n", + "3. **Luxury Safari Packages**: These often include stays in exclusive lodges or private villas in picturesque locations like Africa, complete with guided wildlife tours and cultural experiences.\n", "\n", - "3. **Custom Itineraries:** Tailored travel experiences that include private tours, fine dining, and unique cultural experiences, such as a guided trip through Italy or a safari in Africa.\n", + "4. **Culinary or Wine Tours**: Gourmet experiences that might include private chef dinners, wine tastings in renowned vineyards, or cooking classes with local chefs in destinations famous for their cuisine.\n", "\n", - "4. **Wellness Retreats:** Packages focused on relaxation and self-care, offering spa treatments, yoga sessions, and wellness consultations in beautiful settings.\n", + "5. **Wellness Retreats**: Packages centered around relaxation and rejuvenation, including luxury spa treatments, wellness workshops, and yoga sessions in tranquil settings.\n", "\n", - "5. **Adventure Travel:** High-end adventure experiences like guided treks in the Himalayas or luxury camping (glamping) in national parks.\n", + "6. **Adventure Trips**: Tailored trips that offer high-end experiences combining luxury accommodations with adventurous activities, such as guided trekking in the Himalayas or heli-skiing in Alaska.\n", "\n", - "To find specific luxury vacation packages, it would be best to visit the website of a real travel agency that specializes in luxury travel, where you can browse their current offerings and promotions.\n", + "7. **Cultural Escapades**: Exclusive tours tailored to explore the rich history and culture of regions, often including private tours of museums and historical sites, along with accommodations in luxury hotels.\n", + "\n", + "8. **Honeymoon Packages**: Romantic getaways specifically designed for newlyweds, featuring beachfront bungalows, candlelit dinners, and couples' spa treatments.\n", + "\n", + "When exploring luxury vacation packages with a specific agency, it's advisable to directly visit their website or contact their customer service to examine current offerings, pricing, and customization options according to individual preferences.\n", "\n", "Processing Query: Can you explain Contoso's travel insurance coverage?\n", - "Response: As mentioned earlier, Contoso Travel is a fictional entity primarily used for illustrative purposes in business and tech examples, particularly by Microsoft. Therefore, it does not offer actual products or services, including travel insurance. This means that there isn't specific information about Contoso's travel insurance coverage available; it exists only in hypothetical contexts.\n", + "Response: Since Contoso is often used as a fictional example in training materials, specific details about Contoso's travel insurance coverage are not available. However, I can provide an overview of what you might typically expect from travel insurance coverage offered by a company like Contoso Travel.\n", + "\n", + "### Typical Travel Insurance Coverage Components\n", "\n", - "However, if we were to describe what typical travel insurance coverage might look like for a real travel company, it would generally include several key components:\n", + "1. **Trip Cancellation/Interruption Insurance**: \n", + " - This coverage provides reimbursement for non-refundable travel expenses if a trip must be canceled or interrupted due to covered reasons, such as illness, injury, a family emergency, or natural disasters.\n", "\n", - "1. **Trip Cancellation/Interruption Insurance:** This coverage reimburses travelers for non-refundable costs if they have to cancel or interrupt their trip due to covered reasons such as illness, death in the family, or natural disasters.\n", + "2. **Medical Coverage**:\n", + " - This includes expenses for medical treatment if you become ill or injured while traveling. It may also cover emergency medical transportation and evacuation, especially important for international trips.\n", "\n", - "2. **Medical Expenses Coverage:** This includes coverage for medical emergencies that may occur while traveling, including hospital stays, surgeries, and other necessary medical services.\n", + "3. **Baggage Coverage**: \n", + " - This component covers lost, stolen, or damaged luggage and personal belongings. It may reimburse you for the replacement value of lost items or for the costs incurred to purchase essentials if your luggage is delayed.\n", "\n", - "3. **Emergency Evacuation Coverage:** This provides transportation to the nearest medical facility if a traveler encounters a medical emergency and needs urgent care.\n", + "4. **Flight Delay/Cancellation Coverage**:\n", + " - This reimbursement is for expenses incurred due to delays or cancellations of flights, such as accommodations, meals, and transportation.\n", "\n", - "4. **Baggage Loss/Delay Coverage:** This protects against the loss, theft, or damage of luggage and personal belongings during travel. It may also provide compensation for essential items if baggage is delayed.\n", + "5. **24/7 Assistance Services**:\n", + " - Many travel insurance policies offer emergency assistance hotlines that can help with medical appointments, legal referrals, and other urgent needs while traveling.\n", "\n", - "5. **Travel Delay Coverage:** This reimburses travelers for additional expenses incurred due to delays, such as accommodations and meals, especially when delays exceed a certain period.\n", + "6. **Travel Delay Coverage**:\n", + " - Covers additional expenses incurred if your trip is delayed for reasons such as severe weather, strikes, or other unexpected events.\n", "\n", - "6. **24/7 Assistance Services:** Many travel insurance providers offer round-the-clock assistance services to help travelers deal with emergencies, such as replacing lost passports, finding medical care, or arranging travel home.\n", + "7. **Accidental Death and Dismemberment Insurance**:\n", + " - This provides a benefit in case of accidental death or severe injury while traveling.\n", "\n", - "7. **Optional Add-ons:** Many policies offer optional add-ons like coverage for adventure sports, Cancel for Any Reason (CFAR) coverage, and more.\n", + "### Important Considerations\n", "\n", - "If you're looking for detailed and specific travel insurance products, it would be best to consult a reputable travel insurance provider or financial services company. Be sure to carefully review policy details to understand coverage limits, exclusions, and claims processes.\n", + "- **Exclusions**: It’s crucial to read the policy to understand what's not covered. Common exclusions include pre-existing medical conditions, risky activities (like extreme sports), or cancellations due to personal reasons not categorized as emergencies.\n", + " \n", + "- **Deductibles**: Some policies may require you to pay a certain amount out of pocket before coverage kicks in.\n", + "\n", + "- **Limits on Coverage**: There may be caps on how much you can claim for different types of expenses (like medical costs or baggage loss).\n", + "\n", + "To get accurate and specific information regarding travel insurance options from Contoso Travel or any actual travel agency, I recommend checking their official website or contacting their customer service team directly. They can provide detailed policy documents and assist with any specific queries you may have.\n", "\n", "Processing Query: What destinations and experiences are available through Contoso Travel?\n", - "Response: As Contoso Travel is a fictional company typically used in instructional materials, it does not offer real destinations or experiences. However, if we were to envision what a travel company like Contoso Travel might offer in terms of destinations and experiences, it would likely include a wide range of popular and exotic locations along with unique activities catered to different types of travelers. Here are some examples:\n", + "Response: While Contoso Travel is a fictional example commonly used in training materials, I can provide an illustrative overview of typical destinations and experiences that a travel agency like Contoso might offer. Here are some common categories of destinations and experiences you could expect:\n", + "\n", + "### Popular Destinations\n", + "\n", + "1. **Tropical Islands**:\n", + " - **Maldives**: Known for overwater bungalows, crystal-clear waters, and incredible snorkeling and diving opportunities.\n", + " - **Bora Bora**: Famous for its picturesque lagoons and luxury resorts, perfect for honeymooners or couples.\n", + "\n", + "2. **European Cities**:\n", + " - **Paris, France**: Tours that include visits to iconic landmarks like the Eiffel Tower, Louvre, and gourmet experiences in local cafes.\n", + " - **Rome, Italy**: Historical tours exploring ancient ruins such as the Colosseum and Vatican City, along with culinary classes.\n", + "\n", + "3. **Adventure Destinations**:\n", + " - **Costa Rica**: Packages that feature zip-lining through rainforests, surfing, and wildlife tours in national parks.\n", + " - **New Zealand**: Experiences may include bungee jumping, hiking the Tongariro Alpine Crossing, and exploring the picturesque landscapes featured in \"The Lord of the Rings.\"\n", "\n", - "### Destinations:\n", - "1. **European Cities:** \n", - " - Paris, France - Sightseeing at the Eiffel Tower, visits to world-class museums like the Louvre, and enjoying gourmet dining.\n", - " - Rome, Italy - Exploring ancient ruins, enjoying authentic Italian cuisine, and taking cooking classes.\n", - " - Barcelona, Spain - Discovering Gaudi's architecture, indulging in local tapas tours, and soaking up beach culture.\n", + "4. **Cultural Experiences**:\n", + " - **Kyoto, Japan**: Packages that allow travelers to visit traditional tea houses, the Arashiyama Bamboo Grove, and ancient temples.\n", + " - **Marrakech, Morocco**: Immersive experiences exploring souks, trying traditional Moroccan cooking, and staying in luxury riads.\n", "\n", - "2. **Tropical Getaways:**\n", - " - Bali, Indonesia - Relaxing in luxury resorts, engaging in yoga retreats, and exploring vibrant local culture.\n", - " - Maldives - Private overwater villas, snorkeling in coral reefs, and exclusive spa treatments.\n", + "5. **Safari Adventures**:\n", + " - **Kenya and Tanzania**: Luxury lodges and guided safari tours to see the Big Five (lion, leopard, rhinoceros, elephant, and Cape buffalo) in their natural habitat.\n", "\n", - "3. **Adventure Destinations:**\n", - " - New Zealand - Bungee jumping, hiking in national parks, and exploring Maori culture.\n", - " - Costa Rica - Zip-lining through rainforests, surfing, and wildlife tours.\n", + "6. **Cruises**:\n", + " - **Mediterranean Cruises**: Itineraries that include stops in multiple countries, such as Italy, Greece, and Spain, with opportunities for excursions in each port.\n", + " - **Alaskan Cruises**: Experiences focused on wildlife viewing, glacier touring, and exploring quaint coastal towns.\n", "\n", - "4. **Cultural Experiences:**\n", - " - Kyoto, Japan - Attending tea ceremonies, visiting historic temples, and experiencing traditional kaiseki dining.\n", - " - Marrakech, Morocco - Exploring souks, staying in luxury riads, and taking guided tours of the Atlas Mountains.\n", + "7. **Wellness Retreats**:\n", + " - **Bali, Indonesia**: Packages that include yoga retreats, spa treatments, and holistic wellness programs in tranquil settings.\n", + " - **Sedona, Arizona**: Experiences centered around healing, hiking, and spiritual wellness in a stunning natural environment.\n", "\n", - "5. **Safari Adventures:**\n", - " - Kenya - Guided safari tours in Maasai Mara, hot air balloon rides, and cultural visits to Maasai villages.\n", - " - South Africa - Game drives in Kruger National Park, vineyard tours in Stellenbosch, and exploring Cape Town.\n", + "### Unique Experiences\n", "\n", - "### Unique Experiences:\n", - "1. **Culinary Tours:** Guided tours that focus on local cuisine, including cooking classes, market visits, and wine tastings.\n", + "1. **Culinary Tours**: A focus on local food experiences, including cooking classes, wine tastings, and market visits to explore regional cuisines.\n", "\n", - "2. **Wellness Retreats:** Packages that include yoga, meditation, spa treatments, and healthy meals in serene settings.\n", + "2. **Wildlife Conservation Programs**: Opportunities to participate in volunteer programs that support wildlife conservation efforts, such as working with elephants in Thailand or rescuing sea turtles.\n", "\n", - "3. **Luxury Cruises:** Experiences on cruise ships with premium cabins, gourmet dining options, and curated shore excursions.\n", + "3. **Luxury Train Journeys**: Experiences like traveling on the Belmond Orient Express or Rocky Mountaineer, combining scenic vistas with sumptuous dining.\n", "\n", - "4. **Custom Itineraries:** Tailored travel plans based on individual interests, from art and history to outdoor adventures and family-friendly activities.\n", + "4. **Personalized Itineraries**: Customizable travel packages allowing clients to select their preferred activities, accommodations, and transportation options.\n", "\n", - "5. **Cultural Immersion:** Opportunities to engage with local communities, including home stays, volunteer projects, and participation in local festivals.\n", + "5. **Digital Nomad Packages**: Tailored itineraries for remote workers combining travel with work facilities, including co-working spaces in popular locations.\n", "\n", - "### Conclusion:\n", - "While the above examples offer a glimpse into what a travel agency like Contoso Travel might provide, it’s important to specify that no actual services are available from Contoso. For real travel experiences and packages, it is best to consult an established travel agency or explore reputable online travel platforms.\n" + "For specific offerings, experiences, and destinations from Contoso Travel or any other real-world travel agency, it’s best to check their official website or contact them directly to explore current packages and promotional deals.\n" ] } ], From f79bcb9425238b0290aa65a924bfdd977e797b00 Mon Sep 17 00:00:00 2001 From: SHIVAM <93383164+ShivamGoyal03@users.noreply.github.com> Date: Wed, 19 Feb 2025 18:00:35 +0530 Subject: [PATCH 6/6] SQLite fix --- 05-agentic-rag/code_samples/05-autogen.ipynb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/05-agentic-rag/code_samples/05-autogen.ipynb b/05-agentic-rag/code_samples/05-autogen.ipynb index 804f2185..327fca68 100644 --- a/05-agentic-rag/code_samples/05-autogen.ipynb +++ b/05-agentic-rag/code_samples/05-autogen.ipynb @@ -34,12 +34,11 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# %pip install pysqlite3-binary\n", - "# import pyqlite3\n", "# __import__('pysqlite3')\n", "# import sys\n", "# sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')"