Skip to content

Commit def033b

Browse files
authored
Merge pull request #20 from warestack/feat/refactor-ai-providers
feat: refactor to multi-provider abstraction with registry pattern
2 parents 766c5d7 + b24a889 commit def033b

21 files changed

Lines changed: 679 additions & 399 deletions

File tree

.env.example

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,66 @@
1-
# OpenAI API Configuration
2-
OPENAI_API_KEY=
1+
# GitHub Configuration (required)
2+
APP_NAME_GITHUB=your_app_name
3+
APP_CLIENT_ID_GITHUB=your_client_id
4+
APP_CLIENT_SECRET_GITHUB=your_client_secret
35

4-
# LangChain Configuration
5-
LANGCHAIN_TRACING_V2=true
6+
PRIVATE_KEY_BASE64_GITHUB=your_private_key_base64
7+
WEBHOOK_SECRET_GITHUB=your_webhook_secret
8+
9+
# AI Provider Selection
10+
AI_PROVIDER=openai # Options: openai, bedrock, vertex_ai
11+
12+
# Common AI Settings (defaults for all agents)
13+
AI_MAX_TOKENS=4096
14+
AI_TEMPERATURE=0.1
15+
16+
# OpenAI Configuration (when AI_PROVIDER=openai)
17+
OPENAI_API_KEY=your_openai_api_key_here
18+
OPENAI_MODEL=gpt-4.1-mini # Optional, defaults to gpt-4.1-mini
19+
20+
# AWS Bedrock Configuration (when AI_PROVIDER=bedrock)
21+
# BEDROCK_REGION=us-east-1
22+
# BEDROCK_MODEL_ID=anthropic.claude-3-sonnet-20240229-v1:0
23+
# AWS_ACCESS_KEY_ID=your_aws_access_key # Optional, can use AWS profile instead
24+
# AWS_SECRET_ACCESS_KEY=your_aws_secret_key # Optional, can use AWS profile instead
25+
# AWS_PROFILE=your_aws_profile # Optional, alternative to access keys
26+
27+
# Google Vertex AI Configuration (when AI_PROVIDER=vertex_ai)
28+
# GCP_PROJECT_ID=your-gcp-project-id
29+
# GCP_LOCATION=us-central1
30+
# VERTEX_AI_MODEL=gemini-pro # Options: gemini-pro, gemini-1.5-pro, claude-3-opus@20240229, etc.
31+
# GCP_SERVICE_ACCOUNT_KEY_BASE64=your_base64_encoded_service_account_key # Optional, can use ADC instead
32+
33+
# Engine Agent Configuration
34+
AI_ENGINE_MAX_TOKENS=8000 # Default: 8000
35+
AI_ENGINE_TEMPERATURE=0.1
36+
37+
# Feasibility Agent Configuration
38+
AI_FEASIBILITY_MAX_TOKENS=4096
39+
AI_FEASIBILITY_TEMPERATURE=0.1
40+
41+
# Acknowledgment Agent Configuration
42+
AI_ACKNOWLEDGMENT_MAX_TOKENS=2000
43+
AI_ACKNOWLEDGMENT_TEMPERATURE=0.1
44+
45+
# LangSmith Configuration
46+
LANGCHAIN_TRACING_V2=false
647
LANGCHAIN_ENDPOINT=https://api.smith.langchain.com
748
LANGCHAIN_API_KEY=
8-
LANGCHAIN_PROJECT=
9-
10-
# AWS Configuration
11-
AWS_ACCESS_KEY_ID=
12-
AWS_SECRET_ACCESS_KEY=
49+
LANGCHAIN_PROJECT=watchflow-dev
1350

14-
# Application Configuration
15-
ENVIRONMENT=development
51+
# CORS Configuration
1652
CORS_HEADERS=["*"]
17-
CORS_ORIGINS='["http://localhost:3000", "http://127.0.0.1:3000"]'
53+
CORS_ORIGINS=["http://localhost:3000", "http://127.0.0.1:3000", "http://localhost:5500", "https://warestack.github.io", "https://watchflow.dev"]
54+
55+
# Repository Configuration
56+
REPO_CONFIG_BASE_PATH=.watchflow
57+
REPO_CONFIG_RULES_FILE=rules.yaml
1858

19-
# GitHub OAuth Configuration
20-
APP_NAME_GITHUB=
21-
CLIENT_ID_GITHUB=
22-
CLIENT_SECRET_GITHUB=
23-
PRIVATE_KEY_BASE64_GITHUB=
24-
REDIRECT_URI_GITHUB=http://localhost:3000
59+
# Logging Configuration
60+
LOG_LEVEL=INFO
61+
LOG_FORMAT=%(asctime)s - %(name)s - %(levelname)s - %(message)s
62+
LOG_FILE_PATH=
2563

26-
# GitHub Webhook Configuration
27-
WEBHOOK_SECRET_GITHUB=
64+
# Development Settings
65+
DEBUG=false
66+
ENVIRONMENT=development

env.example

Lines changed: 0 additions & 80 deletions
This file was deleted.

src/agents/acknowledgment_agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from src.agents.acknowledgment_agent.models import AcknowledgmentContext, AcknowledgmentEvaluation
1212
from src.agents.acknowledgment_agent.prompts import create_evaluation_prompt, get_system_prompt
1313
from src.agents.base import AgentResult, BaseAgent
14-
from src.core.ai import get_chat_model
14+
from src.providers import get_chat_model
1515

1616
logger = logging.getLogger(__name__)
1717

src/agents/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from abc import ABC, abstractmethod
88
from typing import Any, TypeVar
99

10-
from src.core.ai import get_chat_model
10+
from src.providers import get_chat_model
1111

1212
logger = logging.getLogger(__name__)
1313

src/agents/engine_agent/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ class LLMEvaluationResponse(BaseModel):
4141

4242
is_violated: bool = Field(description="Whether the rule is violated")
4343
message: str = Field(description="Explanation of the violation or why the rule passed")
44-
details: dict[str, Any] = Field(description="Detailed reasoning and metadata", default_factory=dict)
44+
details: dict[str, Any] = Field(
45+
description="Detailed reasoning and metadata",
46+
default_factory=dict,
47+
json_schema_extra={"additionalProperties": False},
48+
)
4549
how_to_fix: str | None = Field(description="Specific instructions on how to fix the violation", default=None)
4650

4751

src/agents/engine_agent/nodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
create_validation_strategy_prompt,
2525
get_llm_evaluation_system_prompt,
2626
)
27-
from src.core.ai import get_chat_model
27+
from src.providers import get_chat_model
2828
from src.rules.validators import VALIDATOR_REGISTRY
2929

3030
logger = logging.getLogger(__name__)

src/agents/feasibility_agent/nodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from src.agents.feasibility_agent.models import FeasibilityAnalysis, FeasibilityState, YamlGeneration
88
from src.agents.feasibility_agent.prompts import RULE_FEASIBILITY_PROMPT, YAML_GENERATION_PROMPT
9-
from src.core.ai import get_chat_model
9+
from src.providers import get_chat_model
1010

1111
logger = logging.getLogger(__name__)
1212

src/core/ai.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/core/ai_providers/__init__.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/core/ai_providers/bedrock_provider.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)