|
10 | 10 | request_validation_exception_handler, |
11 | 11 | websocket_request_validation_exception_handler, |
12 | 12 | ) |
13 | | -from fastapi.exceptions import ( |
14 | | - FastAPIError, |
15 | | - RequestValidationError, |
16 | | - WebSocketRequestValidationError, |
17 | | -) |
| 13 | +from fastapi.exceptions import RequestValidationError, WebSocketRequestValidationError |
18 | 14 | from fastapi.logger import logger |
19 | 15 | from fastapi.middleware.asyncexitstack import AsyncExitStackMiddleware |
20 | 16 | from fastapi.openapi.docs import ( |
@@ -4563,60 +4559,6 @@ def trace_item(item_id: str): |
4563 | 4559 | generate_unique_id_function=generate_unique_id_function, |
4564 | 4560 | ) |
4565 | 4561 |
|
4566 | | - def vibe( |
4567 | | - self, |
4568 | | - path: Annotated[ |
4569 | | - str, |
4570 | | - Doc( |
4571 | | - """ |
4572 | | - The URL path to be used for this *path operation*. |
4573 | | -
|
4574 | | - For example, in `http://example.com/vibes`, the path is `/vibes`. |
4575 | | - """ |
4576 | | - ), |
4577 | | - ], |
4578 | | - *, |
4579 | | - prompt: Annotated[ |
4580 | | - str, |
4581 | | - Doc( |
4582 | | - """ |
4583 | | - The prompt to send to the LLM provider along with the payload. |
4584 | | -
|
4585 | | - This tells the LLM what to do with the request body. |
4586 | | - """ |
4587 | | - ), |
4588 | | - ] = "", |
4589 | | - ) -> Callable[[DecoratedCallable], DecoratedCallable]: |
4590 | | - """ |
4591 | | - Add a *vibe coding path operation* that receives any HTTP method |
4592 | | - and any payload. |
4593 | | -
|
4594 | | - It's intended to receive the request and send the payload directly |
4595 | | - to an LLM provider, and return the response as is. |
4596 | | -
|
4597 | | - Embrace the freedom and flexibility of not having any data validation, |
4598 | | - documentation, or serialization. |
4599 | | -
|
4600 | | - ## Example |
4601 | | -
|
4602 | | - ```python |
4603 | | - from typing import Any |
4604 | | -
|
4605 | | - from fastapi import FastAPI |
4606 | | -
|
4607 | | - app = FastAPI() |
4608 | | -
|
4609 | | -
|
4610 | | - @app.vibe( |
4611 | | - "/vibe/", |
4612 | | - prompt="pls return json of users from database. make no mistakes", |
4613 | | - ) |
4614 | | - async def ai_vibes(body: Any): |
4615 | | - ... |
4616 | | - ``` |
4617 | | - """ |
4618 | | - raise FastAPIError("Are you kidding me? Happy April Fool's") |
4619 | | - |
4620 | 4562 | def websocket_route( |
4621 | 4563 | self, path: str, name: str | None = None |
4622 | 4564 | ) -> Callable[[DecoratedCallable], DecoratedCallable]: |
|
0 commit comments