navigation

This commit is contained in:
Xi Yan 2024-12-02 20:11:32 -08:00
parent 06b9566eb6
commit 114595ce71
7 changed files with 148 additions and 6 deletions

View file

@ -28,16 +28,52 @@ def main():
rag_page = st.Page("page/playground/rag.py", title="RAG", icon="💬", default=False) rag_page = st.Page("page/playground/rag.py", title="RAG", icon="💬", default=False)
# Distribution pages # Distribution pages
distribution_page = st.Page( provider_page = st.Page(
"page/distribution/distro.py", title="Distribution", icon="🔍", default=False "page/distribution/providers.py", title="Provider", icon="🔍", default=False
)
model_page = st.Page(
"page/distribution/models.py", title="Models", icon="🔍", default=False
)
memory_bank_page = st.Page(
"page/distribution/memory_banks.py",
title="Memory Banks",
icon="🔍",
default=False,
)
shield_page = st.Page(
"page/distribution/shields.py", title="Shields", icon="🔍", default=False
)
scoring_function_page = st.Page(
"page/distribution/scoring_functions.py",
title="Scoring Functions",
icon="🔍",
default=False,
)
eval_task_page = st.Page(
"page/distribution/eval_tasks.py",
title="Eval Tasks",
icon="🔍",
default=False,
) )
pg = st.navigation( pg = st.navigation(
{ {
"Evaluations": [application_evaluation_page, native_evaluation_page], "Playground": [
"Playground": [chat_page, rag_page], chat_page,
"Distribution": [distribution_page], rag_page,
} application_evaluation_page,
native_evaluation_page,
],
"Inspect": [
provider_page,
model_page,
memory_bank_page,
shield_page,
scoring_function_page,
eval_task_page,
],
},
expanded=False,
) )
pg.run() pg.run()

View file

@ -0,0 +1,18 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import streamlit as st
from modules.api import llama_stack_api
# Eval Tasks Section
st.header("Eval Tasks")
eval_tasks_info = {
d.identifier: d.to_dict() for d in llama_stack_api.client.eval_tasks.list()
}
selected_eval_task = st.selectbox("Select an eval task", list(eval_tasks_info.keys()))
st.json(eval_tasks_info[selected_eval_task], expanded=True)

View file

@ -0,0 +1,21 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import streamlit as st
from modules.api import llama_stack_api
st.header("Memory Banks")
memory_banks_info = {
m.identifier: m.to_dict() for m in llama_stack_api.client.memory_banks.list()
}
if len(memory_banks_info) > 0:
selected_memory_bank = st.selectbox(
"Select a memory bank", list(memory_banks_info.keys())
)
st.json(memory_banks_info[selected_memory_bank])
else:
st.info("No memory banks found")

View file

@ -0,0 +1,15 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import streamlit as st
from modules.api import llama_stack_api
# Models Section
st.header("Models")
models_info = {m.identifier: m.to_dict() for m in llama_stack_api.client.models.list()}
selected_model = st.selectbox("Select a model", list(models_info.keys()))
st.json(models_info[selected_model])

View file

@ -0,0 +1,15 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import streamlit as st
from modules.api import llama_stack_api
st.header("API Providers")
apis_providers_info = llama_stack_api.client.providers.list()
# selected_api = st.selectbox("Select an API", list(apis_providers_info.keys()))
for api in apis_providers_info.keys():
st.markdown(f"###### {api}")
st.dataframe([p.to_dict() for p in apis_providers_info[api]], width=500)

View file

@ -0,0 +1,19 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import streamlit as st
from modules.api import llama_stack_api
st.header("Scoring Functions")
scoring_functions_info = {
s.identifier: s.to_dict() for s in llama_stack_api.client.scoring_functions.list()
}
selected_scoring_function = st.selectbox(
"Select a scoring function", list(scoring_functions_info.keys())
)
st.json(scoring_functions_info[selected_scoring_function], expanded=True)

View file

@ -0,0 +1,18 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import streamlit as st
from modules.api import llama_stack_api
# Shields Section
st.header("Shields")
shields_info = {
s.identifier: s.to_dict() for s in llama_stack_api.client.shields.list()
}
selected_shield = st.selectbox("Select a shield", list(shields_info.keys()))
st.json(shields_info[selected_shield])