adamelliotfields commited on
Commit
7c6aff8
1 Parent(s): fd26aa4

Fix text generation

Browse files
Files changed (2) hide show
  1. lib/api.py +2 -1
  2. pages/1_💬_Text_Generation.py +1 -1
lib/api.py CHANGED
@@ -14,10 +14,11 @@ from .config import config
14
 
15
 
16
  def txt2txt_generate(api_key, service, parameters, **kwargs):
 
17
  base_url = config.services[service].url
18
 
19
  if service == "hf":
20
- base_url = f"{base_url}/{parameters['model']}/v1"
21
 
22
  try:
23
  if service == "anthropic":
 
14
 
15
 
16
  def txt2txt_generate(api_key, service, parameters, **kwargs):
17
+ model = parameters.get("model", "")
18
  base_url = config.services[service].url
19
 
20
  if service == "hf":
21
+ base_url = f"{base_url}/{model}/v1"
22
 
23
  try:
24
  if service == "anthropic":
pages/1_💬_Text_Generation.py CHANGED
@@ -203,7 +203,7 @@ if prompt := st.chat_input(
203
  with st.chat_message("assistant"):
204
  session_key = f"api_key_{service}"
205
  api_key = st.session_state[session_key] or text_services[service].api_key
206
- response = txt2txt_generate(api_key, service, model, parameters)
207
  st.session_state.running = False
208
 
209
  st.session_state.txt2txt_messages.append({"role": "user", "content": prompt})
 
203
  with st.chat_message("assistant"):
204
  session_key = f"api_key_{service}"
205
  api_key = st.session_state[session_key] or text_services[service].api_key
206
+ response = txt2txt_generate(api_key, service, parameters)
207
  st.session_state.running = False
208
 
209
  st.session_state.txt2txt_messages.append({"role": "user", "content": prompt})