test-langgraph/test_langgraph/__main__.py
Jon Michael Aanes e769f27957
Some checks failed
Run Python tests (through Pytest) / Test (push) Failing after 23s
Verify Python project can be installed, loaded and have version checked / Test (push) Failing after 21s
Improved method detection
2025-05-13 21:19:02 +02:00

33 lines
752 B
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import StreamingResponse
from fastapi.encoders import jsonable_encoder
from . import tools
app = FastAPI(
title='Clients',
summary='Provides various clients.'
)
origins = [
"http://localhost.tiangolo.com",
"https://localhost.tiangolo.com",
"http://localhost",
"http://localhost:8080",
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
for tool in tools.get_tools():
component, method = tool.__name__.split('.')
path = f'/{component}/{method}'
app.get(path, response_model=None,tags=[component])(tool)