Upload generator.py
Browse files- src/rag/generator.py +8 -8
src/rag/generator.py
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
"""
|
2 |
-
Generator module for Norwegian RAG chatbot.
|
3 |
-
Generates responses using retrieved context and
|
4 |
"""
|
5 |
|
6 |
from typing import List, Dict, Any, Optional
|
7 |
|
8 |
-
from ..api.
|
9 |
|
10 |
class Generator:
|
11 |
"""
|
12 |
-
Generates responses using retrieved context and
|
13 |
-
Uses
|
14 |
"""
|
15 |
|
16 |
def __init__(
|
17 |
self,
|
18 |
-
api_client: Optional[
|
19 |
):
|
20 |
"""
|
21 |
Initialize the generator.
|
22 |
|
23 |
Args:
|
24 |
-
api_client:
|
25 |
"""
|
26 |
-
self.api_client = api_client or
|
27 |
|
28 |
def generate(
|
29 |
self,
|
|
|
1 |
"""
|
2 |
+
Generator module for Norwegian RAG chatbot with GPT-4o integration.
|
3 |
+
Generates responses using retrieved context and GPT-4o.
|
4 |
"""
|
5 |
|
6 |
from typing import List, Dict, Any, Optional
|
7 |
|
8 |
+
from ..api.openai_api import OpenAIAPI, create_rag_prompt
|
9 |
|
10 |
class Generator:
|
11 |
"""
|
12 |
+
Generates responses using retrieved context and GPT-4o.
|
13 |
+
Uses OpenAI API for text generation.
|
14 |
"""
|
15 |
|
16 |
def __init__(
|
17 |
self,
|
18 |
+
api_client: Optional[OpenAIAPI] = None,
|
19 |
):
|
20 |
"""
|
21 |
Initialize the generator.
|
22 |
|
23 |
Args:
|
24 |
+
api_client: OpenAIAPI client for text generation
|
25 |
"""
|
26 |
+
self.api_client = api_client or OpenAIAPI()
|
27 |
|
28 |
def generate(
|
29 |
self,
|