Spaces:
Running
Running
agrego posibilidad de elegir del LLM modelo de OPENAI
Browse files
app.py
CHANGED
@@ -14,6 +14,8 @@ st.header("Hacele preguntal al doc PDF que cargues")
|
|
14 |
OPENAI_API_KEY = st.text_input('OpenAI API Key', type='password')
|
15 |
pdf_obj = st.file_uploader("Cargá el documento", type="pdf", on_change=st.cache_resource.clear)
|
16 |
|
|
|
|
|
17 |
@st.cache_resource
|
18 |
def create_embeddings(pdf):
|
19 |
pdf_reader = PdfReader(pdf)
|
@@ -40,7 +42,7 @@ if pdf_obj:
|
|
40 |
if user_question:
|
41 |
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
|
42 |
docs = knowledge_base.similarity_search(user_question, 3)
|
43 |
-
llm = ChatOpenAI(model_name='gpt-4.5-preview')
|
44 |
chain = load_qa_chain(llm, chain_type="stuff")
|
45 |
respuesta = chain.run(input_documents=docs, question=user_question)
|
46 |
|
|
|
14 |
OPENAI_API_KEY = st.text_input('OpenAI API Key', type='password')
|
15 |
pdf_obj = st.file_uploader("Cargá el documento", type="pdf", on_change=st.cache_resource.clear)
|
16 |
|
17 |
+
model = st.selectbox("Model",("gpt-3.5-turbo","gpt-4","gpt-4.5-preview"))
|
18 |
+
|
19 |
@st.cache_resource
|
20 |
def create_embeddings(pdf):
|
21 |
pdf_reader = PdfReader(pdf)
|
|
|
42 |
if user_question:
|
43 |
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
|
44 |
docs = knowledge_base.similarity_search(user_question, 3)
|
45 |
+
llm = ChatOpenAI(model_name=model)#llm = ChatOpenAI(model_name='gpt-4.5-preview')
|
46 |
chain = load_qa_chain(llm, chain_type="stuff")
|
47 |
respuesta = chain.run(input_documents=docs, question=user_question)
|
48 |
|