Skip to content

Commit 649929d

Browse files
committed
added retrieval-chain workflow
1 parent c24c5b0 commit 649929d

File tree

6 files changed

+1950
-1515
lines changed

6 files changed

+1950
-1515
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Integration testing
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
integration-tests:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Build Docker image
24+
working-directory: ./samples/company-research-agent
25+
run: |
26+
docker build -t company-research-agent:test \
27+
--build-arg CLIENT_ID="${{ secrets.ALPHA_TEST_CLIENT_ID }}" \
28+
--build-arg CLIENT_SECRET="${{ secrets.ALPHA_TEST_CLIENT_SECRET }}" \
29+
--build-arg BASE_URL="${{ secrets.ALPHA_BASE_URL }}" \
30+
.
31+
exit 1 # Intentionally fail the build
32+
33+
# env:
34+
# ALPHA_BASE_URL: ${{ secrets.ALPHA_BASE_URL }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm
2+
3+
WORKDIR /app
4+
5+
COPY . .
6+
7+
RUN uv sync
8+
9+
ARG CLIENT_ID
10+
ARG CLIENT_SECRET
11+
ARG BASE_URL
12+
13+
# Validate required environment variables
14+
RUN if [ -z "$CLIENT_ID" ]; then echo "CLIENT_ID build arg is required" && exit 1; fi
15+
RUN if [ -z "$CLIENT_SECRET" ]; then echo "CLIENT_SECRET build arg is required" && exit 1; fi
16+
RUN if [ -z "$BASE_URL" ]; then echo "BASE_URL build arg is required" && exit 1; fi
17+
18+
# Set environment variables for runtime
19+
ENV CLIENT_ID=$CLIENT_ID
20+
ENV CLIENT_SECRET=$CLIENT_SECRET
21+
ENV BASE_URL=$BASE_URL
22+
ENV TAVILY_API_KEY=${TAVILY_API_KEY:-""}
23+
24+
25+
# Authenticate with UiPath during build
26+
RUN uv run uipath auth --client-id="$CLIENT_ID" --client-secret="$CLIENT_SECRET" --base-url="$BASE_URL"
27+
28+
RUN uv run uipath run agent '{"company_name":"uipath"}'

samples/company-research-agent/graph.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
import os
12
from langchain_anthropic import ChatAnthropic
23
from langchain_community.tools.tavily_search import TavilySearchResults
4+
from langchain_community.tools import DuckDuckGoSearchResults
35
from langgraph.graph import END, START, MessagesState, StateGraph
46
from langgraph.prebuilt import create_react_agent
57
from pydantic import BaseModel
8+
from uipath_langchain.chat import UiPathAzureChatOpenAI
69

710
# Set up the Tavily search tool
8-
tavily_tool = TavilySearchResults(max_results=5)
11+
if os.getenv("TAVILY_API_KEY"):
12+
tool = TavilySearchResults(max_results=5)
13+
else:
14+
tool = DuckDuckGoSearchResults()
915

1016
# Define system prompt
1117
system_prompt = """You are an advanced AI assistant specializing in corporate research and outreach strategy development. Your primary functions are:
@@ -29,10 +35,10 @@
2935
3036
DO NOT do any math as specified in your instructions.
3137
"""
38+
llm = UiPathAzureChatOpenAI(model="gpt-4o-2024-08-06")
39+
# llm = ChatAnthropic(model="claude-3-5-sonnet-latest")
3240

33-
llm = ChatAnthropic(model="claude-3-5-sonnet-latest")
34-
35-
research_agent = create_react_agent(llm, tools=[tavily_tool], prompt=system_prompt)
41+
research_agent = create_react_agent(llm, tools=[tool], prompt=system_prompt)
3642

3743

3844
class GraphState(BaseModel):

samples/company-research-agent/pyproject.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ name = "company-research-agent"
33
version = "0.0.1"
44
description = "Company research agent with Tavily web search"
55
authors = [{ name = "John Doe", email = "[email protected]" }]
6+
67
requires-python = ">=3.10"
78
dependencies = [
89
"langgraph>=0.2.55",
910
"langchain-anthropic>=0.3.8",
1011
"tavily-python>=0.5.0",
11-
"uipath-langchain==0.0.113"
12+
"uipath>=2.0.79",
13+
"uipath-langchain>=0.0.117",
14+
"duckduckgo-search>=8.1.1",
15+
"langchain-community>=0.3.21",
16+
"debugpy>=1.8.15",
1217
]
1318

1419
[project.optional-dependencies]
@@ -41,3 +46,9 @@ lint.ignore = [
4146

4247
[tool.ruff.lint.per-file-ignores]
4348
"tests/*" = ["D", "UP"]
49+
50+
[[tool.uv.index]]
51+
name = "testpypi"
52+
url = "https://test.pypi.org/simple/"
53+
publish-url = "https://test.pypi.org/legacy/"
54+
explicit = true

0 commit comments

Comments
 (0)