diff --git a/llama_stack/distribution/ui/app.py b/llama_stack/distribution/ui/app.py index 23452530e..d773140a8 100644 --- a/llama_stack/distribution/ui/app.py +++ b/llama_stack/distribution/ui/app.py @@ -28,16 +28,52 @@ def main(): rag_page = st.Page("page/playground/rag.py", title="RAG", icon="💬", default=False) # Distribution pages - distribution_page = st.Page( - "page/distribution/distro.py", title="Distribution", icon="🔍", default=False + provider_page = st.Page( + "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( { - "Evaluations": [application_evaluation_page, native_evaluation_page], - "Playground": [chat_page, rag_page], - "Distribution": [distribution_page], - } + "Playground": [ + chat_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() diff --git a/llama_stack/distribution/ui/page/distribution/eval_tasks.py b/llama_stack/distribution/ui/page/distribution/eval_tasks.py new file mode 100644 index 000000000..8a36aebd1 --- /dev/null +++ b/llama_stack/distribution/ui/page/distribution/eval_tasks.py @@ -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) diff --git a/llama_stack/distribution/ui/page/distribution/memory_banks.py b/llama_stack/distribution/ui/page/distribution/memory_banks.py new file mode 100644 index 000000000..2fe23902d --- /dev/null +++ b/llama_stack/distribution/ui/page/distribution/memory_banks.py @@ -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") diff --git a/llama_stack/distribution/ui/page/distribution/models.py b/llama_stack/distribution/ui/page/distribution/models.py new file mode 100644 index 000000000..db5285c1b --- /dev/null +++ b/llama_stack/distribution/ui/page/distribution/models.py @@ -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]) diff --git a/llama_stack/distribution/ui/page/distribution/providers.py b/llama_stack/distribution/ui/page/distribution/providers.py new file mode 100644 index 000000000..b2ae10f7a --- /dev/null +++ b/llama_stack/distribution/ui/page/distribution/providers.py @@ -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) diff --git a/llama_stack/distribution/ui/page/distribution/scoring_functions.py b/llama_stack/distribution/ui/page/distribution/scoring_functions.py new file mode 100644 index 000000000..bf1d4a8a3 --- /dev/null +++ b/llama_stack/distribution/ui/page/distribution/scoring_functions.py @@ -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) diff --git a/llama_stack/distribution/ui/page/distribution/shields.py b/llama_stack/distribution/ui/page/distribution/shields.py new file mode 100644 index 000000000..afce90421 --- /dev/null +++ b/llama_stack/distribution/ui/page/distribution/shields.py @@ -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])