Skip to content

Commit

Permalink
feat: Make OpenAPI spec usable by custom GPTs (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusschiesser authored Dec 11, 2024
1 parent d31910a commit 25667d4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-snails-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-llama": patch
---

Make OpenAPI spec usable by custom GPTs
6 changes: 5 additions & 1 deletion templates/types/streaming/fastapi/app/api/routers/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ def get_query_engine() -> BaseQueryEngine:
return index.as_query_engine()


@r.get("/")
@r.get(
"/",
summary="Get information from the knowledge base",
description="Retrieves relevant information from the knowledge base based on the provided search query. Returns a text response containing the matched information.",
)
async def query_request(
query: str,
) -> str:
Expand Down
6 changes: 5 additions & 1 deletion templates/types/streaming/fastapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
from fastapi.responses import RedirectResponse
from fastapi.staticfiles import StaticFiles

app = FastAPI()
servers = []
app_name = os.getenv("FLY_APP_NAME")
if app_name:
servers = [{"url": f"https://{app_name}.fly.dev"}]
app = FastAPI(servers=servers)

init_settings()
init_observability()
Expand Down

0 comments on commit 25667d4

Please sign in to comment.