trubrics / trubrics-sdk

Product analytics for AI Assistants
https://www.trubrics.com/
Apache License 2.0
131 stars 25 forks source link

Offline Mode #73

Closed ChrisDelClea closed 1 year ago

ChrisDelClea commented 1 year ago

Can you support offline mode? I do not want to create an account. However, i pretty much like your component.

jeffkayne commented 1 year ago

Hey @ChrisDelClea

Yes you can:

from datetime import datetime
import json
from trubrics.integrations.streamlit import FeedbackCollector

collector = FeedbackCollector(component_name="default", email=None, password=None)
feedback = collector.st_feedback(
    feedback_type="thumbs",
    model="your model",
    open_feedback_label="Optional text feedback",
    save_to_trubrics=False,
)
if feedback:
    feedback_json = json.dumps(feedback, indent=4, default=str)
    with open(f"{datetime.now()}.json", "w") as file:
        file.write(feedback_json)
jeffkayne commented 1 year ago

We've just open sourced our feedback components for you to use offline: https://github.com/trubrics/streamlit-feedback

Let me know what you think!

ChrisDelClea commented 1 year ago

Great!