Skip to content

Commit 7a2984c

Browse files
author
Matt Carey
committed
feat: docs site
1 parent 2946dfb commit 7a2984c

File tree

13 files changed

+494
-39
lines changed

13 files changed

+494
-39
lines changed

.github/workflows/docs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
deploy:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v4
22+
with:
23+
enable-cache: true
24+
25+
- name: Install docs dependencies
26+
run: uv pip install -r requirements-docs.txt
27+
28+
- name: Build documentation
29+
run: |
30+
uv run scripts/build_docs.py
31+
uv run mkdocs build
32+
33+
- name: Deploy to GitHub Pages
34+
if: github.ref == 'refs/heads/main'
35+
uses: peaceiris/actions-gh-pages@v3
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
publish_dir: ./site

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@
77
__pycache__
88

99
.DS_Store
10+
11+
# Documentation build
12+
.docs/
13+
site/

.pre-commit-config.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
repos:
2-
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.3.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.9.6
44
hooks:
5-
- id: ruff
6-
args: [ --fix ]
7-
- id: ruff-format
8-
9-
- repo: https://github.com/pre-commit/mirrors-mypy
5+
- id: ruff
6+
args: [--fix]
7+
- id: ruff-format
8+
9+
- repo: https://github.com/pre-commit/mirrors-mypy
1010
rev: v1.8.0
1111
hooks:
12-
- id: mypy
12+
- id: mypy
1313
files: ^packages/stackone-ai/stackone_ai/
14-
additional_dependencies:
14+
additional_dependencies:
1515
- types-requests
16-
- types-PyYAML
16+
- types-PyYAML

examples/api_reference.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
"""
2+
## StackOneToolSet
3+
4+
The main class for accessing StackOne tools.
5+
6+
### Constructor
7+
8+
```python
9+
StackOneToolSet(
10+
api_key: str | None = None,
11+
account_id: str | None = None
12+
)
13+
```
14+
15+
**Parameters:**
16+
- `api_key`: Optional API key. If not provided, uses `STACKONE_API_KEY` env variable
17+
- `account_id`: Optional account ID. If not provided, uses `STACKONE_ACCOUNT_ID` env variable
18+
19+
### Methods
20+
21+
#### get_tools
22+
23+
```python
24+
def get_tools(
25+
vertical: str,
26+
account_id: str | None = None
27+
) -> Tools
28+
```
29+
30+
Get tools for a specific vertical.
31+
32+
**Parameters:**
33+
- `vertical`: The vertical to get tools for (e.g. "hris", "crm")
34+
- `account_id`: Optional account ID override. If not provided, uses the one from initialization
35+
36+
**Returns:**
37+
- `Tools` instance containing available tools
38+
39+
## Tools
40+
41+
Container for Tool instances.
42+
43+
### Methods
44+
45+
#### get_tool
46+
47+
```python
48+
def get_tool(name: str) -> BaseTool | None
49+
```
50+
51+
Get a tool by its name.
52+
53+
**Parameters:**
54+
- `name`: Name of the tool to get
55+
56+
**Returns:**
57+
- `BaseTool` instance if found, None otherwise
58+
59+
#### to_openai
60+
61+
```python
62+
def to_openai() -> list[dict]
63+
```
64+
65+
Convert all tools to OpenAI function format.
66+
67+
**Returns:**
68+
- List of tools in OpenAI function format
69+
70+
## BaseTool
71+
72+
Base class for individual tools.
73+
74+
### Methods
75+
76+
#### execute
77+
78+
```python
79+
def execute(arguments: str | dict) -> dict[str, Any]
80+
```
81+
82+
Execute the tool with the given parameters.
83+
84+
**Parameters:**
85+
- `arguments`: Either a JSON string or dict of arguments
86+
87+
**Returns:**
88+
- Tool execution results
89+
90+
#### to_openai_function
91+
92+
```python
93+
def to_openai_function() -> dict
94+
```
95+
96+
Convert this tool to OpenAI's function format.
97+
98+
**Returns:**
99+
- Tool definition in OpenAI function format
100+
"""
101+
102+
# Example usage of the API
103+
from stackone_ai import StackOneToolSet
104+
105+
# Initialize with environment variables
106+
toolset = StackOneToolSet()
107+
108+
# Get tools for HRIS vertical
109+
tools = toolset.get_tools(vertical="hris")
110+
111+
# Get a specific tool
112+
employee_tool = tools.get_tool("get_employee")
113+
if employee_tool:
114+
# Execute the tool
115+
result = employee_tool.execute({"id": "employee123"})
116+
117+
# Convert to OpenAI format
118+
openai_function = employee_tool.to_openai_function()

examples/basic_tool_usage.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
"""
2+
This example shows how to use StackOne tools.
3+
4+
## Requirements
5+
- STACKONE_API_KEY
6+
- STACKONE_ACCOUNT_ID
7+
"""
8+
19
import os
210

311
from dotenv import load_dotenv
@@ -17,9 +25,19 @@ def main():
1725
# Initialize the toolset with your API key
1826
toolset = StackOneToolSet(api_key=api_key)
1927

20-
# Get tools for a specific vertical (e.g. "hris")
28+
"""
29+
## Using Tools
30+
31+
Once initialized, you can get tools for specific verticals:
32+
"""
33+
34+
# Get HRIS tools
2135
tools = toolset.get_tools(vertical="hris", account_id=account_id)
2236

37+
"""
38+
Then use specific tools by name:
39+
"""
40+
2341
# Example: Get an employee by ID
2442
try:
2543
# The tool name comes from the x-speakeasy-name-override in the OpenAPI spec

examples/getting_started.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"""
2+
# Getting Started with StackOne AI
3+
4+
StackOne AI provides a unified interface for accessing various SaaS tools through AI-friendly APIs.
5+
6+
## Installation
7+
8+
Install StackOne AI using pip:
9+
10+
```bash
11+
pip install stackone-ai
12+
```
13+
14+
15+
## Quick Start
16+
17+
Here's a simple example to get you started:
18+
"""
19+
20+
import os
21+
22+
from dotenv import load_dotenv
23+
from stackone_ai import StackOneToolSet
24+
25+
26+
def quickstart():
27+
# Load environment variables
28+
load_dotenv()
29+
30+
api_key = os.getenv("STACKONE_API_KEY")
31+
account_id = os.getenv("STACKONE_ACCOUNT_ID")
32+
33+
# Initialize the toolset
34+
toolset = StackOneToolSet(api_key=api_key)
35+
36+
# Get HRIS tools
37+
tools = toolset.get_tools(vertical="hris", account_id=account_id)
38+
39+
# Use a specific tool
40+
employee_tool = tools.get_tool("get_employee")
41+
if employee_tool:
42+
employee = employee_tool.execute({"id": "employee_id"})
43+
print(employee)
44+
45+
46+
"""
47+
## Authentication
48+
49+
StackOne AI requires two key pieces of information:
50+
- `STACKONE_API_KEY`: Your API key from StackOne
51+
- `STACKONE_ACCOUNT_ID`: Your account ID
52+
53+
You can set these as environment variables or pass them directly to the StackOneToolSet constructor.
54+
55+
## Next Steps
56+
57+
Check out some examples:
58+
- [Basic Tool Usage](basic-tool-usage.md)
59+
- [Error Handling](error-handling.md)
60+
- [OpenAI Integration](openai-integration.md)
61+
"""

mkdocs.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
site_name: StackOne AI SDK
2+
site_url: https://stackonehq.github.io/stackone-ai-python
3+
repo_url: https://github.com/StackOneHQ/stackone-ai-python
4+
repo_name: StackOneHQ/stackone-ai-python
5+
6+
docs_dir: .docs
7+
8+
theme:
9+
name: material
10+
palette:
11+
- media: "(prefers-color-scheme: light)"
12+
scheme: default
13+
primary: indigo
14+
accent: indigo
15+
toggle:
16+
icon: material/brightness-7
17+
name: Switch to dark mode
18+
- media: "(prefers-color-scheme: dark)"
19+
scheme: slate
20+
primary: indigo
21+
accent: indigo
22+
toggle:
23+
icon: material/brightness-4
24+
name: Switch to light mode
25+
features:
26+
- navigation.instant
27+
- navigation.tracking
28+
- navigation.sections
29+
- navigation.expand
30+
- navigation.indexes
31+
- toc.follow
32+
- content.code.copy
33+
34+
markdown_extensions:
35+
- pymdownx.highlight:
36+
anchor_linenums: true
37+
- pymdownx.inlinehilite
38+
- pymdownx.snippets
39+
- pymdownx.superfences
40+
- admonition
41+
- pymdownx.details
42+
- attr_list
43+
- md_in_html
44+
45+
nav:
46+
- Home: getting-started.md
47+
- Examples:
48+
- Basic Tool Usage: basic-tool-usage.md
49+
- Error Handling: error-handling.md
50+
- OpenAI Integration: openai-integration.md
51+
- API Reference: api-reference.md

0 commit comments

Comments
 (0)