Skip to content
This repository was archived by the owner on Apr 12, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.streamlit
.streamlit/secrets.toml
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
74 changes: 74 additions & 0 deletions .streamlit/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[logger]
level = "info"
# String format for logging messages. If logger.datetimeFormat is set,
# logger messages will default to `%(asctime)s.%(msecs)03d %(message)s`. See
# Python's documentation for available attributes:
# https://docs.python.org/2.6/library/logging.html#formatter-objects
# Default: "%(asctime)s %(message)s"
messageFormat = "%(asctime)s %(message)s"

[client]
# Controls whether uncaught app exceptions and deprecation warnings
# are displayed in the browser. By default, this is set to True and
# Streamlit displays app exceptions and associated tracebacks, and
# deprecation warnings, in the browser.
#
# If set to False, deprecation warnings and full exception messages
# will print to the console only. Exceptions will still display in the
# browser with a generic error message. For now, the exception type and
# traceback show in the browser also, but they will be removed in the
# future.
# Default: true
showErrorDetails = false

# Controls whether the default sidebar page navigation in a multipage app is
# displayed.
# Default: true
showSidebarNavigation = true

[runner]

# Allows you to type a variable or string by itself in a single line of
# Python code to write it to the app.
# Default: true
magicEnabled = false

[server]

# List of folders that should not be watched for changes. This
# impacts both "Run on Save" and @st.cache.
# Relative paths will be taken as relative to the current working directory.
# Example: ['/home/user1/env', 'relative/path/to/folder']
# Default: []
folderWatchBlacklist = ['.streamlit/']

# Automatically rerun script when the file is modified on disk.
# Default: false
runOnSave = true

[browser]
# Whether to send usage statistics to Streamlit.
# Default: true
gatherUsageStats = true

[theme]

# The preset Streamlit theme that your custom theme inherits from.
# One of "light" or "dark".
# base =

# Primary accent color for interactive elements.
# primaryColor =

# Background color for the main content area.
# backgroundColor =

# Background color used for the sidebar and most interactive widgets.
# secondaryBackgroundColor =

# Color used for almost all text.
# textColor =

# Font family for all text in the app, except code blocks. One of "sans serif",
# "serif", or "monospace".
# font =
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,5 @@ A conglomerate privacy policy governing FreeStream is planned. For the time bein

- [OpenAI Privacy Policy](https://openai.com/policies/privacy-policy)
- [Google AI Studio](https://transparency.google/our-policies/privacy-policy-terms-of-service/)
- I couldn't find a privacy policy specific to Google AI Studio.
- I couldn't find a privacy policy specific to Google AI Studio.
- [Streamlit](https://streamlit.io/privacy-policy/)
7 changes: 4 additions & 3 deletions freestream/pages/1_🤖_RAGbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
temperature=0.7, # Set the temperature for the model's responses
streaming=True, # Enable streaming responses for the model
),

"Gemini-Pro": ChatGoogleGenerativeAI(
model="gemini-pro",
google_api_key=st.secrets.GOOGLE.google_api_key,
Expand All @@ -62,15 +61,17 @@
convert_system_message_to_human=True,
max_output_tokens=512,
max_retries=1,
)
),
}

# Create a dropdown menu for selecting a chat model
selected_model = st.selectbox(
label="Choose your chat model:", # Set the label for the dropdown menu
options=list(model_names.keys()), # Set the available model options
key="model_selector", # Set a unique key for the dropdown menu
on_change=lambda: set_llm(st.session_state.model_selector, model_names), # Set the callback function
on_change=lambda: set_llm(
st.session_state.model_selector, model_names
), # Set the callback function
)

# Load the selected model dynamically
Expand Down
37 changes: 9 additions & 28 deletions freestream/pages/utils/utility_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,42 +173,23 @@ def on_retriever_end(self, documents, **kwargs):
self.status.update(state="complete")


# Define a callback function for when a model is selected
# Define a callback function for selecting a model
def set_llm(selected_model: str, model_names: dict):
"""
Updates the large language model (LLM) in the session state based on the user's selection.
Sets the large language model (LLM) in the session state based on the user's selection.
Also, displays an alert based on the selected model.

Parameters:
- None

Returns:
- None

This function has the following side effects:
1. It updates the `llm` key in the `st.session_state` dictionary with the selected model.
2. It displays a warning message when the user switches to the "ChatOpenAI GPT-3.5 Turbo" model.
3. It displays a failure warning message when the user fails to change the model (e.g., due to unsupported models).
"""
try:
# Set the model in session state
st.session_state.llm = model_names[selected_model]

# Show an alert based on what model was selected
if selected_model == "GPT-3.5 Turbo":
st.success(body="Switched to GPT-3.5 Turbo!", icon="⚠️")
elif selected_model == "Gemini-Pro":
st.success(body="Switched to Gemini-Pro!", icon="⚠️")

# Add more if statements for each added model
# if st.session_state.model_selector == model_names["GPT-4"]:
# ...

else:
# This should not happen if all models are covered above
raise ValueError(f"Unsupported model selected: {selected_model}")
st.success(body=f"Switched to {selected_model}!", icon="✅")

except Exception as e:
# Log the detailed error message
logging.error(f"Error changing model: {e}")
logging.error(
f"Unsupported model selected or Error changing model: {e}\n{selected_model}"
)
# Display a more informative error message to the user
st.error(f"Failed to change model! Error: {e}")
st.error(f"Failed to change model! Error: {e}\n{selected_model}")
28 changes: 14 additions & 14 deletions freestream/🏡_Home.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import streamlit as st

st.set_page_config(
page_title="FreeStream: Unlimited Access to AI Tools",
page_icon="🏡"
)
st.set_page_config(page_title="FreeStream: Unlimited Access to AI Tools", page_icon="🏡")

st.title("FreeStream")
st.header(":green[_Unlimited Access to AI Tools_]", divider="red")
# Project Overview
st.subheader("What is FreeStream?")
st.subheader(":blue[What is FreeStream?]")

st.write(
"""
FreeStream is a project I'm working on to make AI tools more accessible. It's not just about having a chatbot; it's about exploring how AI can help us in our daily lives, today and in the future. Here's what you can do with FreeStream:

* **Explore AI Tools:** Dive into a wide range of AI tools, from chatbots to document analysis, to discover what's possible.
* **Educate Yourself:** Engage in interactive experiences designed to deepen your understanding of AI and its capabilities.
* **Solve Real-World Problems:** Utilize AI tools to simplify and enhance your daily tasks, showcasing the power of AI in action.
AI tools often seem complex or even intimidating, but FreeStream aims to change that. This project is about making AI accessible and understandable, showing how it can solve real-world problems in your daily life.
"""
)

st.divider()
st.subheader("What tools are currently available?")
st.write(
"""
* **RAGbot**: An AI chatbot designed to answer questions about documents.

### :blue[RAGbot]:

:orange[*FreeStream's RAGbot can answer your questions directly from the documents you provide.*]

It works by allowing you to upload PDFs, Word documents, or plain text files, and then ask specific questions based on the information in your documents. The RAGbot uses a method called Corrective Retrieval Augmented Generation (CRAG), which involves retrieving documents, grading them for relevance, and generating answers if at least one document is relevant. If all documents are ambiguous or incorrect, it retrieves from an external source and uses that as context for answer generation. This process ensures a neat workflow where retrieval is done similarly to basic RAG, but with an added step of reasoning about the documents to ensure accurate and helpful responses.
"""
)


st.markdown(
"""
#### References
Expand All @@ -40,7 +40,7 @@

# Create a footer using community suggestion:
# https://discuss.streamlit.io/t/streamlit-footer/12181
footer="""<style>
footer = """<style>
a:link , a:visited{
color: #ffffff; /* White */
background-color: transparent;
Expand Down Expand Up @@ -72,4 +72,4 @@
<p>Developed with ❤ by <a href="https://www.linkedin.com/in/daemon-carino/" target="_blank">Daethyra</a></p>
</div>
"""
st.markdown(footer,unsafe_allow_html=True)
st.markdown(footer, unsafe_allow_html=True)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]

name = "FreeStream"
version = "3.0.2"
version = "3.0.3"
description = "An effort to give easy access to generative AI."
authors = ["Daethyra <109057945+Daethyra@users.noreply.github.com>"]
readme = "README.md"
Expand Down