Skip to content

Commit 440f76a

Browse files
authored
Merge pull request #2 from Governs-AI/ci/setup
Ci/setup
2 parents f2ad78f + 830483e commit 440f76a

19 files changed

Lines changed: 1376 additions & 109 deletions

.github/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
name: Format & Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.11"
19+
cache: pip
20+
21+
- name: Install linters
22+
run: pip install black flake8
23+
24+
- name: black
25+
run: black --check governs_ai/ tests/
26+
27+
- name: flake8
28+
run: flake8 governs_ai/ tests/ --max-line-length=88 --extend-ignore=E203,W503
29+
30+
typecheck:
31+
name: Type Check
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- uses: actions/setup-python@v5
37+
with:
38+
python-version: "3.11"
39+
cache: pip
40+
41+
- name: Install package with dev extras
42+
run: pip install -e ".[dev]"
43+
44+
- name: mypy
45+
run: mypy governs_ai/ --ignore-missing-imports
46+
47+
test:
48+
name: Tests
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
53+
- uses: actions/setup-python@v5
54+
with:
55+
python-version: "3.11"
56+
cache: pip
57+
58+
- name: Install package with dev extras
59+
run: pip install -e ".[dev]"
60+
61+
- name: pytest
62+
run: pytest tests/ -v --tb=short
63+
64+
secret-scan:
65+
name: Secret Scan
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v4
69+
with:
70+
fetch-depth: 0
71+
72+
- uses: gitleaks/gitleaks-action@v2
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
publish:
10+
name: Build & Publish
11+
runs-on: ubuntu-latest
12+
environment: pypi
13+
permissions:
14+
id-token: write # OIDC trusted publishing
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.11"
22+
23+
- name: Install build tools
24+
run: pip install build
25+
26+
- name: Build distribution
27+
run: python -m build
28+
29+
- name: Publish to PyPI
30+
uses: pypa/gh-action-pypi-publish@release/v1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ from governs_ai import GovernsAIClient
2525
# Create client with organization context
2626
client = GovernsAIClient(
2727
api_key="your-api-key",
28-
base_url="http://localhost:3002",
28+
base_url="https://api.governsai.com",
2929
org_id="org-456" # Organization context (static)
3030
)
3131

docs/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ from governs_ai import GovernsAIClient
3838
# Create client with organization context
3939
client = GovernsAIClient(
4040
api_key="your-api-key",
41-
base_url="http://localhost:3002",
41+
base_url="https://api.governsai.com",
4242
org_id="org-456" # Organization context (static)
4343
)
4444

@@ -70,7 +70,7 @@ elif precheck_response.decision == "confirm":
7070

7171
```bash
7272
export GOVERNS_API_KEY="your-api-key"
73-
export GOVERNS_BASE_URL="http://localhost:3002"
73+
export GOVERNS_BASE_URL="https://api.governsai.com"
7474
export GOVERNS_ORG_ID="org-456"
7575
export GOVERNS_TIMEOUT="30000"
7676
export GOVERNS_RETRIES="3"
@@ -85,7 +85,7 @@ from governs_ai import GovernsAIClient, GovernsAIConfig
8585
# Explicit configuration
8686
config = GovernsAIConfig(
8787
api_key="your-api-key",
88-
base_url="http://localhost:3002",
88+
base_url="https://api.governsai.com",
8989
org_id="org-456",
9090
timeout=30000,
9191
retries=3,
@@ -423,7 +423,7 @@ client = GovernsAIClient(
423423
```python
424424
GovernsAIClient(
425425
api_key: str,
426-
base_url: str = "http://localhost:3002",
426+
base_url: str = "https://api.governsai.com",
427427
org_id: str,
428428
timeout: int = 30000,
429429
retries: int = 3,
@@ -770,7 +770,7 @@ import os
770770
client = GovernsAIClient(
771771
api_key=os.getenv("GOVERNS_API_KEY"),
772772
org_id=os.getenv("GOVERNS_ORG_ID"),
773-
base_url=os.getenv("GOVERNS_BASE_URL", "http://localhost:3002")
773+
base_url=os.getenv("GOVERNS_BASE_URL", "https://api.governsai.com")
774774
)
775775
```
776776

governs_ai/__init__.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from .clients.budget import BudgetClient
1313
from .clients.tool import ToolClient
1414
from .clients.analytics import AnalyticsClient
15+
from .clients.context import ContextClient
16+
from .clients.documents import DocumentClient
1517
from .models import (
1618
PrecheckRequest,
1719
PrecheckResponse,
@@ -21,6 +23,25 @@
2123
ConfirmationResponse,
2224
HealthStatus,
2325
Decision,
26+
SaveContextInput,
27+
SaveContextResponse,
28+
ContextLLMResponse,
29+
ConversationSummary,
30+
ConversationItem,
31+
MemoryRecord,
32+
MemorySearchMetadata,
33+
MemorySearchResponse,
34+
ResolvedUserDetails,
35+
ResolvedUser,
36+
DocumentUploadResponse,
37+
DocumentChunk,
38+
DocumentRecord,
39+
DocumentDetails,
40+
DocumentListPagination,
41+
DocumentListResponse,
42+
DocumentSearchSource,
43+
DocumentSearchResult,
44+
DocumentSearchResponse,
2445
)
2546
from .exceptions import (
2647
GovernsAIError,
@@ -45,6 +66,8 @@
4566
"BudgetClient",
4667
"ToolClient",
4768
"AnalyticsClient",
69+
"ContextClient",
70+
"DocumentClient",
4871
# Data models
4972
"PrecheckRequest",
5073
"PrecheckResponse",
@@ -54,6 +77,25 @@
5477
"ConfirmationResponse",
5578
"HealthStatus",
5679
"Decision",
80+
"SaveContextInput",
81+
"SaveContextResponse",
82+
"ContextLLMResponse",
83+
"ConversationSummary",
84+
"ConversationItem",
85+
"MemoryRecord",
86+
"MemorySearchMetadata",
87+
"MemorySearchResponse",
88+
"ResolvedUserDetails",
89+
"ResolvedUser",
90+
"DocumentUploadResponse",
91+
"DocumentChunk",
92+
"DocumentRecord",
93+
"DocumentDetails",
94+
"DocumentListPagination",
95+
"DocumentListResponse",
96+
"DocumentSearchSource",
97+
"DocumentSearchResult",
98+
"DocumentSearchResponse",
5799
# Exceptions
58100
"GovernsAIError",
59101
"PrecheckError",

governs_ai/client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
from .clients.budget import BudgetClient
2525
from .clients.tool import ToolClient
2626
from .clients.analytics import AnalyticsClient
27+
from .clients.context import ContextClient
28+
from .clients.documents import DocumentClient
2729
from .exceptions import GovernsAIError
2830

2931

@@ -32,7 +34,7 @@ class GovernsAIConfig:
3234
"""Configuration for GovernsAI client."""
3335

3436
api_key: str
35-
base_url: str = "http://localhost:3002"
37+
base_url: str = "https://api.governsai.com"
3638
org_id: str = ""
3739
timeout: int = 30000
3840
retries: int = 3
@@ -83,7 +85,7 @@ def __init__(
8385
else:
8486
self.config = GovernsAIConfig(
8587
api_key=api_key or os.getenv("GOVERNS_API_KEY", ""),
86-
base_url=base_url or os.getenv("GOVERNS_BASE_URL", "http://localhost:3002"),
88+
base_url=base_url or os.getenv("GOVERNS_BASE_URL", "https://api.governsai.com"),
8789
org_id=org_id or os.getenv("GOVERNS_ORG_ID", ""),
8890
timeout=timeout or int(os.getenv("GOVERNS_TIMEOUT", "30000")),
8991
retries=retries or int(os.getenv("GOVERNS_RETRIES", "3")),
@@ -116,6 +118,8 @@ def __init__(
116118
self.budget = BudgetClient(self.http_client, self.logger)
117119
self.tools = ToolClient(self.http_client, self.logger)
118120
self.analytics = AnalyticsClient(self.http_client, self.logger)
121+
self.context = ContextClient(self.http_client, self.logger)
122+
self.documents = DocumentClient(self.http_client, self.logger)
119123

120124
@classmethod
121125
def from_env(cls) -> "GovernsAIClient":

governs_ai/clients/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@
99
from .budget import BudgetClient
1010
from .tool import ToolClient
1111
from .analytics import AnalyticsClient
12+
from .context import ContextClient
13+
from .documents import DocumentClient
1214

1315
__all__ = [
1416
"PrecheckClient",
1517
"ConfirmationClient",
1618
"BudgetClient",
1719
"ToolClient",
1820
"AnalyticsClient",
21+
"ContextClient",
22+
"DocumentClient",
1923
]

0 commit comments

Comments
 (0)