Skip to content

Commit 1a42df8

Browse files
authored
Merge pull request #52 from AdamWozniewski/feature/aidx-198-rar-support-auth-details
Add Authorization_details
2 parents 4573741 + 946b0b2 commit 1a42df8

13 files changed

Lines changed: 21 additions & 4 deletions

File tree

examples/async-user-confirmation/langchain-examples/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ AUTH0_CLIENT_SECRET="<auth0-client-secret>"
66
# API
77
API_URL=http://localhost:8081/
88
AUDIENCE=sample-api
9+
REQUESTED_EXPIRY=300
910

1011
# OpenAI
1112
OPENAI_API_KEY="<openai-api-key>"

examples/async-user-confirmation/langchain-examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ AUTH0_CLIENT_SECRET="<auth0-client-secret>"
2626
# API
2727
API_URL=http://localhost:8081/
2828
AUDIENCE=sample-api
29+
REQUESTED_EXPIRY=300
2930

3031
# OpenAI
3132
OPENAI_API_KEY="<openai-api-key>"

examples/async-user-confirmation/langchain-examples/src/agents/conditional_trade.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def check_trade_status(state: State):
103103
auth0_ai = Auth0AI()
104104
protect_tool = auth0_ai.with_async_user_confirmation(
105105
audience=os.getenv("AUDIENCE"),
106+
requested_expiry=os.getenv("REQUESTED_EXPIRY"),
106107
scopes=["stock:trade"],
107108
binding_message=lambda ticker, qty: f"Authorize the purchase of {qty} {ticker}",
108109
user_id=lambda *_, **__: ensure_config().get("configurable", {}).get("user_id")

examples/async-user-confirmation/llama-index-examples/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ AUTH0_CLIENT_SECRET="<auth0-client-secret>"
66
# API
77
API_URL=http://localhost:8081/
88
AUDIENCE=sample-api
9+
REQUESTED_EXPIRY=300
910

1011
# OpenAI
1112
OPENAI_API_KEY="<openai-api-key>"

examples/async-user-confirmation/llama-index-examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ AUTH0_CLIENT_SECRET="<auth0-client-secret>"
2525
# API
2626
API_URL=http://localhost:8081/
2727
AUDIENCE=sample-api
28+
REQUESTED_EXPIRY=300
2829

2930
# OpenAI
3031
OPENAI_API_KEY="<openai-api-key>"

examples/async-user-confirmation/llama-index-examples/src/auth0/auth0_ai.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ async def user_id(**_kwargs):
1717
with_async_user_confirmation = auth0_ai.with_async_user_confirmation(
1818
scopes=["stock:trade"],
1919
audience=os.getenv("AUDIENCE"),
20+
requested_expiry=os.getenv("REQUESTED_EXPIRY"),
2021
binding_message=lambda ticker, qty: f"Authorize the purchase of {qty} {ticker}",
2122
user_id=user_id,
2223
# When this flag is set to `"block"`, the execution of the tool awaits until the user approves or rejects the request.

packages/auth0-ai-langchain/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ auth0_ai = Auth0AI()
3232
with_async_user_confirmation = auth0_ai.with_async_user_confirmation(
3333
scopes=["stock:trade"],
3434
audience=os.getenv("AUDIENCE"),
35+
requested_expiry=os.getenv("REQUESTED_EXPIRY"),
3536
binding_message=lambda ticker, qty: f"Authorize the purchase of {qty} {ticker}",
3637
user_id=lambda *_, **__: ensure_config().get("configurable", {}).get("user_id"),
3738
# Optional:
@@ -67,6 +68,7 @@ When defining the tool authorizer, you can specify the `authorization_details` p
6768
with_async_user_confirmation = auth0_ai.with_async_user_confirmation(
6869
scopes=["stock:trade"],
6970
audience=os.getenv("AUDIENCE"),
71+
requested_expiry=os.getenv("REQUESTED_EXPIRY"),
7072
binding_message=lambda ticker, qty: f"Authorize the purchase of {qty} {ticker}",
7173
authorization_details=lambda ticker, qty: [
7274
{

packages/auth0-ai-langchain/auth0_ai_langchain/auth0_ai.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def with_async_user_confirmation(self, **params: CIBAAuthorizerParams) -> Callab
4646
with_async_user_confirmation = auth0_ai.with_async_user_confirmation(
4747
scopes=["stock:trade"],
4848
audience=os.getenv("AUDIENCE"),
49+
requested_expiry=os.getenv("REQUESTED_EXPIRY"),
4950
binding_message=lambda ticker, qty: f"Authorize the purchase of {qty} {ticker}",
5051
user_id=lambda *_, **__: ensure_config().get("configurable", {}).get("user_id")
5152
)

packages/auth0-ai-llamaindex/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ auth0_ai = Auth0AI()
3131
with_async_user_confirmation = auth0_ai.with_async_user_confirmation(
3232
scopes=["stock:trade"],
3333
audience=os.getenv("AUDIENCE"),
34+
requested_expiry=os.getenv("REQUESTED_EXPIRY"),
3435
binding_message=lambda ticker, qty: f"Authorize the purchase of {qty} {ticker}",
3536
user_id=lambda *_, **__: session["user"]["userinfo"]["sub"],
3637
# Optional:
@@ -67,6 +68,7 @@ When defining the tool authorizer, you can specify the `authorization_details` p
6768
with_async_user_confirmation = auth0_ai.with_async_user_confirmation(
6869
scopes=["stock:trade"],
6970
audience=os.getenv("AUDIENCE"),
71+
requested_expiry=os.getenv("REQUESTED_EXPIRY"),
7072
binding_message=lambda ticker, qty: f"Authorize the purchase of {qty} {ticker}",
7173
authorization_details=lambda ticker, qty: [
7274
{

packages/auth0-ai-llamaindex/auth0_ai_llamaindex/auth0_ai.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def with_async_user_confirmation(self, **params: CIBAAuthorizerParams) -> Callab
8989
with_async_user_confirmation = auth0_ai.with_async_user_confirmation(
9090
scopes=["stock:trade"],
9191
audience=os.getenv("AUDIENCE"),
92+
requested_expiry=os.getenv("REQUESTED_EXPIRY"),
9293
binding_message=lambda ticker, qty: f"Authorize the purchase of {qty} {ticker}",
9394
user_id=lambda *_, **__: session["user"]["userinfo"]["sub"]
9495
)

0 commit comments

Comments
 (0)