Releases
November 4, 2023
Features
Disable Authorization for your APIs
You can disable authorization for your APIs, allowing you to create APIs that are accessible to anyone with the URL. You can add authorized=False
to REST APIs, Task Queues, Scheduled Jobs, and ASGI apps.
@app.rest_api(authorized=False)
def handler():
...
Task status included in webhook callbacks
Task status is now included in the header field for all webhook callbacks as x-beam-task-status
:
curl -X 'POST' 'https://YOUR-WEBHOOK-URL' -H 'x-beam-task-status: COMPLETE' -H 'beam-task-id: 2171451e-3d8e-4e35-a06d-46f2817569ef'
New Examples
Adding multiple API routes per app
You can use ASGI apps along with FastAPI to add multiple API routes to a single deployment. For example, you might want an app with two separate routes: one to train a model, and one for running inference.
Endpoint 1
https://[APP-ID].apps.beam.cloud/divide?x=10
Endpoint 2
https://[APP-ID].apps.beam.cloud/square?x=100
from beam import App, Runtime, Image
from fastapi import FastAPI
app = App(
name="square",
runtime=Runtime(
cpu=1,
memory="1Gi",
image=Image(
python_packages=["fastapi"]
)
),
)
api = FastAPI()
@app.asgi(authorized=False)
def handler():
@api.get("/square")
def square(x: int):
return {"square": x**2}
@api.get("/divide")
def divide(x: int):
return {"dividend": x / 2}
return api
Was this page helpful?