|
| 1 | +# CLAUDE.md — UiPath LLM Client |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +This is a Python monorepo providing a unified client for UiPath's LLM services. It has two published packages: |
| 6 | + |
| 7 | +- **`uipath-llm-client`** (core) — located at `src/uipath/llm_client/`. Core HTTP client with auth, retry, and provider-specific clients (OpenAI, Google, Anthropic). |
| 8 | +- **`uipath-langchain-client`** (langchain) — located at `packages/uipath_langchain_client/`. LangChain-compatible chat models and embeddings, depends on the core package. |
| 9 | + |
| 10 | +Supported backends: **AgentHub** (default), **LLMGateway**, and **Orchestrator**. |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +## Development Setup |
| 15 | + |
| 16 | +Uses [uv](https://docs.astral.sh/uv/) with workspace support. |
| 17 | + |
| 18 | +```bash |
| 19 | +uv sync --all-extras |
| 20 | +``` |
| 21 | + |
| 22 | +Run tests: |
| 23 | +```bash |
| 24 | +pytest tests |
| 25 | +``` |
| 26 | + |
| 27 | +Lint and format: |
| 28 | +```bash |
| 29 | +ruff check |
| 30 | +ruff format --check |
| 31 | +pyright |
| 32 | +``` |
| 33 | + |
| 34 | +Tests use VCR cassettes (SQLite, `tests/cassettes.db`) via `pytest-recording`. HTTP is recorded and replayed; real network calls are not made in CI. |
| 35 | + |
| 36 | +--- |
| 37 | + |
| 38 | +## Repository Structure |
| 39 | + |
| 40 | +``` |
| 41 | +src/uipath/llm_client/ # Core package source |
| 42 | + clients/ # Provider clients (openai, google, anthropic) |
| 43 | + settings/ # Backend settings (platform, llmgateway) |
| 44 | + utils/ # Shared utilities |
| 45 | + __version__.py # Core version string |
| 46 | +packages/uipath_langchain_client/ |
| 47 | + src/uipath_langchain_client/ |
| 48 | + clients/ # LangChain model wrappers per provider |
| 49 | + __version__.py # LangChain version string |
| 50 | + pyproject.toml # LangChain package config (declares core dep) |
| 51 | +pyproject.toml # Root workspace config |
| 52 | +CHANGELOG.md # Core changelog |
| 53 | +packages/uipath_langchain_client/CHANGELOG.md # LangChain changelog |
| 54 | +tests/ # All tests (core/, langchain/, llamaindex/) |
| 55 | +.github/workflows/ # CI/CD pipelines |
| 56 | +``` |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +## Versioning Rules |
| 61 | + |
| 62 | +Both packages follow semantic versioning. The CD pipelines trigger on version changes in the respective `__version__.py` files. |
| 63 | + |
| 64 | +### When core client changes |
| 65 | + |
| 66 | +Update **all** of the following: |
| 67 | + |
| 68 | +1. `src/uipath/llm_client/__version__.py` — bump core version |
| 69 | +2. `packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py` — bump to same version |
| 70 | +3. `packages/uipath_langchain_client/pyproject.toml` — update the `uipath-llm-client >= X.Y.Z` dependency to match the new core version |
| 71 | +4. `CHANGELOG.md` — add entry under new version |
| 72 | +5. `packages/uipath_langchain_client/CHANGELOG.md` — add entry under new version |
| 73 | + |
| 74 | +### When only langchain changes |
| 75 | + |
| 76 | +Update **only**: |
| 77 | + |
| 78 | +1. `packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py` — bump langchain version |
| 79 | +2. `packages/uipath_langchain_client/CHANGELOG.md` — add entry under new version |
| 80 | + |
| 81 | +Do **not** touch the core `__version__.py` or root `CHANGELOG.md` for langchain-only changes. |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## CHANGELOG Format |
| 86 | + |
| 87 | +Follow the existing format — newest version first, grouped by date: |
| 88 | + |
| 89 | +```markdown |
| 90 | +## [X.Y.Z] - YYYY-MM-DD |
| 91 | + |
| 92 | +### Added / Fixed / Changed |
| 93 | +- Description of the change |
| 94 | +``` |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +## PR Guidelines |
| 99 | + |
| 100 | +### Before Opening a PR |
| 101 | + |
| 102 | +- Run `ruff check`, `ruff format --check`, and `pyright` — all must pass. |
| 103 | +- Run `pytest tests` — all tests must pass. |
| 104 | +- Apply versioning rules above: the CI workflow (`ci_change_version.yml`) enforces that any changed source files must have a corresponding version bump and changelog entry. |
| 105 | + |
| 106 | +### PR Scope |
| 107 | + |
| 108 | +- Keep PRs focused. One logical change per PR. |
| 109 | +- If a change touches both core and langchain, that is a single PR — both packages version together. |
| 110 | +- Do not mix version bumps with unrelated refactors. |
| 111 | + |
| 112 | +### What to Include in the PR Description |
| 113 | + |
| 114 | +- What changed and why. |
| 115 | +- Which package(s) are affected (core, langchain, or both). |
| 116 | +- Reference any related issues. |
| 117 | + |
| 118 | +### Dev Builds |
| 119 | + |
| 120 | +Add the `build:dev` label to a PR to trigger a dev package publish to TestPyPI. The PR description will be updated automatically with install instructions. |
| 121 | + |
| 122 | +--- |
| 123 | + |
| 124 | +## Code Style |
| 125 | + |
| 126 | +- **Formatter/linter:** ruff (config in root `pyproject.toml`) |
| 127 | +- **Type checker:** pyright (strict) |
| 128 | +- **Python version:** 3.11+ required, 3.13 used in CI |
| 129 | +- StrEnum string comparisons are acceptable — do not replace with enum constants. |
| 130 | +- Provider clients live under `clients/<provider>/` in both the core and langchain packages. |
| 131 | +- Settings use pydantic-settings with `BaseSettings`; do not add ad-hoc config. |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +## CI/CD Pipelines |
| 136 | + |
| 137 | +| Workflow | Trigger | Purpose | |
| 138 | +|---|---|---| |
| 139 | +| `ci.yml` | PR to main | Lint, type check, run tests | |
| 140 | +| `ci_change_version.yml` | PR to main | Validate version bump + changelog | |
| 141 | +| `cd.yml` | Push to main (core version change) | Build + publish core to PyPI | |
| 142 | +| `cd-langchain.yml` | Push to main (langchain version change) | Build + publish langchain to PyPI | |
| 143 | +| `publish-dev.yml` | PR with `build:dev` label | Publish dev build to TestPyPI | |
| 144 | + |
| 145 | +The langchain CD waits for the core package to appear on PyPI before building, since it depends on it. |
0 commit comments