Skip to content

Commit 9a98f9c

Browse files
authored
clean up docs formatting (#8)
1 parent feebc08 commit 9a98f9c

File tree

5 files changed

+57
-29
lines changed

5 files changed

+57
-29
lines changed

examples/available_tools.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Get available tools from your StackOne organisation based on the account id.
33
44
This example demonstrates different ways to filter and organize tools:
5+
56
1. Getting all available tools
67
2. Filtering by vertical
78
3. Using multiple patterns for cross-vertical functionality
@@ -25,15 +26,21 @@
2526
def get_available_tools() -> None:
2627
toolset = StackOneToolSet()
2728

28-
# First, get all tools
29+
"""
30+
We can get all tools using the `get_tools` method.
31+
"""
2932
all_tools = toolset.get_tools()
3033
assert len(all_tools) > 100, "Expected at least 100 tools in total"
3134

32-
# Then, let's get just HRIS tools using a vertical filter
35+
"""
36+
Then, let's get just HRIS tools using a filter. This filter accepts glob patterns.
37+
"""
3338
hris_tools = toolset.get_tools("hris_*")
3439
assert len(hris_tools) > 10, "Expected at least 10 HRIS tools"
3540

36-
# Now, let's get people-related tools across verticals
41+
"""
42+
Filter with multiple patterns. This will return all tools that match either pattern (OR operator).
43+
"""
3744
people_tools = toolset.get_tools(
3845
[
3946
"hris_*employee*",
@@ -46,19 +53,25 @@ def get_available_tools() -> None:
4653
f"Tool {tool.name} doesn't contain 'employee' or 'contact'"
4754
)
4855

49-
# We can also filter by specific operations across all verticals
56+
"""
57+
Filter by specific operations across all verticals using a glob pattern.
58+
"""
5059
upload_tools = toolset.get_tools("*upload*")
5160
assert len(upload_tools) > 0, "Expected at least one upload tool"
5261
for tool in upload_tools:
5362
assert "upload" in tool.name.lower(), f"Tool {tool.name} doesn't contain 'upload'"
5463

55-
# Get all tools except HRIS
64+
"""
65+
The exclude pattern is also supported.
66+
"""
5667
non_hris_tools = toolset.get_tools("!hris_*")
5768
assert len(non_hris_tools) > 0, "Expected at least one non-HRIS tool"
5869
for tool in non_hris_tools:
5970
assert not tool.name.startswith("hris_"), f"Tool {tool.name} should not be an HRIS tool"
6071

61-
# Complex filtering with positive and negative patterns
72+
"""
73+
More hectic example:
74+
"""
6275
list_tools = toolset.get_tools(
6376
[
6477
"*list*", # Include list operations

examples/error_handling.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121

2222
def error_handling() -> None:
23-
# Example 1: Configuration error - missing API key
23+
"""
24+
Example 1: Configuration error - missing API key
25+
"""
2426
original_api_key = os.environ.pop("STACKONE_API_KEY", None)
2527
try:
2628
try:
@@ -35,7 +37,9 @@ def error_handling() -> None:
3537
if original_api_key:
3638
os.environ["STACKONE_API_KEY"] = original_api_key
3739

38-
# Example 2: Invalid vertical error
40+
"""
41+
Example 2: Invalid vertical error
42+
"""
3943
toolset = StackOneToolSet()
4044
try:
4145
# Use a non-existent vertical to trigger error
@@ -45,7 +49,9 @@ def error_handling() -> None:
4549
except ToolsetLoadError as e:
4650
assert "Error loading tools" in str(e)
4751

48-
# Example 3: API error - invalid request
52+
"""
53+
Example 3: API error - invalid request
54+
"""
4955
toolset = StackOneToolSet()
5056
tools = toolset.get_tools("crm_*")
5157

examples/file_uploads.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
employee_id = "c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA"
2323

2424
"""
25-
## Resume content
25+
# Resume content
2626
2727
This is a sample resume content that will be uploaded to StackOne.
28+
2829
"""
2930

3031
resume_content = """
@@ -44,9 +45,10 @@
4445

4546

4647
"""
47-
## Upload employee document
48+
# Upload employee document
4849
4950
This function uploads a resume using the `hris_upload_employee_document` tool.
51+
5052
"""
5153

5254

examples/index.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
StackOne AI provides a unified interface for accessing various SaaS tools through AI-friendly APIs.
33
4-
## Installation
4+
# Installation
55
66
```bash
77
# Using pip
@@ -11,7 +11,7 @@
1111
uv add stackone-ai
1212
```
1313
14-
## How to use these docs
14+
# How to use these docs
1515
1616
All examples are complete and runnable.
1717
We use [uv](https://docs.astral.sh/uv/getting-started/installation/) for python dependency management.
@@ -23,13 +23,7 @@
2323
uv run examples/index.py
2424
```
2525
26-
## Package Usage
27-
"""
28-
29-
from stackone_ai import StackOneToolSet
30-
31-
"""
32-
## Authentication
26+
# Authentication
3327
3428
Set the `STACKONE_API_KEY` environment variable:
3529
@@ -39,12 +33,13 @@
3933
4034
or load from a .env file:
4135
"""
36+
4237
from dotenv import load_dotenv
4338

4439
load_dotenv()
4540

4641
"""
47-
## Account IDs
42+
# Account IDs
4843
4944
StackOne uses account IDs to identify different integrations.
5045
See the example [stackone-account-ids.md](stackone-account-ids.md) for more details.
@@ -54,6 +49,12 @@
5449

5550
account_id = "45072196112816593343"
5651

52+
"""
53+
# Quickstart
54+
"""
55+
56+
from stackone_ai import StackOneToolSet
57+
5758

5859
def quickstart():
5960
toolset = StackOneToolSet()
@@ -73,7 +74,7 @@ def quickstart():
7374
quickstart()
7475

7576
"""
76-
## Next Steps
77+
# Next Steps
7778
7879
Check out some more documentation:
7980
@@ -84,8 +85,8 @@ def quickstart():
8485
8586
Or get started with an integration:
8687
87-
- [OpenAI Integration](openai-integration.md)
88-
- [LangChain Integration](langchain-integration.md)
89-
- [CrewAI Integration](crewai-integration.md)
90-
- [LangGraph Tool Node](langgraph-tool-node.md)
88+
- [OpenAI](openai-integration.md)
89+
- [LangChain](langchain-integration.md)
90+
- [CrewAI](crewai-integration.md)
91+
- [LangGraph](langgraph-tool-node.md)
9192
"""

examples/stackone_account_ids.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,22 @@
1616
def stackone_account_ids():
1717
toolset = StackOneToolSet()
1818

19-
# Filter by pattern and set the account ID
19+
"""
20+
Set the account ID whilst getting tools.
21+
"""
2022
tools = toolset.get_tools("hris_*", account_id="test_id")
2123

22-
# You can over write the account ID here..
24+
"""
25+
You can over write the account ID on fetched tools.
26+
"""
2327
tools.set_account_id("a_different_id")
2428

2529
employee_tool = tools.get_tool("hris_get_employee")
2630
assert employee_tool is not None
2731

28-
# You can even set the account ID on a per-tool basis
32+
"""
33+
You can even set the account ID on a per-tool basis.
34+
"""
2935
employee_tool.set_account_id("again_another_id")
3036
assert employee_tool.get_account_id() == "again_another_id"
3137

0 commit comments

Comments
 (0)