mahynski commited on
Commit
e9802f8
1 Parent(s): a94912c

updated token names

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -69,18 +69,18 @@ def main():
69
 
70
  max_output_tokens = 2048
71
 
72
- # Enter LLM Token
73
- llm_token = st.text_input(
74
- "Enter your LLM token",
75
  value=None,
76
  )
77
 
78
  # Create LLM
79
  # Global tokenization needs to be consistent with LLM for token counting
80
  # https://docs.llamaindex.ai/en/stable/module_guides/models/llms/
81
- if llm_token is not None:
82
  if provider == 'openai':
83
- os.environ["OPENAI_API_KEY"] = str(llm_token)
84
  Settings.llm = OpenAI(
85
  model=llm_name,
86
  temperature=temperature,
@@ -91,11 +91,11 @@ def main():
91
  Settings.context_window = 4096 # max possible
92
  Settings.embed_model = OpenAIEmbedding()
93
  elif provider == 'huggingface':
94
- os.environ['HFTOKEN'] = str(llm_token)
95
 
96
- # Enter parsing Token
97
- parse_token = st.text_input(
98
- "Enter your LlamaParse token",
99
  value=None,
100
  )
101
 
@@ -109,7 +109,7 @@ def main():
109
  if uploaded_file is not None:
110
  # Parse the file
111
  parser = LlamaParse(
112
- api_key=parse_token, # Can also be set in your env as LLAMA_CLOUD_API_KEY
113
  result_type="text" # "markdown" and "text" are available
114
  )
115
 
@@ -128,8 +128,8 @@ def main():
128
  """
129
  # Instructions
130
 
131
- 1. Obtain a [token](https://cloud.llamaindex.ai/api-key) (or API Key) from LlamaParse to parse your document.
132
- 2. Obtain a similar token from your preferred LLM provider.
133
  3. Make selections at the left and upload a document to use a context.
134
  4. Begin asking questions below!
135
  """
 
69
 
70
  max_output_tokens = 2048
71
 
72
+ # Enter LLM API Key
73
+ llm_key = st.text_input(
74
+ "Enter your LLM API Key",
75
  value=None,
76
  )
77
 
78
  # Create LLM
79
  # Global tokenization needs to be consistent with LLM for token counting
80
  # https://docs.llamaindex.ai/en/stable/module_guides/models/llms/
81
+ if llm_key is not None:
82
  if provider == 'openai':
83
+ os.environ["OPENAI_API_KEY"] = str(llm_key)
84
  Settings.llm = OpenAI(
85
  model=llm_name,
86
  temperature=temperature,
 
91
  Settings.context_window = 4096 # max possible
92
  Settings.embed_model = OpenAIEmbedding()
93
  elif provider == 'huggingface':
94
+ os.environ['HFTOKEN'] = str(llm_key)
95
 
96
+ # Enter Parsing API Key
97
+ parse_key = st.text_input(
98
+ "Enter your LlamaParse API Key",
99
  value=None,
100
  )
101
 
 
109
  if uploaded_file is not None:
110
  # Parse the file
111
  parser = LlamaParse(
112
+ api_key=parse_key, # Can also be set in your env as LLAMA_CLOUD_API_KEY
113
  result_type="text" # "markdown" and "text" are available
114
  )
115
 
 
128
  """
129
  # Instructions
130
 
131
+ 1. Obtain an [API Key](https://cloud.llamaindex.ai/api-key) from LlamaParse to parse your document.
132
+ 2. Obtain a similar API Key from your preferred LLM provider.
133
  3. Make selections at the left and upload a document to use a context.
134
  4. Begin asking questions below!
135
  """