jenngang commited on
Commit
815040a
·
verified ·
1 Parent(s): cfa1e5c

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -64,12 +64,12 @@ print(f"endpoint::{endpoint}" )
64
  #MEM0_api_key = config.get('MEM0_API_KEY') # MEM0_api_key = os.environ['mem0']
65
  #my_api_key = config.get("MY_API_KEY")
66
 
67
- #groq_api_key = userdata.get('LLAMA_API_KEY') # os.environ['LLAMA_API_KEY'] # llama_api_key = os.environ['GROQ_API_KEY']
68
- #print(groq_api_key)
69
- #MEM0_api_key = userdata.get('MEM0_API_KEY') # ['MEM0_API_KEY'] # MEM0_api_key = os.environ['mem0']
70
- #print(MEM0_api_key)
71
- #my_api_key = userdata.get('MY_API_KEY') #os.environ["MY_API_KEY"]
72
- #print(my_api_key)
73
 
74
  # Initialize the OpenAI embedding function for Chroma
75
  embedding_function = chromadb.utils.embedding_functions.OpenAIEmbeddingFunction(
@@ -77,6 +77,7 @@ embedding_function = chromadb.utils.embedding_functions.OpenAIEmbeddingFunction(
77
  api_key=api_key, # Complete the code to define the API key
78
  model_name='text-embedding-ada-002' # This is a fixed value and does not need modification
79
  )
 
80
 
81
  # This initializes the OpenAI embedding function for the Chroma vectorstore, using the provided endpoint and API key.
82
 
@@ -86,6 +87,7 @@ embedding_model = OpenAIEmbeddings(
86
  openai_api_key=api_key,
87
  model='text-embedding-ada-002'
88
  )
 
89
 
90
  # Initialize the Chat OpenAI model
91
  llm = ChatOpenAI(
@@ -94,6 +96,8 @@ llm = ChatOpenAI(
94
  model="gpt-4o", # used gpt4o instead of gpt-4o-mini to get improved results
95
  streaming=False
96
  )
 
 
97
  # This initializes the Chat OpenAI model with the provided endpoint, API key, deployment name, and a temperature setting of 0 (to control response variability).
98
 
99
  # set the LLM and embedding model in the LlamaIndex settings.
 
64
  #MEM0_api_key = config.get('MEM0_API_KEY') # MEM0_api_key = os.environ['mem0']
65
  #my_api_key = config.get("MY_API_KEY")
66
 
67
+ groq_api_key = os.environ['LLAMA_API_KEY'] # llama_api_key = os.environ['GROQ_API_KEY']
68
+ print(f"groq_api_key::{groq_api_key}")
69
+ MEM0_api_key = os.environ['MEM0_API_KEY'] # MEM0_api_key = os.environ['mem0']
70
+ print(f"MEM0_api_key::{MEM0_api_key}")
71
+ my_api_key = os.environ["MY_API_KEY"]
72
+ print(f"my_api_key::{my_api_key}")
73
 
74
  # Initialize the OpenAI embedding function for Chroma
75
  embedding_function = chromadb.utils.embedding_functions.OpenAIEmbeddingFunction(
 
77
  api_key=api_key, # Complete the code to define the API key
78
  model_name='text-embedding-ada-002' # This is a fixed value and does not need modification
79
  )
80
+ print("embedding_function initialized...")
81
 
82
  # This initializes the OpenAI embedding function for the Chroma vectorstore, using the provided endpoint and API key.
83
 
 
87
  openai_api_key=api_key,
88
  model='text-embedding-ada-002'
89
  )
90
+ print("embedding_model initialized...")
91
 
92
  # Initialize the Chat OpenAI model
93
  llm = ChatOpenAI(
 
96
  model="gpt-4o", # used gpt4o instead of gpt-4o-mini to get improved results
97
  streaming=False
98
  )
99
+ print("llm initialized...")
100
+
101
  # This initializes the Chat OpenAI model with the provided endpoint, API key, deployment name, and a temperature setting of 0 (to control response variability).
102
 
103
  # set the LLM and embedding model in the LlamaIndex settings.