Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ yarn-error.log*
# Optional npm cache directory
.npm

# turbo
.turbo

# Optional eslint cache
.eslintcache

Expand All @@ -33,3 +36,48 @@ yarn-error.log*

# misc
.DS_Store

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Python virtual environments
.env
.venv
venv/
env/
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import httpx
from langchain_core.tools import StructuredTool
from auth0_ai_langchain.ciba import get_ciba_credentials
from auth0_ai_langchain.async_authorization import get_async_authorization_credentials
from pydantic import BaseModel

from app.core.auth0_ai import with_async_user_confirmation
from app.core.auth0_ai import with_async_authorization
from app.core.config import settings


Expand All @@ -21,10 +21,10 @@ async def shop_online_fn(product: str, quantity: int):
# No API set, mock a response
return f"Ordered {quantity} {product}"

credentials = get_ciba_credentials()
credentials = get_async_authorization_credentials()

if not credentials:
raise ValueError("CIBA credentials not found")
raise ValueError("Async Authorization credentials not found")

headers = {
"Authorization": f"Bearer {credentials['access_token']}",
Expand Down Expand Up @@ -56,7 +56,7 @@ async def shop_online_fn(product: str, quantity: int):
}


shop_online = with_async_user_confirmation(
shop_online = with_async_authorization(
StructuredTool(
name="shop_online",
description="Tool to buy products online.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)
)

with_async_user_confirmation = auth0_ai.with_async_user_confirmation(
with_async_authorization = auth0_ai.with_async_authorization(
audience=settings.SHOP_API_AUDIENCE,
# add any scopes you want to use with your API
scopes=["openid", "product:buy"],
Expand All @@ -33,4 +33,8 @@
# In practice, the process that is awaiting the user confirmation
# could crash or timeout before the user approves the request.
on_authorization_request="block",

# Note: Setting a requested expiry greater than 300 (seconds) will force email verification
# instead of using the push notification flow.
# requested_expiry=301,
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ description = "Assistant0: An AI Personal Assistant Secured with Auth0 - LangGra
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"auth0-ai-langchain>=1.0.0b3",
"auth0-ai-langchain>=1.0.0b4",
"auth0-fastapi>=1.0.0b4",
"fastapi[standard]>=0.115.14",
"google-api-python-client>=2.176.0",
"httpx>=0.28.1",
"itsdangerous>=2.2.0",
"langchain-openai>=0.3.28",
"langgraph-cli[inmem]>=0.2.12",
"langgraph-cli[inmem]>=0.3.6",
"langgraph-api==0.2.102",
"langgraph-runtime-inmem==0.6.0",
"langgraph>=0.5.4",
"pydantic-settings>=2.10.1",
]
]
1,788 changes: 1,105 additions & 683 deletions asynchronous-authorization/langchain-fastapi-py/backend/uv.lock

Large diffs are not rendered by default.

Loading