Zack Saadioui
8/26/2024
1
secrets.toml
1
opeai_key = "<your OpenAI API key here>"
1
.gitignore
1
pip install streamlit openai llama-index nltk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import streamlit as st import llama_index as ll from llama_index import VectorStoreIndex, ServiceContext from llama_index.llms import OpenAI # Function to load your data @st.cache_resource def load_data(): index = VectorStoreIndex.from_documents(docs, service_context=ServiceContext.from_defaults(llm=OpenAI(model="gpt-3.5-turbo"))) return index # User input and response functions prompt = st.text_input("Your question:") if prompt: response = chat_engine.chat(prompt) st.write(response)
1
New app
1
Deploy
Copyright © Arsturn 2024