Skip to content

Commit b6de33c

Browse files
authored
Merge pull request #44 from UiPath/fix/docs_cleanup
feat(docs): update docs
2 parents 029c5a6 + ab45666 commit b6de33c

File tree

4 files changed

+46
-41
lines changed

4 files changed

+46
-41
lines changed

docs/chat_models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ llm = UiPathNormalizedChatModel(
8181
)
8282
```
8383

84-
Currently the following models can be used with `UiPathAzureChatOpenAI` (this list can be updated in the future):
84+
Currently the following models can be used with `UiPathNormalizedChatModel` (this list can be updated in the future):
8585
- `anthropic.claude-3-5-sonnet-20240620-v1:0`, `anthropic.claude-3-5-sonnet-20241022-v2:0`, `anthropic.claude-3-7-sonnet-20250219-v1:0`, `anthropic.claude-3-haiku-20240307-v1:0`, `gemini-1.5-pro-001`, `gemini-2.0-flash-001`, `gpt-4o-2024-05-13`, `gpt-4o-2024-08-06`, `gpt-4o-2024-11-20`, `gpt-4o-mini-2024-07-18`, `o3-mini-2025-01-31`
8686

8787
### Note

docs/context_grounding_chain.md

Lines changed: 0 additions & 38 deletions
This file was deleted.

docs/context_grounding_retriever.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Context Grounding Retriever
1+
# ContextGroundingRetriever
22

33
The `ContextGroundingRetriever` is a document retrieval system that uses vector search to efficiently find and retrieve relevant information from your document store.
44

@@ -10,6 +10,8 @@ The `ContextGroundingRetriever` is a document retrieval system that uses vector
1010
- Retrieve context-relevant documents for various applications
1111

1212

13+
You will need to create an index in `Context Grounding` to use this feature. To create an index go to organization `Admin` -> `AI Trust Layer` -> `Context Grounding`. There you can create a new index and add documents to it. See the full documentation [here](https://docs.uipath.com/automation-cloud/automation-cloud/latest/admin-guide/about-context-grounding) for more details.
14+
1315
## Basic Usage
1416

1517
Create a simple retriever by specifying an index name:
@@ -18,14 +20,15 @@ Create a simple retriever by specifying an index name:
1820
from uipath_langchain.retrievers import ContextGroundingRetriever
1921

2022
retriever = ContextGroundingRetriever(index_name = "Company Policy Context")
21-
pprint(retriever.invoke("What is the company policy on remote work?"))
23+
print(retriever.invoke("What is the company policy on remote work?"))
2224
```
2325

2426
## Integration with LangChain Tools
2527

2628
You can easily integrate the retriever with LangChain's tool system:
2729

2830
```python
31+
from langchain.agents import create_react_agent
2932
from langchain.tools.retriever import create_retriever_tool
3033
from uipath_langchain.retrievers import ContextGroundingRetriever
3134

@@ -38,6 +41,11 @@ retriever_tool = create_retriever_tool(
3841
Use a meaningful query to load relevant information from the documents. Save the citation for later use.
3942
"""
4043
)
44+
45+
# You can use the tool in your agents
46+
model = OpenAI()
47+
tools = [retriever_tool]
48+
agent = create_react_agent(model, tools, prompt="Answer user questions as best as you can using the search tool.")
4149
```
4250

4351

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# ContextGroundingVectorStore
2+
3+
`ContextGroundingVectorStore` is a vector store implementation designed for context-aware document retrieval. It allows you to perform semantic searches and create retrieval chains with language models.
4+
5+
You will need to create an index in `Context Grounding` to use this feature. To create an index go to organization `Admin` -> `AI Trust Layer` -> `Context Grounding`. There you can create a new index and add documents to it. See the full documentation [here](https://docs.uipath.com/automation-cloud/automation-cloud/latest/admin-guide/about-context-grounding) for more details.
6+
7+
8+
## Searching Documents
9+
10+
The vector store supports various search methods:
11+
12+
```python
13+
from uipath_langchain.vectorstores.context_grounding_vectorstore import ContextGroundingVectorStore
14+
15+
vectorstore = ContextGroundingVectorStore(index_name="Company policy")
16+
17+
# Perform semantic searches with distance scores
18+
docs_with_scores = vectorstore.asimilarity_search_with_score(query="What is the company policy on data storage?", k=5)
19+
20+
# Perform a similarity search with relevance scores
21+
docs_with_relevance_scores = await vectorstore.asimilarity_search_with_relevance_scores(query=query, k=5)
22+
```
23+
24+
## Creating a Retrieval Chain
25+
26+
You can integrate the vector store into a retrieval chain with a language model:
27+
28+
```python
29+
# Run a retrieval chain
30+
model = UiPathAzureChatOpenAI(model="gpt-4o-2024-08-06", max_retries=3)
31+
retrieval_chain = create_retrieval_chain(vectorstore=vectorstore, model=model)
32+
33+
query = "What is the ECCN for a laptop?"
34+
result = retrieval_chain(query)
35+
```

0 commit comments

Comments
 (0)