Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow langgraph's recursion_limit to be configured through env variables #118

Merged
merged 1 commit into from
Aug 14, 2024
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
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ USERS_OPEN_REGISTRATION=False
MAX_UPLOAD_SIZE=50_000_000
# Sets the number of processes
MAX_WORKERS=1
# Controls LangGraph's recursion_limit configuration parameter. If empty, defaults to 25.
RECURSION_LIMIT=25

# llm provider keys. Add only to models that you want to use
OPENAI_API_KEY=
Expand Down
3 changes: 3 additions & 0 deletions backend/app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,8 @@ def _enforce_non_default_secrets(self) -> Self:

MAX_UPLOAD_SIZE: int = 50_000_000

# LangGraph config
RECURSION_LIMIT: int = 25


settings = Settings() # type: ignore
2 changes: 1 addition & 1 deletion backend/app/core/graph/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ async def generator(

config: RunnableConfig = {
"configurable": {"thread_id": thread_id},
"recursion_limit": 25,
"recursion_limit": settings.RECURSION_LIMIT,
}
# Handle interrupt logic by orriding state
if interrupt and interrupt.decision == InterruptDecision.APPROVED:
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ services:
- DENSE_EMBEDDING_MODEL=${DENSE_EMBEDDING_MODEL?Variable not set}
- SPARSE_EMBEDDING_MODEL=${SPARSE_EMBEDDING_MODEL?Variable not set}
- MAX_UPLOAD_SIZE=${MAX_UPLOAD_SIZE}
- RECURSION_LIMIT=${RECURSION_LIMIT}
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
build:
Expand Down
Loading