diff --git a/README.md b/README.md index dd26c5c..a4e9872 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ # ChromaDB.AgentFramework.Sample -[Microsoft Agent Framework](https://learn.microsoft.com/agent-framework/) samples that use [Chroma](https://www.trychroma.com/) as the vector store, through [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData). They follow the form of the [.NET samples of Agent Framework](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/02-agents), with Chroma in place of the vector store of the original sample, and each one also comes with models that run locally in Ollama. +[Microsoft Agent Framework](https://learn.microsoft.com/agent-framework/) samples that use [Chroma](https://www.trychroma.com/) as the vector store through [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData). + +They follow the form of the [Agent Framework .NET samples](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/02-agents). Chroma takes the place of the vector store that the original sample uses. Each sample also comes in a variant with models that run locally in Ollama. > This is a community project. It is not affiliated with or endorsed by Chroma. @@ -12,14 +14,16 @@ Website: [chromadotnet.org](https://chromadotnet.org) | Sample | Description | |---|---| -| [Memory with Chroma](./samples/AgentWithMemory_Step10_MemoryUsingChroma/) | Persists chat history in Chroma with `ChatHistoryMemoryProvider` and recalls it in a new session, with Microsoft Foundry models. In the form of [Memory with Azure Cosmos DB for NoSQL](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/02-agents/AgentWithMemory/AgentWithMemory_Step08_MemoryUsingCosmosNoSql). | +| [Memory with Chroma](./samples/AgentWithMemory_Step10_MemoryUsingChroma/) | Persists chat history in Chroma with `ChatHistoryMemoryProvider` and recalls it in a new session. Uses Microsoft Foundry models. Follows the form of [Memory with Azure Cosmos DB for NoSQL](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/02-agents/AgentWithMemory/AgentWithMemory_Step08_MemoryUsingCosmosNoSql). | | [Memory with Chroma and Ollama](./samples/AgentWithMemory_Step10_MemoryUsingChroma_Ollama/) | The same sample with models that run locally in Ollama. | -| [RAG with Chroma](./samples/AgentWithRAG_Step06_ChromaRAG/) | Answers from documentation stored in Chroma with a custom schema, through `TextSearchProvider`, with Microsoft Foundry models. In the form of [RAG with Vector Store and custom schema](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG). | +| [RAG with Chroma](./samples/AgentWithRAG_Step06_ChromaRAG/) | Answers from documentation stored in Chroma with a custom schema, through `TextSearchProvider`. Uses Microsoft Foundry models. Follows the form of [RAG with Vector Store and custom schema](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG). | | [RAG with Chroma and Ollama](./samples/AgentWithRAG_Step06_ChromaRAG_Ollama/) | The same sample with models that run locally in Ollama. | -| [RAG with Chroma and the TextSearchStore](./samples/AgentWithRAG_Step07_ChromaBasicTextRAG/) | Answers from documents stored in Chroma by the `TextSearchStore` of the Agent Framework sample, which writes and reads them as dictionaries, through `TextSearchProvider`, with Microsoft Foundry models. In the form of [Basic Text RAG](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG). | +| [RAG with Chroma and the TextSearchStore](./samples/AgentWithRAG_Step07_ChromaBasicTextRAG/) | Answers from documents stored in Chroma, through `TextSearchProvider`. The documents are stored by the `TextSearchStore` from the Agent Framework sample, which writes and reads them as dictionaries. Uses Microsoft Foundry models. Follows the form of [Basic Text RAG](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG). | | [RAG with Chroma, the TextSearchStore and Ollama](./samples/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama/) | The same sample with models that run locally in Ollama. | -The Microsoft Foundry samples need a Foundry project and `az login`; each README lists what it needs. The Ollama samples need only the [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0) and Docker: [compose.yaml](./compose.yaml) runs Chroma and Ollama, and downloads the models. +The Microsoft Foundry samples need a Foundry project and `az login`. Each sample README lists what it needs. + +The Ollama samples need only the [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0) and Docker. The [compose.yaml](./compose.yaml) file runs Chroma and Ollama, and downloads the models. ```bash docker compose up -d @@ -32,12 +36,16 @@ dotnet run --project samples/AgentWithMemory_Step10_MemoryUsingChroma_Ollama dotnet test ``` -GitHub Actions runs them on every push to `main` and on every pull request to `main`. +GitHub Actions runs the tests on every push to `main` and on every pull request to `main`. + +The tests run each sample's scenario with the same configuration as the sample. Chroma runs in a container started with [ChromaDotNet.Testcontainers](https://www.nuget.org/packages/ChromaDotNet.Testcontainers). The tests need Docker, but no model. The embeddings come from word hashes, and the chat model only records what the agent sends to it. + +What the tests check: -The tests run the scenario of each sample, with the same configuration, against Chroma in a container started with [ChromaDotNet.Testcontainers](https://www.nuget.org/packages/ChromaDotNet.Testcontainers). They need Docker, but no model: the embeddings come from word hashes and the chat model only records what the agent sends to it. +- Memory: the user's preference reaches the model in a new session, and another user's messages do not. Each session is stored under its own session id. +- RAG: the chunk that answers the question reaches the model, and the search results are not stored in the chat history. A follow-up question is searched with the recent messages. The chunks are stored with their source. +- RAG with the TextSearchStore: the document that answers each question reaches the model, and the search results are not stored in the chat history. The documents are stored with their source. -- Memory: the preference of the user reaches the model in a new session, the messages of another user do not, and each session is stored under its own session id. -- RAG: the chunk that answers the question reaches the model, the search results are not stored in the chat history, a follow-up question is searched with the recent messages, and the chunks are stored with their source. -- RAG with the TextSearchStore: the document that answers each question reaches the model, the search results are not stored in the chat history, and the documents are stored with their source. +The `TextSearchStore` in [AgentWithRAG_Step07_ChromaBasicTextRAG/TextSearchStore](./samples/AgentWithRAG_Step07_ChromaBasicTextRAG/TextSearchStore/) is copied unchanged from the [Agent Framework repository](https://github.com/microsoft/agent-framework) (MIT) and keeps its copyright notice. -The `TextSearchStore` in [AgentWithRAG_Step07_ChromaBasicTextRAG/TextSearchStore](./samples/AgentWithRAG_Step07_ChromaBasicTextRAG/TextSearchStore/) comes from the [Agent Framework repository](https://github.com/microsoft/agent-framework) (MIT) as it is, and keeps its copyright notice; the programs of the samples are adaptations of the Agent Framework samples linked in the table above, under the same license, and carry the same copyright notice. +The sample programs are adaptations of the Agent Framework samples linked in the table above. They are under the same license and carry the same copyright notice. diff --git a/samples/AgentWithMemory_Step10_MemoryUsingChroma/AgentWithMemory_Step10_MemoryUsingChroma.csproj b/samples/AgentWithMemory_Step10_MemoryUsingChroma/AgentWithMemory_Step10_MemoryUsingChroma.csproj index d93dbf0..df534f2 100644 --- a/samples/AgentWithMemory_Step10_MemoryUsingChroma/AgentWithMemory_Step10_MemoryUsingChroma.csproj +++ b/samples/AgentWithMemory_Step10_MemoryUsingChroma/AgentWithMemory_Step10_MemoryUsingChroma.csproj @@ -12,7 +12,7 @@ - + diff --git a/samples/AgentWithMemory_Step10_MemoryUsingChroma/README.md b/samples/AgentWithMemory_Step10_MemoryUsingChroma/README.md index 2e6620a..bfcd9b4 100644 --- a/samples/AgentWithMemory_Step10_MemoryUsingChroma/README.md +++ b/samples/AgentWithMemory_Step10_MemoryUsingChroma/README.md @@ -1,6 +1,6 @@ # Agent with Memory Using Chroma -This sample uses `ChatHistoryMemoryProvider` with `ChromaVectorStore` from [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData) to persist chat history in [Chroma](https://www.trychroma.com/) and recall relevant messages in a new agent session. +This sample persists chat history in [Chroma](https://www.trychroma.com/) and recalls relevant messages in a new agent session. It uses `ChatHistoryMemoryProvider` with `ChromaVectorStore` from [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData). ## Features Demonstrated @@ -15,7 +15,7 @@ This sample uses `ChatHistoryMemoryProvider` with `ChromaVectorStore` from [Chro 2. A Microsoft Foundry project with: - A chat model deployment (the default is `gpt-5.4-mini`) - A `text-embedding-3-large` deployment with 3,072 dimensions -3. A running Chroma server, 1.5.0 or later: `docker compose up -d chroma` at the root of the repository starts the instance defined in the [compose file](../../compose.yaml), or you can run one with Docker: +3. A running Chroma server, version 1.5.0 or later. To start the instance defined in the [compose file](../../compose.yaml), run `docker compose up -d chroma` at the root of the repository. Or you can run one with Docker: ```bash docker run -d --name chroma -p 8000:8000 chromadb/chroma:1.5.9 @@ -23,7 +23,7 @@ This sample uses `ChatHistoryMemoryProvider` with `ChromaVectorStore` from [Chro 4. Azure CLI authentication (`az login`) with an identity that has the Foundry User role on the Foundry resource -The Foundry project endpoint does not serve embeddings, so the sample generates them through the endpoint of the Foundry resource that hosts the project, with the same credential. +The Foundry project endpoint does not serve embeddings. The sample generates them through the endpoint of the Foundry resource that hosts the project, using the same credential. ## Configuration @@ -43,4 +43,4 @@ Set the following environment variables: dotnet run ``` -The first session stores the user's preference for pirate jokes. The second session uses a different `AgentSession` but the same per-run user search scope, allowing the agent to retrieve that preference from Chroma without recalling data from earlier sample runs. +The first session stores the user's preference for pirate jokes. The second session uses a different `AgentSession` but the same per-run user search scope. This lets the agent retrieve that preference from Chroma without recalling data from earlier sample runs. diff --git a/samples/AgentWithMemory_Step10_MemoryUsingChroma_Ollama/AgentWithMemory_Step10_MemoryUsingChroma_Ollama.csproj b/samples/AgentWithMemory_Step10_MemoryUsingChroma_Ollama/AgentWithMemory_Step10_MemoryUsingChroma_Ollama.csproj index a1d01ea..5c9481f 100644 --- a/samples/AgentWithMemory_Step10_MemoryUsingChroma_Ollama/AgentWithMemory_Step10_MemoryUsingChroma_Ollama.csproj +++ b/samples/AgentWithMemory_Step10_MemoryUsingChroma_Ollama/AgentWithMemory_Step10_MemoryUsingChroma_Ollama.csproj @@ -10,7 +10,7 @@ - + diff --git a/samples/AgentWithMemory_Step10_MemoryUsingChroma_Ollama/README.md b/samples/AgentWithMemory_Step10_MemoryUsingChroma_Ollama/README.md index d1e311a..5f40f8e 100644 --- a/samples/AgentWithMemory_Step10_MemoryUsingChroma_Ollama/README.md +++ b/samples/AgentWithMemory_Step10_MemoryUsingChroma_Ollama/README.md @@ -1,6 +1,8 @@ # Agent with Memory Using Chroma and Ollama -This sample is [Agent with Memory Using Chroma](../AgentWithMemory_Step10_MemoryUsingChroma/) with models that run locally in [Ollama](https://ollama.com/) instead of Microsoft Foundry. It uses `ChatHistoryMemoryProvider` with `ChromaVectorStore` from [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData) to persist chat history in [Chroma](https://www.trychroma.com/) and recall relevant messages in a new agent session. +This sample is [Agent with Memory Using Chroma](../AgentWithMemory_Step10_MemoryUsingChroma/) with models that run locally in [Ollama](https://ollama.com/) instead of Microsoft Foundry. + +It persists chat history in [Chroma](https://www.trychroma.com/) and recalls relevant messages in a new agent session. It uses `ChatHistoryMemoryProvider` with `ChromaVectorStore` from [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData). ## Features Demonstrated @@ -18,7 +20,7 @@ This sample is [Agent with Memory Using Chroma](../AgentWithMemory_Step10_Memory docker compose up -d ``` - The first run downloads `qwen2.5:3b` and `nomic-embed-text`, about 2 GB; `docker compose logs -f ollama-models` shows the progress. + The first run downloads `qwen2.5:3b` and `nomic-embed-text` (about 2 GB). To see the progress, run `docker compose logs -f ollama-models`. ## Configuration @@ -38,4 +40,6 @@ The defaults match the compose file. To change them, set the following environme dotnet run ``` -The first session stores the user's preference for pirate jokes. The second session uses a different `AgentSession` but the same per-run user search scope, allowing the agent to retrieve that preference from Chroma without recalling data from earlier sample runs. The chat history goes in a collection of its own, `chathistory-local`, since the local embedding model has fewer dimensions than the Foundry one. +The first session stores the user's preference for pirate jokes. The second session uses a different `AgentSession` but the same per-run user search scope. This lets the agent retrieve that preference from Chroma without recalling data from earlier sample runs. + +The chat history goes in its own collection, `chathistory-local`, because the local embedding model has fewer dimensions than the Foundry one. diff --git a/samples/AgentWithRAG_Step06_ChromaRAG/AgentWithRAG_Step06_ChromaRAG.csproj b/samples/AgentWithRAG_Step06_ChromaRAG/AgentWithRAG_Step06_ChromaRAG.csproj index 2c50625..1c8fd91 100644 --- a/samples/AgentWithRAG_Step06_ChromaRAG/AgentWithRAG_Step06_ChromaRAG.csproj +++ b/samples/AgentWithRAG_Step06_ChromaRAG/AgentWithRAG_Step06_ChromaRAG.csproj @@ -12,7 +12,7 @@ - + diff --git a/samples/AgentWithRAG_Step06_ChromaRAG/README.md b/samples/AgentWithRAG_Step06_ChromaRAG/README.md index a4e3652..1476e9c 100644 --- a/samples/AgentWithRAG_Step06_ChromaRAG/README.md +++ b/samples/AgentWithRAG_Step06_ChromaRAG/README.md @@ -1,6 +1,6 @@ # Agent Framework Retrieval Augmented Generation (RAG) with Chroma and a custom schema -This sample demonstrates how to create and run an agent that uses Retrieval Augmented Generation (RAG) with [Chroma](https://www.trychroma.com/) as the vector store, through `ChromaVectorStore` from [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData). +This sample demonstrates how to create and run an agent that uses Retrieval Augmented Generation (RAG) with [Chroma](https://www.trychroma.com/) as the vector store. It connects to Chroma through `ChromaVectorStore` from [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData). It also uses a custom schema for the documents stored in the vector store. ## Prerequisites @@ -10,15 +10,15 @@ It also uses a custom schema for the documents stored in the vector store. - A chat model deployment (the default is `gpt-5.4-mini`) - A `text-embedding-3-large` deployment with 3,072 dimensions - Azure CLI installed and authenticated (`az login`) with an identity that has the Foundry User role on the Foundry resource -- A running Chroma server, 1.5.0 or later: `docker compose up -d chroma` at the root of the repository starts the instance defined in the [compose file](../../compose.yaml), or you can run a local instance using Docker: +- A running Chroma server, version 1.5.0 or later. To start the instance defined in the [compose file](../../compose.yaml), run `docker compose up -d chroma` at the root of the repository. Or you can run a local instance using Docker: ```powershell docker run -d --name chroma -p 8000:8000 chromadb/chroma:1.5.9 ``` -**Note**: The Foundry project endpoint does not serve embeddings, so the sample generates them through the endpoint of the Foundry resource that hosts the project, with the same credential. +**Note**: The Foundry project endpoint does not serve embeddings. The sample generates them through the endpoint of the Foundry resource that hosts the project, using the same credential. -**Note**: The sample keeps the chat history in an `InMemoryChatHistoryProvider`, so that the search results of the `TextSearchProvider` are not stored with it. Microsoft Foundry would otherwise store the responses and manage the conversation itself, which cannot be combined with a `ChatHistoryProvider`, so the sample turns off the storage of the responses. +**Note**: The sample keeps the chat history in an `InMemoryChatHistoryProvider`, so the `TextSearchProvider` search results are not stored with it. Otherwise, Microsoft Foundry would store the responses and manage the conversation itself. That cannot be combined with a `ChatHistoryProvider`, so the sample turns off response storage. ## Running the sample from the console @@ -49,4 +49,6 @@ Or just build and run in one step: dotnet run ``` -The sample downloads two documents of the Agent Framework documentation, stores them in Chroma in chunks, and asks four questions about them. The second question, "and in Agent Framework?", only makes sense after the first one: the search includes the recent messages, so it still finds the right chunks. +The sample downloads two documents from the Agent Framework documentation and stores them in Chroma in chunks. Then it asks four questions about them. + +The second question, "and in Agent Framework?", only makes sense after the first one. The search includes the recent messages, so it still finds the right chunks. diff --git a/samples/AgentWithRAG_Step06_ChromaRAG_Ollama/AgentWithRAG_Step06_ChromaRAG_Ollama.csproj b/samples/AgentWithRAG_Step06_ChromaRAG_Ollama/AgentWithRAG_Step06_ChromaRAG_Ollama.csproj index a1d01ea..5c9481f 100644 --- a/samples/AgentWithRAG_Step06_ChromaRAG_Ollama/AgentWithRAG_Step06_ChromaRAG_Ollama.csproj +++ b/samples/AgentWithRAG_Step06_ChromaRAG_Ollama/AgentWithRAG_Step06_ChromaRAG_Ollama.csproj @@ -10,7 +10,7 @@ - + diff --git a/samples/AgentWithRAG_Step06_ChromaRAG_Ollama/README.md b/samples/AgentWithRAG_Step06_ChromaRAG_Ollama/README.md index caab19b..ff202d2 100644 --- a/samples/AgentWithRAG_Step06_ChromaRAG_Ollama/README.md +++ b/samples/AgentWithRAG_Step06_ChromaRAG_Ollama/README.md @@ -1,6 +1,9 @@ # Agent Framework Retrieval Augmented Generation (RAG) with Chroma and Ollama -This sample is [RAG with Chroma and a custom schema](../AgentWithRAG_Step06_ChromaRAG/) with models that run locally in [Ollama](https://ollama.com/) instead of Microsoft Foundry. It demonstrates how to create and run an agent that uses Retrieval Augmented Generation (RAG) with [Chroma](https://www.trychroma.com/) as the vector store, through `ChromaVectorStore` from [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData), with a custom schema for the documents. +This sample is [RAG with Chroma and a custom schema](../AgentWithRAG_Step06_ChromaRAG/) with models that run locally in [Ollama](https://ollama.com/) instead of Microsoft Foundry. + +It demonstrates how to create and run an agent that uses Retrieval Augmented Generation (RAG) with [Chroma](https://www.trychroma.com/) as the vector store. It connects to Chroma through `ChromaVectorStore` from [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData). +It also uses a custom schema for the documents. ## Prerequisites @@ -11,9 +14,11 @@ This sample is [RAG with Chroma and a custom schema](../AgentWithRAG_Step06_Chro docker compose up -d ``` -The first run downloads `qwen2.5:3b` and `nomic-embed-text`, about 2 GB; `docker compose logs -f ollama-models` shows the progress. +The first run downloads `qwen2.5:3b` and `nomic-embed-text` (about 2 GB). To see the progress, run `docker compose logs -f ollama-models`. + +**Note**: The search text includes the recent messages, so it can be long. The `nomic-embed-text` model embeds up to 8,192 tokens, while smaller embedding models would cut off the end of the text, which is the latest question. -**Note**: The search text includes the recent messages, so it can be long: `nomic-embed-text` embeds up to 8,192 tokens, where smaller embedding models would cut the end of the text, the latest question. The sample also raises the context window of Ollama, since five chunks of documentation and the chat history do not fit in the default one. A larger chat model than `qwen2.5:3b` gives better answers. +The sample also raises the Ollama context window, because five chunks of documentation and the chat history do not fit in the default one. A larger chat model than `qwen2.5:3b` gives better answers. ## Running the sample from the console @@ -32,4 +37,4 @@ Execute the following command to build and run the sample: dotnet run ``` -The documents go in a collection of their own, `documentation-local`, since the local embedding model has fewer dimensions than the Foundry one. +The documents go in their own collection, `documentation-local`, because the local embedding model has fewer dimensions than the Foundry one. diff --git a/samples/AgentWithRAG_Step07_ChromaBasicTextRAG/AgentWithRAG_Step07_ChromaBasicTextRAG.csproj b/samples/AgentWithRAG_Step07_ChromaBasicTextRAG/AgentWithRAG_Step07_ChromaBasicTextRAG.csproj index 2c50625..1c8fd91 100644 --- a/samples/AgentWithRAG_Step07_ChromaBasicTextRAG/AgentWithRAG_Step07_ChromaBasicTextRAG.csproj +++ b/samples/AgentWithRAG_Step07_ChromaBasicTextRAG/AgentWithRAG_Step07_ChromaBasicTextRAG.csproj @@ -12,7 +12,7 @@ - + diff --git a/samples/AgentWithRAG_Step07_ChromaBasicTextRAG/README.md b/samples/AgentWithRAG_Step07_ChromaBasicTextRAG/README.md index 631ccfc..95f774b 100644 --- a/samples/AgentWithRAG_Step07_ChromaBasicTextRAG/README.md +++ b/samples/AgentWithRAG_Step07_ChromaBasicTextRAG/README.md @@ -1,7 +1,7 @@ # Agent Framework Retrieval Augmented Generation (RAG) with Chroma and the TextSearchStore -This sample demonstrates how to create and run an agent that uses Retrieval Augmented Generation (RAG) with [Chroma](https://www.trychroma.com/) as the vector store, through `ChromaVectorStore` from [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData). -The documents are stored by the `TextSearchStore` of the [Agent Framework sample](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG), copied here as it is: a sample store implementation that hardcodes a storage schema, and writes and reads the records as dictionaries. +This sample demonstrates how to create and run an agent that uses Retrieval Augmented Generation (RAG) with [Chroma](https://www.trychroma.com/) as the vector store. It connects to Chroma through `ChromaVectorStore` from [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData). +The documents are stored by the `TextSearchStore` from the [Agent Framework sample](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG), copied here unchanged. It is a sample store implementation that hardcodes a storage schema. It writes and reads the records as dictionaries. ## Prerequisites @@ -10,15 +10,15 @@ The documents are stored by the `TextSearchStore` of the [Agent Framework sample - A chat model deployment (the default is `gpt-5.4-mini`) - A `text-embedding-3-large` deployment with 3,072 dimensions - Azure CLI installed and authenticated (`az login`) with an identity that has the Foundry User role on the Foundry resource -- A running Chroma server, 1.5.0 or later: `docker compose up -d chroma` at the root of the repository starts the instance defined in the [compose file](../../compose.yaml), or you can run a local instance using Docker: +- A running Chroma server, version 1.5.0 or later. To start the instance defined in the [compose file](../../compose.yaml), run `docker compose up -d chroma` at the root of the repository. Or you can run a local instance using Docker: ```powershell docker run -d --name chroma -p 8000:8000 chromadb/chroma:1.5.9 ``` -**Note**: The Foundry project endpoint does not serve embeddings, so the sample generates them through the endpoint of the Foundry resource that hosts the project, with the same credential. +**Note**: The Foundry project endpoint does not serve embeddings. The sample generates them through the endpoint of the Foundry resource that hosts the project, using the same credential. -**Note**: The sample keeps the chat history in an `InMemoryChatHistoryProvider`, so that the search results of the `TextSearchProvider` are not stored with it. Microsoft Foundry would otherwise store the responses and manage the conversation itself, which cannot be combined with a `ChatHistoryProvider`, so the sample turns off the storage of the responses. +**Note**: The sample keeps the chat history in an `InMemoryChatHistoryProvider`, so the `TextSearchProvider` search results are not stored with it. Otherwise, Microsoft Foundry would store the responses and manage the conversation itself. That cannot be combined with a `ChatHistoryProvider`, so the sample turns off response storage. ## Running the sample from the console @@ -37,4 +37,6 @@ Execute the following command to build and run the sample: dotnet run ``` -The sample stores three documents of Contoso Outdoors in Chroma, and asks three questions about them. The search before each question returns only the top document, which shows that each question finds the document that answers it, and the agent cites its source. +The sample stores three Contoso Outdoors documents in Chroma and asks three questions about them. + +Before each question, the search returns only the top document. This shows that each question finds the document that answers it. The agent cites the source of that document. diff --git a/samples/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama.csproj b/samples/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama.csproj index 0385d66..8a9358e 100644 --- a/samples/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama.csproj +++ b/samples/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama.csproj @@ -10,7 +10,7 @@ - + diff --git a/samples/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama/README.md b/samples/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama/README.md index 1d31387..8ac5443 100644 --- a/samples/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama/README.md +++ b/samples/AgentWithRAG_Step07_ChromaBasicTextRAG_Ollama/README.md @@ -1,6 +1,9 @@ # Agent Framework Retrieval Augmented Generation (RAG) with Chroma, the TextSearchStore and Ollama -This sample is [RAG with Chroma and the TextSearchStore](../AgentWithRAG_Step07_ChromaBasicTextRAG/) with models that run locally in [Ollama](https://ollama.com/) instead of Microsoft Foundry. It demonstrates how to create and run an agent that uses Retrieval Augmented Generation (RAG) with [Chroma](https://www.trychroma.com/) as the vector store, through `ChromaVectorStore` from [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData), with the documents stored by the `TextSearchStore` of that sample. +This sample is [RAG with Chroma and the TextSearchStore](../AgentWithRAG_Step07_ChromaBasicTextRAG/) with models that run locally in [Ollama](https://ollama.com/) instead of Microsoft Foundry. + +It demonstrates how to create and run an agent that uses Retrieval Augmented Generation (RAG) with [Chroma](https://www.trychroma.com/) as the vector store. It connects to Chroma through `ChromaVectorStore` from [ChromaDotNet.VectorData](https://www.nuget.org/packages/ChromaDotNet.VectorData). +The documents are stored by the `TextSearchStore` from that sample. ## Prerequisites @@ -11,7 +14,7 @@ This sample is [RAG with Chroma and the TextSearchStore](../AgentWithRAG_Step07_ docker compose up -d ``` -The first run downloads `qwen2.5:3b` and `nomic-embed-text`, about 2 GB; `docker compose logs -f ollama-models` shows the progress. +The first run downloads `qwen2.5:3b` and `nomic-embed-text` (about 2 GB). To see the progress, run `docker compose logs -f ollama-models`. ## Running the sample from the console @@ -31,4 +34,4 @@ Execute the following command to build and run the sample: dotnet run ``` -The documents go in a collection of their own, `product-and-policy-info-local`, since the local embedding model has fewer dimensions than the Foundry one. +The documents go in their own collection, `product-and-policy-info-local`, because the local embedding model has fewer dimensions than the Foundry one. diff --git a/test/ChromaDB.AgentFramework.Sample.Tests/ChromaDB.AgentFramework.Sample.Tests.csproj b/test/ChromaDB.AgentFramework.Sample.Tests/ChromaDB.AgentFramework.Sample.Tests.csproj index 047fe9c..7b1946d 100644 --- a/test/ChromaDB.AgentFramework.Sample.Tests/ChromaDB.AgentFramework.Sample.Tests.csproj +++ b/test/ChromaDB.AgentFramework.Sample.Tests/ChromaDB.AgentFramework.Sample.Tests.csproj @@ -12,7 +12,7 @@ - +