-
Notifications
You must be signed in to change notification settings - Fork 32
docs: Update Flash local testing docs with request format and docstring feature #564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+39
−0
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
07d9b84
Update Flash local testing docs with request format and docstring fea…
promptless[bot] 6673384
Sync documentation updates
promptless[bot] 90c290e
Stage base-branch merge conflict for automatic resolution
promptless[bot] 7f08d8d
Resolve base-branch merge conflicts
promptless[bot] 85a6121
Merge branch 'main' into promptless/flash-local-testing-updates
promptless[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,6 +47,25 @@ Enable or disable auto-reload on code changes. Enabled by default. | |
| Auto-provision all Serverless endpoints on startup instead of lazily on first call. Eliminates cold-start delays during development. | ||
| </ResponseField> | ||
|
|
||
| ## Endpoint descriptions from docstrings | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Citation: PR #215 introduces |
||
|
|
||
| Flash extracts the first line of each function's docstring and uses it in two places: | ||
|
|
||
| - **Startup table**: The "Description" column shows the docstring when the server starts. | ||
| - **Swagger UI**: The endpoint summary in the API explorer at `/docs`. | ||
|
|
||
| Add docstrings to your `@Endpoint` functions to make your API self-documenting: | ||
|
|
||
| ```python | ||
| @Endpoint(name="text-processor", gpu=GpuGroup.ANY) | ||
| def analyze_text(text: str) -> dict: | ||
| """Analyze text and return sentiment scores.""" | ||
| # Implementation here | ||
| return {"sentiment": "positive"} | ||
| ``` | ||
|
|
||
| When you run `flash run`, the startup table displays "Analyze text and return sentiment scores" as the description for this endpoint, and the same text appears in the Swagger UI summary. | ||
|
|
||
| ## Architecture | ||
|
|
||
| With `flash run`, Flash starts a local development server alongside remote Serverless endpoints: | ||
|
|
@@ -144,6 +163,10 @@ curl -X POST http://localhost:8888/lb_worker/process \ | |
| -d '{"input_data": {"message": "Hello from Flash"}}' | ||
| ``` | ||
|
|
||
| <Note> | ||
| Queue-based endpoints require the `{"input": {...}}` wrapper format to match deployed endpoint behavior. Load-balanced endpoints accept direct JSON payloads. | ||
| </Note> | ||
|
|
||
| Open http://localhost:8888/docs for the interactive API explorer. | ||
|
|
||
| ## Requirements | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Citation: PR #215 adds docstring extraction via
RemoteFunctionMetadata.docstringinscanner.pyand displays it inrun.py's startup table and Swagger UI summary using_escape_summary()helper.View source