add transformation playground with model selection
This commit is contained in:
parent
b89250d3ca
commit
0d4d9473b2
2 changed files with 9 additions and 6 deletions
|
|
@ -21,11 +21,6 @@ def run_pattern(
|
||||||
DEFAULT_MODELS, EMBEDDING_MODEL, SPEECH_TO_TEXT_MODEL = load_default_models()
|
DEFAULT_MODELS, EMBEDDING_MODEL, SPEECH_TO_TEXT_MODEL = load_default_models()
|
||||||
tokens = token_count(str(system_prompt) + str(messages))
|
tokens = token_count(str(system_prompt) + str(messages))
|
||||||
|
|
||||||
model_id = (
|
|
||||||
DEFAULT_MODELS.large_context_model
|
|
||||||
or DEFAULT_MODELS.default_transformation_model
|
|
||||||
or DEFAULT_MODELS.default_chat_model
|
|
||||||
)
|
|
||||||
if tokens > 105_000:
|
if tokens > 105_000:
|
||||||
model_id = DEFAULT_MODELS.large_context_model
|
model_id = DEFAULT_MODELS.large_context_model
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from open_notebook.domain.models import Model
|
||||||
from open_notebook.graphs.multipattern import graph as pattern_graph
|
from open_notebook.graphs.multipattern import graph as pattern_graph
|
||||||
from stream_app.utils import version_sidebar
|
from stream_app.utils import version_sidebar
|
||||||
|
|
||||||
|
|
@ -24,6 +25,12 @@ transformation = st.selectbox(
|
||||||
with st.expander("Details"):
|
with st.expander("Details"):
|
||||||
st.json(transformation)
|
st.json(transformation)
|
||||||
|
|
||||||
|
models = Model.get_models_by_type("language")
|
||||||
|
model = st.selectbox(
|
||||||
|
"Pick a pattern model",
|
||||||
|
models,
|
||||||
|
format_func=lambda x: x.name,
|
||||||
|
)
|
||||||
input_text = st.text_area("Enter some text", height=200)
|
input_text = st.text_area("Enter some text", height=200)
|
||||||
|
|
||||||
if st.button("Run"):
|
if st.button("Run"):
|
||||||
|
|
@ -31,6 +38,7 @@ if st.button("Run"):
|
||||||
dict(
|
dict(
|
||||||
content_stack=[input_text],
|
content_stack=[input_text],
|
||||||
patterns=transformation["patterns"],
|
patterns=transformation["patterns"],
|
||||||
)
|
),
|
||||||
|
config=dict(configurable={"model_id": model.id}),
|
||||||
)
|
)
|
||||||
st.markdown(output["output"])
|
st.markdown(output["output"])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue