|
import pandas as pd |
|
import os |
|
from langchain.llms import OpenAI |
|
import chromadb |
|
|
|
from config import * |
|
from src.control.control import Controller |
|
from src.tools.retriever import Retriever |
|
from src.tools.llm import LlmAgent |
|
from src.model.doc import Doc |
|
import src.view.view as view |
|
|
|
os.environ["OPENAI_API_KEY"] = OpenAI_KEY |
|
os.environ["TOKENIZERS_PARALLELISM"] = "true" |
|
|
|
doc_content = Doc(content_en_path) |
|
doc_plan = Doc(plan_path) |
|
doc_content_fr = Doc(content_fr_path) |
|
|
|
client_db = chromadb.Client() |
|
retriever = Retriever(client_db, doc_plan, doc_content, doc_content_fr, collection_name) |
|
|
|
llm_model = OpenAI(temperature=0) |
|
llm = LlmAgent(llm_model) |
|
|
|
specials['remote_rate_df'] = pd.read_csv(specials['remote_rate_path']) |
|
specials['accommodation_meal_df'] = pd.read_csv(specials['accommodation_meal_path']) |
|
controller = Controller(retriever=retriever, llm=llm, content_language=content_language, plan_language=plan_language, |
|
specials=specials) |
|
|
|
qna = view.run(ctrl=controller, examples=examples) |
|
|
|
qna.queue().launch() |
|
|