mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-01 16:24:44 +00:00
NIM not working yet
This commit is contained in:
parent
7065b0fb4d
commit
31a15332c4
3 changed files with 218 additions and 9 deletions
|
@ -4,6 +4,7 @@
|
|||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
import os
|
||||
import streamlit as st
|
||||
|
||||
from llama_stack.distribution.ui.modules.api import llama_stack_api
|
||||
|
@ -11,6 +12,37 @@ from llama_stack.distribution.ui.modules.api import llama_stack_api
|
|||
|
||||
def providers():
|
||||
st.header("🔍 API Providers")
|
||||
|
||||
# API Key Management Section
|
||||
st.subheader("API Key Management")
|
||||
|
||||
# Create a form for API key input
|
||||
with st.form("api_keys_form"):
|
||||
# Get the current value from session state or environment variable
|
||||
tavily_key = st.session_state.get("tavily_search_api_key", os.environ.get("TAVILY_SEARCH_API_KEY", ""))
|
||||
|
||||
# Input field for Tavily Search API key
|
||||
tavily_search_api_key = st.text_input(
|
||||
"Tavily Search API Key",
|
||||
value=tavily_key,
|
||||
type="password",
|
||||
help="Enter your Tavily Search API key. This will be used for search operations."
|
||||
)
|
||||
|
||||
# Submit button
|
||||
submit_button = st.form_submit_button("Save API Keys")
|
||||
|
||||
if submit_button:
|
||||
# Store the API key in session state
|
||||
st.session_state["tavily_search_api_key"] = tavily_search_api_key
|
||||
|
||||
# Update the client with the new API key
|
||||
llama_stack_api.update_provider_data("tavily_search_api_key", tavily_search_api_key)
|
||||
|
||||
st.success("API keys saved successfully!")
|
||||
|
||||
# Display API Providers
|
||||
st.subheader("Available API Providers")
|
||||
apis_providers_lst = llama_stack_api.client.providers.list()
|
||||
api_to_providers = {}
|
||||
for api_provider in apis_providers_lst:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue