Commit graph

3184 commits

Author SHA1 Message Date
Ashwin Bharambe
277bec9c9a add 204s 2025-11-14 15:30:18 -08:00
Ashwin Bharambe
e3e8272bbe restore some types we had erased 2025-11-14 15:03:36 -08:00
Ashwin Bharambe
0c9ffff1b8 precommit 2025-11-14 14:55:26 -08:00
Ashwin Bharambe
9deb0beb86 even more cleanup, the deltas should be much smaller now 2025-11-14 14:18:15 -08:00
Ashwin Bharambe
5293b4e5e9 schema naming cleanup, should be much closer 2025-11-14 13:07:34 -08:00
Ashwin Bharambe
69e1176ff8 Apply a legacy order so we can easily see diff against what was generated 2025-11-14 10:39:00 -08:00
Ashwin Bharambe
9381673405 Merge remote-tracking branch 'origin/main' into rm-strong-typing-openapi-gen 2025-11-14 10:21:07 -08:00
Omar Abdelwahab
eb545034ab
fix: MCP authorization parameter implementation (#4052)
# What does this PR do?
Adding a user-facing `authorization ` parameter to MCP tool definitions
that allows users to explicitly configure credentials per MCP server,
addressing GitHub Issue #4034 in a secure manner.


## Test Plan
tests/integration/responses/test_mcp_authentication.py

---------

Co-authored-by: Omar Abdelwahab <omara@fb.com>
Co-authored-by: Ashwin Bharambe <ashwin.bharambe@gmail.com>
2025-11-14 08:54:42 -08:00
Sébastien Han
dc49ad3f89
chore: bump starlette version (#4158)
# What does this PR do?

Require at least 0.49.1 which fixes a security vulnerability in the
parsing logic of the Range header in FileResponse. Release note:
https://github.com/Kludex/starlette/releases/tag/0.49.1

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 08:47:37 -08:00
Sébastien Han
71da65ae1a
fix: post is paginated not get
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 15:21:43 +01:00
Sébastien Han
c921a37200
fix: revert "fix: pagination config"
This reverts commit 9a36669ef3.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 15:08:32 +01:00
Sébastien Han
3dd252ef3e
chore: fix missing endpoint on stainless config
delete /v1/scoring-functions/{scoring_fn_id} exists in the OpenAPI spec,
       but isn't specified in the Stainless config, so code will not be
       generated for it.
delete /v1alpha/eval/benchmarks/{benchmark_id} exists in the OpenAPI
spec, but isn't specified in the Stainless config, so code will not be
generated for it

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 11:59:13 +01:00
Sébastien Han
738d4bfd7e
chore: add paginated false to chat/completions
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 11:55:35 +01:00
Sébastien Han
9a36669ef3
fix: pagination config
use paginated endpoint for example and mark input_items.list as
non-paginated

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 11:20:42 +01:00
Sébastien Han
da37b2a847
chore: revert "fix: Exclude deprecated endpoints from stainless config"
This reverts commit 06acbdab6f.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 11:19:22 +01:00
Sébastien Han
eabd248ea0
chore: remove RAG
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 11:12:35 +01:00
Sébastien Han
7908a1026a
chore: revert "fix: remove unused endpoint and outdate code"
This reverts commit 7bc9aeaf9c.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 11:10:58 +01:00
Sébastien Han
6de63d5de1
chore: revert "fix: remove unregister shield"
This reverts commit 84277988b8.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 11:09:51 +01:00
Sébastien Han
1b982ff2b6
chore: re-add missing decorator
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 11:01:13 +01:00
Sébastien Han
2785819aa7
fix: remove trailing space from specs
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 10:41:26 +01:00
Sébastien Han
bb34f7a4d4
chore: re-add deprecated routes to the combined spec
Matches https://github.com/llamastack/llama-stack/pull/4156

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 10:15:53 +01:00
Sébastien Han
2a257dbdea
chore: rebase on main
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 10:03:44 +01:00
Sébastien Han
e79a03b697
chore: chop fastapi_generator into its module
Decoupled the large script with distinct files and purpose.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:45 +01:00
Sébastien Han
912ee24bdf
fix: convert anyOf with const values to enum types in OpenAPI schema
Add a post-processing step that converts anyOf schemas containing
multiple const string values into proper enum types. This fixes the
Schema/EnumDescriptionNotValid error from Stainless by ensuring enum
schemas are properly formatted instead of using anyOf with const values.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:45 +01:00
Sébastien Han
769cfe4654
fix: pagination config
use paginated endpoint for example and mark input_items.list as
non-paginated

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:45 +01:00
Sébastien Han
f7d0494927
fix: Added the missing endpoints to the Stainless config
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:45 +01:00
Sébastien Han
e0a69f2709
fix: remove unsused ressources
removed in https://github.com/llamastack/llama-stack/pull/4067

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:45 +01:00
Sébastien Han
84277988b8
fix: remove unregister shield
https://github.com/llamastack/llama-stack/pull/4099

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:45 +01:00
Sébastien Han
827cc9b9b8
fix: deprecated endpoint in Stainless config example
Replace deprecated `post /v1/models` with `get /v1/models` in the headline
example to fix Stainless Endpoint/NotFound error.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:44 +01:00
Sébastien Han
a58d9a65f1
chore: remove validation schema script
The generator validates the generated schemas already.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:44 +01:00
Sébastien Han
7bc9aeaf9c
fix: remove unused endpoint and outdate code
The register/unregister were removed in
https://github.com/llamastack/llama-stack/pull/4099

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:44 +01:00
Sébastien Han
06acbdab6f
fix: Exclude deprecated endpoints from stainless config
Filter out deprecated endpoints from the combined OpenAPI spec and remove
their references from the Stainless config to fix Endpoint/NotFound
errors.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:44 +01:00
Sébastien Han
24b275d0dd
fix: revert "chore: add deprecated to combined schema"
This reverts commit 53fc2a05812ebf24d5598a70972c86d72c50fd4e.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:44 +01:00
Sébastien Han
01f441b3ac
fix: duplicate union type declarations for Stainless codegen
Extract duplicate union types to shared schema references and remove
duplicate references within unions to fix Stainless duplicate declaration
warnings.

Fixes:
https://www.stainless.com/docs/reference/diagnostics#Python/DuplicateDeclaration

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:44 +01:00
Sébastien Han
09280301de
fix: Query default values can't be set in Annotated
The error is that Query default values can't be set in Annotated; they
must be set with = in the function signature.
See the error:

```
The error is that Query default values can't be set in Annotated; they
must be set with = in the function signature. Searching for where
include_embeddings is defined:
```

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:44 +01:00
Sébastien Han
221f28b685
chore: fix missing titles for unions
Added _add_titles_to_unions() to:
Recursively scan all schemas for anyOf/oneOf unions
Generate descriptive titles from the union members
Add those titles to help code generators infer names

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:30 +01:00
Sébastien Han
500804f0eb
chore: add deprecated to combined schema
The _filter_combined_schema function was excluding deprecated
operations. I updated it to include all operations (deprecated and
non-deprecated) for the combined/stainless spec, so these deprecated
endpoints are now included.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:30 +01:00
Sébastien Han
73861b504d
chore: re-add missing endpoints
_filter_combined_schema was using path-level filtering with
_is_path_deprecated, which excluded entire paths if any operation was
deprecated. Since /v1/toolgroups has both GET (not deprecated) and POST
(deprecated), the entire path was excluded, removing the GET operation
and its response schema. Updated _filter_combined_schema to use
operation-level filtering, matching _filter_schema_by_version

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:29 +01:00
Sébastien Han
2cb0c31edd
chore: re-add missing endpoints
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:18 +01:00
Sébastien Han
3d33291f23
chore: refactor code to reduce generator script length
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:18 +01:00
Sébastien Han
de4ed29310
chore: replace JSON requestBody block with query params
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:18 +01:00
Sébastien Han
e3d831f504
chore: re-add text/event-stream media type
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:18 +01:00
Sébastien Han
66056ddb87
chore: re-add x-llama-stack-extra-body-params
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:18 +01:00
Sébastien Han
c4cad890cc
chore: regen scehma with main
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:17 +01:00
Sébastien Han
b450955df5
chore: add new generator location to precommit
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:04 +01:00
Sébastien Han
8e1f89b32e
chore: update generator script location
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:04 +01:00
Sébastien Han
20615eca25
chore: fail if any schema is invalid
Do not continue the generation, print which schema failed.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:04 +01:00
Sébastien Han
9d14d6d313
chore: rm unused func
Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:04 +01:00
Sébastien Han
e3cb8ed74a
chore: use Pydantic to generate OpenAPI schema
Removes the need for the strong_typing and pyopenapi packages and purely
use Pydantic for schema generation.

Our generator now purely relies on Pydantic and FastAPI, it is available
at `scripts/fastapi_generator.py`, you can run it like so:

```
uv run ./scripts/run_openapi_generator.sh
```

The generator will:

* Generate the deprecated, experimental, stable and combined specs
* Validate all the spec it generates against OpenAPI standards

A few changes in the schema required for oasdiff some updates so I've
made the following ignore rules. The new Pydantic-based generator is
likely more correct and follows OpenAPI standards better than the old
pyopenapi generator. Instead of trying to make the new generator match
the old one's quirks, we should focus on what's actually correct
according to OpenAPI standards.

These are non-critical changes:

* response-property-became-nullable: Backward compatible:
  existing non-null values still work, now also accepts null
* response-required-property-removed: oasdiff reports a false
  positive because it doesn't resolve $refs inside anyOf; we could use
  tool like 'redocly' to flatten the schema to a single file.
* response-property-type-changed: properties are still object
  types, but oasdiff doesn't resolve $refs, so it flags the missing
  inline type: object even though the referenced schemas define type:
  object
* request-property-one-of-removed: These are false positives
  caused by schema restructuring (wrapping in anyOf for nullability,
  using -Input variants, or simplifying nested oneOf structures)
  that don't change the actual API contract - the same data types are
  still accepted, just represented differently in the schema.
* request-parameter-enum-value-removed: These are false
  positives caused by oasdiff not resolving $refs - the enum values
  (asc, desc, assistants, batch) are still present in the referenced
  schemas (Order and OpenAIFilePurpose), just represented via schema
  references instead of inline enums.
* request-property-enum-value-removed: this is a false positive caused
    by oasdiff not resolving $refs - the enum values (llm, embedding,
    rerank) are still present in the referenced ModelType schema,
    just represented via schema reference instead of inline enums.
* request-property-type-changed: These are schema quality issues
    where type information is missing (due to Any fallback in dynamic
    model creation), but the API contract remains unchanged -
    properties still exist with correct names and defaults, so the same
    requests will work.
* response-body-type-changed: These are false positives caused
  by schema representation changes (from inferred/empty types to
  explicit $ref schemas, or vice versa) - the actual response types
  an API contract remain unchanged, just how they're represented in the
  OpenAPI spec.
* response-media-type-removed: This is a false positive caused
  by FastAPI's OpenAPI generator not documenting union return types with
  AsyncIterator - the streaming functionality with text/event-stream
  media type still works when stream=True is passed, it's just not
  reflected in the generated OpenAPI spec.
* request-body-type-changed: This is a schema correction - the
  old spec incorrectly represented the request body as an object, but
  the function signature shows chunks: list[Chunk], so the new spec
  correctly shows it as an array, matching the actual API
  implementation.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-11-14 09:56:02 +01:00
Charlie Doern
a078f089d9
fix: rename llama_stack_api dir (#4155)
Some checks failed
Integration Tests (Replay) / generate-matrix (push) Successful in 3s
SqlStore Integration Tests / test-postgres (3.12) (push) Failing after 0s
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 1s
SqlStore Integration Tests / test-postgres (3.13) (push) Failing after 0s
Test External Providers Installed via Module / test-external-providers-from-module (venv) (push) Has been skipped
Test Llama Stack Build / generate-matrix (push) Successful in 5s
Python Package Build Test / build (3.12) (push) Failing after 4s
API Conformance Tests / check-schema-compatibility (push) Successful in 12s
Test llama stack list-deps / generate-matrix (push) Successful in 29s
Test Llama Stack Build / build-single-provider (push) Successful in 33s
Test llama stack list-deps / list-deps-from-config (push) Successful in 32s
UI Tests / ui-tests (22) (push) Successful in 39s
Test Llama Stack Build / build (push) Successful in 39s
Test llama stack list-deps / show-single-provider (push) Successful in 46s
Python Package Build Test / build (3.13) (push) Failing after 44s
Test External API and Providers / test-external (venv) (push) Failing after 44s
Vector IO Integration Tests / test-matrix (push) Failing after 56s
Test llama stack list-deps / list-deps (push) Failing after 47s
Unit Tests / unit-tests (3.12) (push) Failing after 1m42s
Unit Tests / unit-tests (3.13) (push) Failing after 1m55s
Test Llama Stack Build / build-ubi9-container-distribution (push) Successful in 2m0s
Test Llama Stack Build / build-custom-container-distribution (push) Successful in 2m2s
Integration Tests (Replay) / Integration Tests (, , , client=, ) (push) Failing after 2m42s
Pre-commit / pre-commit (push) Successful in 5m17s
# What does this PR do?

the directory structure was src/llama-stack-api/llama_stack_api

instead it should just be src/llama_stack_api to match the other
packages.

update the structure and pyproject/linting config

---------

Signed-off-by: Charlie Doern <cdoern@redhat.com>
Co-authored-by: Ashwin Bharambe <ashwin.bharambe@gmail.com>
2025-11-13 15:04:36 -08:00