from dotenv import load_dotenv
load_dotenv('environment.env')


from ragas.testset.generator import TestsetGenerator
from ragas.testset.evolutions import simple, reasoning, multi_context 
from langchain_openai import ChatOpenAi, OpenAIEmbeddings
from langchain_community.document_loaders import DirectoryLoader
from langchain_community.document_loaders import PyPDFLoader

loader = DirectoryLoader("Documents")
for file in 
documents = loader.load()


for document in documents:
    document.metadata['filename'] = document.metadata['source']

generator_llm = ChatOpenAi(model = "gpt-3.5-turbo-16k")
critic_llm = ChatOpenAI(model="gpt-4")
embeddings = OpenAIEmbeddings()

generator = TestGenerator.from_langchain(
    generator_llm,
    critic_llm,
    embeddings
)
# Generate testset
testset = generator.generate_with_langchain_docs(documents, test_size=10, distributions={simple: 0.5, reasoning: 0.25, multi_context: 0.25})
