Skip to content

Commit 28bbbcf

Browse files
docs: adding supplementary markdown content to API specs (#3632)
# What does this PR do? Adds supplementary static content to root API spec pages. This is useful for giving context behind a specific API group, adding information on supported features or work in progress, etc. This PR introduces supplementary information for Agents (experimental, deprecated) and Responses (stable) APIs. <!-- Provide a short summary of what this PR does and why. Link to relevant issues if applicable. --> <!-- If resolving an issue, uncomment and update the line below --> <!-- Closes #[issue-number] --> ## Test Plan Documentation server renders rich static content for the Agents API group: ![image.png](https://app.graphite.dev/user-attachments/assets/fc521619-0320-4a22-9409-8ee3fb57ed0e.png) <!-- Describe the tests you ran to verify your changes with result summaries. *Provide clear instructions so the plan can be easily re-executed.* -->
1 parent b6a5bcc commit 28bbbcf

File tree

10 files changed

+381
-29
lines changed

10 files changed

+381
-29
lines changed

docs/openapi_generator/pyopenapi/generator.py

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,84 @@ def _build_extra_tag_groups(
548548

549549
return extra_tags
550550

551+
def _get_api_group_for_operation(self, op) -> str | None:
552+
"""
553+
Determine the API group for an operation based on its route path.
554+
555+
Args:
556+
op: The endpoint operation
557+
558+
Returns:
559+
The API group name derived from the route, or None if unable to determine
560+
"""
561+
if not hasattr(op, 'webmethod') or not op.webmethod or not hasattr(op.webmethod, 'route'):
562+
return None
563+
564+
route = op.webmethod.route
565+
if not route or not route.startswith('/'):
566+
return None
567+
568+
# Extract API group from route path
569+
# Examples: /v1/agents/list -> agents-api
570+
# /v1/responses -> responses-api
571+
# /v1/models -> models-api
572+
path_parts = route.strip('/').split('/')
573+
574+
if len(path_parts) < 2:
575+
return None
576+
577+
# Skip version prefix (v1, v1alpha, v1beta, etc.)
578+
if path_parts[0].startswith('v1'):
579+
if len(path_parts) < 2:
580+
return None
581+
api_segment = path_parts[1]
582+
else:
583+
api_segment = path_parts[0]
584+
585+
# Convert to supplementary file naming convention
586+
# agents -> agents-api, responses -> responses-api, etc.
587+
return f"{api_segment}-api"
588+
589+
def _load_supplemental_content(self, api_group: str | None) -> str:
590+
"""
591+
Load supplemental content for an API group based on stability level.
592+
593+
Follows this resolution order:
594+
1. docs/supplementary/{stability}/{api_group}.md
595+
2. docs/supplementary/shared/{api_group}.md (fallback)
596+
3. Empty string if no files found
597+
598+
Args:
599+
api_group: The API group name (e.g., "agents-responses-api"), or None if no mapping exists
600+
601+
Returns:
602+
The supplemental content as markdown string, or empty string if not found
603+
"""
604+
if not api_group:
605+
return ""
606+
607+
base_path = Path(__file__).parent.parent.parent / "supplementary"
608+
609+
# Try stability-specific content first if stability filter is set
610+
if self.options.stability_filter:
611+
stability_path = base_path / self.options.stability_filter / f"{api_group}.md"
612+
if stability_path.exists():
613+
try:
614+
return stability_path.read_text(encoding="utf-8")
615+
except Exception as e:
616+
print(f"Warning: Could not read stability-specific supplemental content from {stability_path}: {e}")
617+
618+
# Fall back to shared content
619+
shared_path = base_path / "shared" / f"{api_group}.md"
620+
if shared_path.exists():
621+
try:
622+
return shared_path.read_text(encoding="utf-8")
623+
except Exception as e:
624+
print(f"Warning: Could not read shared supplemental content from {shared_path}: {e}")
625+
626+
# No supplemental content found
627+
return ""
628+
551629
def _build_operation(self, op: EndpointOperation) -> Operation:
552630
if op.defining_class.__name__ in [
553631
"SyntheticDataGeneration",
@@ -799,10 +877,14 @@ def _build_operation(self, op: EndpointOperation) -> Operation:
799877
else:
800878
callbacks = None
801879

802-
description = "\n".join(
880+
# Build base description from docstring
881+
base_description = "\n".join(
803882
filter(None, [doc_string.short_description, doc_string.long_description])
804883
)
805884

885+
# Individual endpoints get clean descriptions only
886+
description = base_description
887+
806888
return Operation(
807889
tags=[
808890
getattr(op.defining_class, "API_NAMESPACE", op.defining_class.__name__)
@@ -959,10 +1041,21 @@ def sort_key(op):
9591041
if hasattr(cls, "API_NAMESPACE") and cls.API_NAMESPACE != cls.__name__:
9601042
continue
9611043

1044+
# Add supplemental content to tag pages
1045+
api_group = f"{cls.__name__.lower()}-api"
1046+
supplemental_content = self._load_supplemental_content(api_group)
1047+
1048+
tag_description = doc_string.long_description or ""
1049+
if supplemental_content:
1050+
if tag_description:
1051+
tag_description = f"{tag_description}\n\n{supplemental_content}"
1052+
else:
1053+
tag_description = supplemental_content
1054+
9621055
operation_tags.append(
9631056
Tag(
9641057
name=cls.__name__,
965-
description=doc_string.long_description,
1058+
description=tag_description,
9661059
displayName=doc_string.short_description,
9671060
)
9681061
)

docs/static/deprecated-llama-stack-spec.html

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6282,27 +6282,33 @@
62826282
"tags": [
62836283
{
62846284
"name": "Agents",
6285-
"description": "APIs for creating and interacting with agentic systems.",
6285+
"description": "APIs for creating and interacting with agentic systems.\n\n## Deprecated APIs\n\n> **⚠️ DEPRECATED**: These APIs are provided for migration reference and will be removed in future versions. Not recommended for new projects.\n\n### Migration Guidance\n\nIf you are using deprecated versions of the Agents or Responses APIs, please migrate to:\n\n- **Responses API**: Use the stable v1 Responses API endpoints\n",
62866286
"x-displayName": "Agents"
62876287
},
62886288
{
6289-
"name": "Benchmarks"
6289+
"name": "Benchmarks",
6290+
"description": ""
62906291
},
62916292
{
6292-
"name": "DatasetIO"
6293+
"name": "DatasetIO",
6294+
"description": ""
62936295
},
62946296
{
6295-
"name": "Datasets"
6297+
"name": "Datasets",
6298+
"description": ""
62966299
},
62976300
{
62986301
"name": "Eval",
6302+
"description": "",
62996303
"x-displayName": "Llama Stack Evaluation API for running evaluations on model and agent candidates."
63006304
},
63016305
{
6302-
"name": "PostTraining (Coming Soon)"
6306+
"name": "PostTraining (Coming Soon)",
6307+
"description": ""
63036308
},
63046309
{
6305-
"name": "Telemetry"
6310+
"name": "Telemetry",
6311+
"description": ""
63066312
}
63076313
],
63086314
"x-tagGroups": [

docs/static/deprecated-llama-stack-spec.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4613,17 +4613,40 @@ security:
46134613
- Default: []
46144614
tags:
46154615
- name: Agents
4616-
description: >-
4616+
description: >
46174617
APIs for creating and interacting with agentic systems.
4618+
4619+
4620+
## Deprecated APIs
4621+
4622+
4623+
> **⚠️ DEPRECATED**: These APIs are provided for migration reference and will
4624+
be removed in future versions. Not recommended for new projects.
4625+
4626+
4627+
### Migration Guidance
4628+
4629+
4630+
If you are using deprecated versions of the Agents or Responses APIs, please
4631+
migrate to:
4632+
4633+
4634+
- **Responses API**: Use the stable v1 Responses API endpoints
46184635
x-displayName: Agents
46194636
- name: Benchmarks
4637+
description: ''
46204638
- name: DatasetIO
4639+
description: ''
46214640
- name: Datasets
4641+
description: ''
46224642
- name: Eval
4643+
description: ''
46234644
x-displayName: >-
46244645
Llama Stack Evaluation API for running evaluations on model and agent candidates.
46254646
- name: PostTraining (Coming Soon)
4647+
description: ''
46264648
- name: Telemetry
4649+
description: ''
46274650
x-tagGroups:
46284651
- name: Operations
46294652
tags:

docs/static/experimental-llama-stack-spec.html

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6479,27 +6479,33 @@
64796479
"tags": [
64806480
{
64816481
"name": "Agents",
6482-
"description": "APIs for creating and interacting with agentic systems.",
6482+
"description": "APIs for creating and interacting with agentic systems.\n\n## Agents API (Experimental)\n\n> **🧪 EXPERIMENTAL**: This API is in preview and may change based on user feedback. Great for exploring new capabilities and providing feedback to influence the final design.\n\nMain functionalities provided by this API:\n\n- Create agents with specific instructions and ability to use tools.\n- Interactions with agents are grouped into sessions (\"threads\"), and each interaction is called a \"turn\".\n- Agents can be provided with various tools (see the ToolGroups and ToolRuntime APIs for more details).\n- Agents can be provided with various shields (see the Safety API for more details).\n- Agents can also use Memory to retrieve information from knowledge bases. See the RAG Tool and Vector IO APIs for more details.\n\n### 🧪 Feedback Welcome\n\nThis API is actively being developed. We welcome feedback on:\n- API design and usability\n- Performance characteristics\n- Missing features or capabilities\n- Integration patterns\n\n**Provide Feedback**: [GitHub Discussions](https://github.com/llamastack/llama-stack/discussions) or [GitHub Issues](https://github.com/llamastack/llama-stack/issues)",
64836483
"x-displayName": "Agents"
64846484
},
64856485
{
6486-
"name": "Benchmarks"
6486+
"name": "Benchmarks",
6487+
"description": ""
64876488
},
64886489
{
6489-
"name": "DatasetIO"
6490+
"name": "DatasetIO",
6491+
"description": ""
64906492
},
64916493
{
6492-
"name": "Datasets"
6494+
"name": "Datasets",
6495+
"description": ""
64936496
},
64946497
{
64956498
"name": "Eval",
6499+
"description": "",
64966500
"x-displayName": "Llama Stack Evaluation API for running evaluations on model and agent candidates."
64976501
},
64986502
{
6499-
"name": "PostTraining (Coming Soon)"
6503+
"name": "PostTraining (Coming Soon)",
6504+
"description": ""
65006505
},
65016506
{
6502-
"name": "Telemetry"
6507+
"name": "Telemetry",
6508+
"description": ""
65036509
}
65046510
],
65056511
"x-tagGroups": [

docs/static/experimental-llama-stack-spec.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4777,15 +4777,64 @@ tags:
47774777
- name: Agents
47784778
description: >-
47794779
APIs for creating and interacting with agentic systems.
4780+
4781+
4782+
## Agents API (Experimental)
4783+
4784+
4785+
> **🧪 EXPERIMENTAL**: This API is in preview and may change based on user feedback.
4786+
Great for exploring new capabilities and providing feedback to influence the
4787+
final design.
4788+
4789+
4790+
Main functionalities provided by this API:
4791+
4792+
4793+
- Create agents with specific instructions and ability to use tools.
4794+
4795+
- Interactions with agents are grouped into sessions ("threads"), and each interaction
4796+
is called a "turn".
4797+
4798+
- Agents can be provided with various tools (see the ToolGroups and ToolRuntime
4799+
APIs for more details).
4800+
4801+
- Agents can be provided with various shields (see the Safety API for more details).
4802+
4803+
- Agents can also use Memory to retrieve information from knowledge bases. See
4804+
the RAG Tool and Vector IO APIs for more details.
4805+
4806+
4807+
### 🧪 Feedback Welcome
4808+
4809+
4810+
This API is actively being developed. We welcome feedback on:
4811+
4812+
- API design and usability
4813+
4814+
- Performance characteristics
4815+
4816+
- Missing features or capabilities
4817+
4818+
- Integration patterns
4819+
4820+
4821+
**Provide Feedback**: [GitHub Discussions](https://github.com/llamastack/llama-stack/discussions)
4822+
or [GitHub Issues](https://github.com/llamastack/llama-stack/issues)
47804823
x-displayName: Agents
47814824
- name: Benchmarks
4825+
description: ''
47824826
- name: DatasetIO
4827+
description: ''
47834828
- name: Datasets
4829+
description: ''
47844830
- name: Eval
4831+
description: ''
47854832
x-displayName: >-
47864833
Llama Stack Evaluation API for running evaluations on model and agent candidates.
47874834
- name: PostTraining (Coming Soon)
4835+
description: ''
47884836
- name: Telemetry
4837+
description: ''
47894838
x-tagGroups:
47904839
- name: Operations
47914840
tags:

0 commit comments

Comments
 (0)