Skip to content
Open
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: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Interactive demo for [ignfab/geocontext](https://github.com/ignfab/geocontext#re
| MODEL_NAME | The name of the model (see [LangGraph - create_react_agent](https://langchain-ai.github.io/langgraph/agents/models/#use-in-an-agent) / [init_chat_model](https://python.langchain.com/api_reference/langchain/chat_models/langchain.chat_models.base.init_chat_model.html)) | "anthropic:claude-sonnet-4-6" |
| ANTHROPIC_API_KEY | Required from `anthropic:*` models (https://console.anthropic.com/settings/keys) | |
| GOOGLE_API_KEY | Required from `google_genai:*` models (https://aistudio.google.com/api-keys) | |
| TEMPERATURE | Model temperature | 0 |
| TEMPERATURE | Model temperature | 0.0 |
| DB_URI | URL of the PostgreSQL (`postgresql://postgres:ChangeIt@localhost:5432/geocontext`) or Redis (ex : `redis://default:ChangeIt@localhost:6379/0`) database. | None (use InMemorySaver) |
| CONTACT_EMAIL | Email for the contact button. | "dev@localhost" |
| GEOCONTEXT_LOG_LEVEL | Log level for Geocontext MCP. | error |
Expand Down
8 changes: 5 additions & 3 deletions agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@

from tools import create_map

# retreive model name from environment variable or use default
# retrieve model name from environment variable or use default
MODEL_NAME = os.getenv("MODEL_NAME", "anthropic:claude-sonnet-4-6")
# retrieve temperature from environment variable or use default
TEMPERATURE = int(os.getenv("TEMPERATURE",0))
TEMPERATURE = float(os.getenv("TEMPERATURE", 0.0))
# ensure that the required environment variable is set for anthropic models
if MODEL_NAME.startswith("anthropic:"):
if os.getenv("ANTHROPIC_API_KEY", None) is None:
raise ValueError("ANTHROPIC_API_KEY environment variable is required for anthropic models")
if TEMPERATURE < 0 or TEMPERATURE > 1:
raise ValueError("TEMPERATURE must be between 0 and 1")


logger.info(f"Create graph using model: {MODEL_NAME}")
logger.info(f"Create graph using model: {MODEL_NAME} with temperature: {TEMPERATURE}")
model = init_chat_model(MODEL_NAME, temperature=TEMPERATURE)


Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- https_proxy
environment:
- MODEL_NAME=${MODEL_NAME:-anthropic:claude-sonnet-4-6}
- TEMPERATURE=${TEMPERATURE:-0}
- TEMPERATURE=${TEMPERATURE:-0.0}
- ANTHROPIC_API_KEY
- GOOGLE_API_KEY
- HTTP_PROXY
Expand Down