You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
open_feedback_label="[Optional] Provide additional feedback",
107
+
model="gpt-3.5-turbo",
108
+
prompt_id=None, # checkout collector.log_prompt() to log your user prompts
109
+
)
110
+
111
+
if user_feedback:
112
+
st.write("#### Raw feedback saved to Trubrics:")
113
+
st.write(user_feedback)
123
114
```
124
115
116
+
For a full examples logging user prompts and feedback in Streamlit, see our [Streamlit integration docs](https://trubrics.github.io/trubrics-sdk/integrations/streamlit/).
117
+
125
118
## Collect user feedback from a React.js app
126
119
127
120
To collect user feedback from a React application, check out [this example](https://github.com/trubrics/trubrics-sdk/tree/main/examples/react_js).
Once you have created an account with [Trubrics](https://trubrics.streamlit.app/), you can try our deployed example Streamlit apps that use the integration to save feedback:
13
13
14
-
-[LLM Chat Completion](https://trubrics-llm-example-chatbot.streamlit.app/): A chatbot that queries OpenAI's API and allows users to leave feedback.
15
-
-[LLM Completion](https://trubrics-llm-example.streamlit.app/): An LLM app that queries OpenAI's API and allows users to leave feedback on single text generations.
16
-
-[Titanic](https://trubrics-titanic-example.streamlit.app/): An app that allows users to give feedback on a classifier that predicts whether passengers will survive the titanic.
14
+

15
+
16
+
-**LLM chat** - [deployed app](https://trubrics-llm-example-chatbot.streamlit.app/) | [code](https://github.com/trubrics/trubrics-sdk/blob/main/examples/streamlit/llm_chatbot.py) : A chatbot that queries OpenAI's API and allows users to leave feedback.
17
+
-**LLM single answer** - [deployed app](https://trubrics-llm-example.streamlit.app/) | [code](https://github.com/trubrics/trubrics-sdk/blob/main/examples/streamlit/llm_app.py) : An LLM app that queries OpenAI's API and allows users to leave feedback on single text generations.
17
18
18
19
The code for these apps can be viewed in the [trubrics-sdk](https://github.com/trubrics/trubrics-sdk/tree/main/examples), and may be run by cloning the repo and running:
19
20
20
-
=== "LLM Chat Completion"
21
+
=== "LLM chat"
21
22
!!!tip OpenAI
22
23
To run this app, you are required to have your own [OpenAI](https://platform.openai.com/overview) API key.
23
24
@@ -31,7 +32,7 @@ The code for these apps can be viewed in the [trubrics-sdk](https://github.com/t
31
32
streamlit run examples/feedback/streamlit/llm_chatbot.py
32
33
```
33
34
34
-
=== "LLM Completion"
35
+
=== "LLM single answer"
35
36
!!!tip OpenAI
36
37
To run this app, you are required to have your own [OpenAI](https://platform.openai.com/overview) API key.
37
38
@@ -45,24 +46,18 @@ The code for these apps can be viewed in the [trubrics-sdk](https://github.com/t
45
46
streamlit run examples/feedback/streamlit/llm_app.py
46
47
```
47
48
48
-
=== "Titanic"
49
-
50
-
```
51
-
pip install scikit-learn==1.1.0
52
-
```
49
+
## Add the FeedbackCollector to your App
53
50
54
-
```console
55
-
streamlit run examples/feedback/streamlit/titanic_app.py
56
-
```
51
+
Here is a complete example to log user prompts and feedback from a simple streamlit application:
57
52
58
-
## Add the FeedbackCollector to your App
59
-
To get started, you can add this code snippet directly to your streamlit app:
60
-
```py
53
+
```py title="examples/streamlit/basic_app.py"
61
54
import streamlit as st
62
55
from trubrics.integrations.streamlit import FeedbackCollector
0 commit comments