Spaces:
Running
Running
File size: 2,028 Bytes
0d24772 8fdbdd0 0d24772 8fdbdd0 0d24772 e79c259 8fdbdd0 e79c259 8fdbdd0 e79c259 8fdbdd0 0d24772 e79c259 8fdbdd0 0d24772 8fdbdd0 0d24772 8fdbdd0 0d24772 8fdbdd0 25f9c92 e79c259 8fdbdd0 25f9c92 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
import os
from dotenv import load_dotenv
from typing import Dict, Any
# Load environment variables from .env file
load_dotenv()
# Groq API Key (prefer loading from environment variables for security)
GROQ_API_KEY = os.getenv("GROQ_API_KEY", "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")
# AI Provider Configuration
AI_PROVIDER = "groq" # We're now using Groq exclusively
AI_MODEL = os.getenv("AI_MODEL", "deepseek-ai/deepseek-r1-distill-llama-70b") # Default model
AI_API_KEY = GROQ_API_KEY # Use the Groq API key
# Model Settings (Groq-specific settings)
MODEL_SETTINGS = {
"max_tokens": 4000, # Maximum tokens for the response
"temperature": 0.7, # Controls randomness (0.0 = deterministic, 1.0 = creative)
"top_p": 1.0, # Controls diversity via nucleus sampling
"frequency_penalty": 0.0, # Penalizes repeated tokens
"presence_penalty": 0.0, # Penalizes new tokens
}
# Language Settings
DEFAULT_LANGUAGE = 'ar' # Arabic by default
SUPPORTED_LANGUAGES = ['ar', 'en'] # Supported languages for the application
# UAE Legal Resources (Domains for legal research)
UAE_LEGAL_DOMAINS = [
'https://elaws.moj.gov.ae',
'https://www.mohre.gov.ae',
'https://www.dm.gov.ae',
'https://www.adjd.gov.ae',
'https://www.dc.gov.ae'
]
# Legal Categories (Mapping of legal categories to their Arabic names)
LEGAL_CATEGORIES = {
'civil': 'ุงููุงููู ุงูู
ุฏูู',
'criminal': 'ุงููุงููู ุงูุฌูุงุฆู',
'commercial': 'ุงููุงููู ุงูุชุฌุงุฑู',
'labor': 'ูุงููู ุงูุนู
ู',
'family': 'ูุงููู ุงูุฃุณุฑุฉ',
'property': 'ูุงููู ุงูุนูุงุฑุงุช'
}
def get_ai_config() -> Dict[str, Any]:
"""
Get AI configuration based on environment variables.
Returns a dictionary containing the provider, model, API key, and model settings.
"""
return {
"provider": AI_PROVIDER,
"model": AI_MODEL,
"api_key": AI_API_KEY,
**MODEL_SETTINGS # Include all model settings in the config
} |