Akshayram1 commited on
Commit
b4bcc24
·
verified ·
1 Parent(s): 398ba6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -19,6 +19,7 @@ from llama_index.core import SimpleDirectoryReader, KnowledgeGraphIndex, Setting
19
  from llama_index.core.graph_stores import SimpleGraphStore
20
  from llama_index.core import StorageContext
21
  from llama_index.embeddings.openai import OpenAIEmbedding # Fix import path
 
22
 
23
  def main():
24
  st.set_page_config(
@@ -190,10 +191,13 @@ def process_document(file_path, graph, openai_api_key):
190
  # Configure OpenAI
191
  os.environ["OPENAI_API_KEY"] = openai_api_key
192
  Settings.chunk_size = 512
193
- Settings.llm = ChatOpenAI(temperature=0, model="gpt-4")
194
 
195
- # Setup embeddings using correct import
196
- embed_model = OpenAIEmbedding() # This should work now
 
 
 
 
197
 
198
  # Create graph store
199
  graph_store = SimpleGraphStore()
 
19
  from llama_index.core.graph_stores import SimpleGraphStore
20
  from llama_index.core import StorageContext
21
  from llama_index.embeddings.openai import OpenAIEmbedding # Fix import path
22
+ from llama_index.llms.langchain import LangChainLLM
23
 
24
  def main():
25
  st.set_page_config(
 
191
  # Configure OpenAI
192
  os.environ["OPENAI_API_KEY"] = openai_api_key
193
  Settings.chunk_size = 512
 
194
 
195
+ # Setup LangChain LLM wrapper
196
+ llm = ChatOpenAI(temperature=0, model="gpt-4")
197
+ Settings.llm = LangChainLLM(llm=llm)
198
+
199
+ # Setup embeddings
200
+ embed_model = OpenAIEmbedding()
201
 
202
  # Create graph store
203
  graph_store = SimpleGraphStore()