llm_base = llms.ChatOpenAIModel()
pipeline_normal = generator.Generate(question="How do i get better in AI?",retriever=retriever_normal,llm=llm_base)
llm_advanced = llms.ChatOpenAIModel(model="gpt-4-0125-preview") pipeline_advanced = generator.Generate(question="How do i get better in AI?",retriever=retriever_hybrid,llm=llm_advanced)
from enterprise_rag import source,retrieve,embeddings,llms,generator import os from getpass import getpass
data = source.fit("build-career-in-ai.pdf",dtype="pdf",chunk_size=1024,chunk_overlap=0) embed_model = embeddings.OpenAIEmbeddings() retriever_normal = retrieve.auto_retriever(data,embed_model,type="normal",top_k=4) retriever_hybrid = retrieve.auto_retriever(data,embed_model,type="hybrid",top_k=4,reranker="facebook/bart-large-mnli")
llm_base = llms.ChatOpenAIModel() pipeline_normal = generator.Generate(question="How do i get better in AI?",retriever=retriever_normal,llm=llm_base)
llm_advanced = llms.ChatOpenAIModel(model="gpt-4-0125-preview") pipeline_advanced = generator.Generate(question="How do i get better in AI?",retriever=retriever_hybrid,llm=llm_advanced)
print("Experiment 1") print(pipeline_normal.call()) #AI response print(pipeline_normal.get_rag_triad_evals(llm=llm_advanced)) #evaluate LLM response
print("Experiment 2") print(pipeline_advanced.call()) #AI response print(pipeline_advanced.get_rag_triad_evals(llm=llm_advanced)) #evaluate LLM response