File size: 1,078 Bytes
365b212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Configuration module for Agentic RAG system"""

import os
from dotenv import load_dotenv
# from langchain.chat_models import init_chat_model
from langchain_openai import ChatOpenAI
# Load environment variables
load_dotenv()





class Config:
    """Configuration class for RAG system"""
    
    # API Keys
    OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
    
    # Model Configuration
    LLM_MODEL = "openai/gpt-oss-120b:free"
    
    # Document Processing
    CHUNK_SIZE = 500
    CHUNK_OVERLAP = 50
    
    # Default URLs
    DEFAULT_URLS = [
        "https://lilianweng.github.io/posts/2023-06-23-agent/",
        "https://lilianweng.github.io/posts/2024-04-12-diffusion-video/"
    ]
    
    @classmethod
    def get_llm(cls):
        """Initialize and return the LLM model"""
        os.environ["OPENAI_API_KEY"] = cls.OPENAI_API_KEY
        return ChatOpenAI(
                model=cls.LLM_MODEL,
                base_url="https://openrouter.ai/api/v1",
                extra_body={"reasoning": {"enabled": True}})
        # return init_chat_model(cls.LLM_MODEL)