Skip to content
This repository was archived by the owner on Apr 12, 2026. It is now read-only.
Closed
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
22 changes: 19 additions & 3 deletions freestream/pages/1_💬_Curie.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
if st.sidebar.button("Clear message history", use_container_width=True):
msgs.clear()

# Create dictionaries with keys to chat model classes
# Create dictionaries with chat models as keys
openai_models = {
"GPT-4o Mini": ChatOpenAI( # Define a dictionary entry for the "ChatOpenAI GPT-3.5 Turbo" model
model="gpt-4o-mini", # Set the OpenAI model name
Expand All @@ -89,7 +89,23 @@
streaming=True,
max_tokens=4096,
max_retries=1,
)
),
# "GPT-o1-mini": ChatOpenAI( # Define a dictionary entry for the "ChatOpenAI GPT-3.5 Turbo" model
# model="o1-mini", # Set the OpenAI model name
# openai_api_key=openai_api_key, # Set the OpenAI API key from the Streamlit secrets manager
# temperature=temperature_slider, # Set the temperature for the model's responses using the sidebar slider
# streaming=True, # Enable streaming responses for the model
# max_tokens=4096, # Set the maximum number of tokens for the model's responses
# max_retries=1, # Set the maximum number of retries for the model
# ),
# "GPT-o1-preview": ChatOpenAI(
# model="o1-preview",
# openai_api_key=openai_api_key,
# temperature=temperature_slider,
# streaming=True,
# max_tokens=4096,
# max_retries=1,
# )
}

anthropic_models = {
Expand Down Expand Up @@ -145,7 +161,7 @@
[
(
"system",
"""You are a friendly AI chatbot designed to assist users in learning, programming, and project management. Your role is to guide users towards the right answers by providing thoughtful, well-reasoned responses. When faced with a question, decompose the problem into smaller, manageable parts and reason through each step systematically. Verify step by step to provide comprehensive, truthful answers. Your main goals are to help the user learn, and provide actionable code when asked.""",
"""You are a chatbot primarily designed to assist users in learning, programming, and project management; help the user learn, and provide actionable code when asked. When faced with a question that does not have a clear answer, verify step by step to decompose the problem into smaller, manageable parts and reason through each step systematically.""",
),
MessagesPlaceholder(variable_name="chat_history"),
("human", "{question}"),
Expand Down
20 changes: 18 additions & 2 deletions freestream/pages/2_🤖_RAGbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
if st.sidebar.button("Clear message history", use_container_width=True):
msgs.clear()

# Create dictionaries with keys to chat model classes
# Create dictionaries with chat models as keys
openai_models = {
"GPT-4o Mini": ChatOpenAI( # Define a dictionary entry for the "ChatOpenAI GPT-3.5 Turbo" model
model="gpt-4o-mini", # Set the OpenAI model name
Expand All @@ -101,7 +101,23 @@
streaming=True,
max_tokens=4096,
max_retries=1,
)
),
# "GPT-o1-mini": ChatOpenAI( # Define a dictionary entry for the "ChatOpenAI GPT-3.5 Turbo" model
# model="o1-mini", # Set the OpenAI model name
# openai_api_key=openai_api_key, # Set the OpenAI API key from the Streamlit secrets manager
# temperature=temperature_slider, # Set the temperature for the model's responses using the sidebar slider
# streaming=True, # Enable streaming responses for the model
# max_tokens=4096, # Set the maximum number of tokens for the model's responses
# max_retries=1, # Set the maximum number of retries for the model
# ),
# "GPT-o1-preview": ChatOpenAI(
# model="o1-preview",
# openai_api_key=openai_api_key,
# temperature=temperature_slider,
# streaming=True,
# max_tokens=4096,
# max_retries=1,
# )
}

anthropic_models = {
Expand Down
14 changes: 8 additions & 6 deletions freestream/🏡_Home.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@

:orange[*General Purpose Chatbot*]

Curie is great for constructive feedback and programming code. Plus you don't have to upload any files. It's great for stuffing context into your questions when you use the Claude Haiku model. Personally, I like GPT-4o for coding the most.
Curie is great for reflective critical thinking and programming code. It's also great for context-stuffing, which is when you just copy/paste whatever context you want the AI to consider. Context-stuffing is particularily useful when you want the AI to generate a response based on the entirety of your context, rather than just retrieving semantically-similar snippets of your context, which is what RAGbot does.
"""
)

with st.expander(label=":violet[System Prompt:]", expanded=False):
st.markdown(
"""
*You are a friendly AI chatbot designed to assist users in learning, programming, and project management. Your role is to guide users towards the right answers by providing thoughtful, well-reasoned responses. When faced with a question, decompose the problem into smaller, manageable parts and reason through each step systematically. Verify step by step to provide comprehensive, truthful answers. Your main goals are to help the user learn, and provide actionable code when asked.*
*You are a chatbot primarily designed to assist users in learning, programming, and project management; help the user learn, and provide actionable code when asked. When faced with a question that does not have a clear answer, verify step by step to decompose the problem into smaller, manageable parts and reason through each step systematically.*
"""
)
st.write(
Expand All @@ -43,7 +43,9 @@

:orange[*Vector Store Based Chatbot*]

The first chatbot made for FreeStream was RAGbot. RAGbot searches files you upload for answers to your questions. It's great for asking specific questions about long policy documents, summarizing the contents of an article, or synthesizing knowledge from multiple sources, such as legal or scientific documents. You may to upload however many PDFs, Word documents, or plain text files you'd like. You can then pose specific questions directly related to the content of your documents.
RAGbot searches files you upload for answers to your questions. It first rephrases the user's query and then retrieves specific snippets of your uploaded documents that are semantically relevant to your question.

It's great at finding specific answers from long documents and synthesizing knowledge from across uploaded documents. You may to upload however many PDFs, Word documents, or plain text files you'd like.
"""
)

Expand All @@ -56,11 +58,11 @@

3. Embedding Generation: The chunks of text are turned into vector embeddings, which basically means the data is standardized into numerical representations.

4. Retriever Creation and Indexing: The vector embeddings are sorted into a vector database using FAISS.
4. Retriever Creation and Indexing: The vector embeddings are sorted into a vector database using Facebook AI Similarity Search (FAISS).

5. Context Retrieval: Upon being asked a question, the retriever returns the relevant context from the vector database.
5. Context Retrieval: Upon being asked a question, the chatbot rephrases the user's query to optimize retrieved results, and then retrieves relevant context from the vector database.

6. Context Relevance Validation: To safeguard against errors, the system only generates a response if the retrieved context is sufficiently relevant to aide the AI's response.
6. Context Relevance Validation: To safeguard against errors, the system will claim ignorance if the retrieved context is impertinent to the query and the chatbot doesn't have training knowledge to sufficiently answer the query.

7. Question Answering: The system meticulously answers your question, drawing knowledge exclusively from the retrieved content.
"""
Expand Down
Loading