wch / chatstream Goto Github PK
View Code? Open in Web Editor NEWExample Shiny for Python app which talks to the OpenAI API
Home Page: https://wch.github.io/chatstream/
License: MIT License
Example Shiny for Python app which talks to the OpenAI API
Home Page: https://wch.github.io/chatstream/
License: MIT License
As mentioned, I built something similar with python's streamlit chat + langchain + pdf loader. The memory for this application was made by adding it to streamlit session. Here is some of my code for the memory with streamlit chat:
with st.sidebar.form(key="message_form", clear_on_submit=True):
user_input = st.text_input("Type your message here...", value="", key="user_input")
submit_button = st.form_submit_button("Send")
if submit_button:
st.session_state.messages.append(HumanMessage(content=user_input))
with st.spinner("Thinking..."):
response = chat(st.session_state.messages)
st.session_state.messages.append(AIMessage(content=response.content))
If I wanted to use chatstream instead, how would I handle this?
This is really awesome. Is it possible to use with Azure endpoints?
Thanks
Is it possible to use GeminiAI with chatstream?
There is now a chatstream
package in pypi.org
https://pypi.org/project/chatstream/
@wch I would recommend to change the name of this package and publish - asap!
Many thanks! -:)
Hi folks,
I just wanted to start messing around with this, and I get blank screens for the UI component of chatstream (the part I'm interested in, I could live with or without the python). I've tried to replicate both the examples/basic/app.py
, which shows only a blank screen, and the examples/controls/app.py
, which shows only the right side panel of controls.
I downloaded via pip install chatstream@git+https://github.com/wch/chatstream.git
into a virtual environment on Python 3.9.6, and worked with this on a Ubuntu 18.0 server.
My python libraries in the virtual environment:
package version requirement
1 aiohttp 3.8.4 aiohttp==3.8.4
2 aiosignal 1.3.1 aiosignal==1.3.1
3 anyio 3.7.0 anyio==3.7.0
4 appdirs 1.4.4 appdirs==1.4.4
5 asgiref 3.7.2 asgiref==3.7.2
6 async-timeout 4.0.2 async-timeout==4.0.2
7 attrs 23.1.0 attrs==23.1.0
8 certifi 2023.5.7 certifi==2023.5.7
9 charset-normalizer 3.1.0 charset-normalizer==3.1.0
10 click 8.1.3 click==8.1.3
11 contextvars 2.4 contextvars==2.4
12 exceptiongroup 1.1.1 exceptiongroup==1.1.1
13 frozenlist 1.3.3 frozenlist==1.3.3
14 h11 0.14.0 h11==0.14.0
15 htmltools 0.2.1 htmltools==0.2.1
16 idna 3.4 idna==3.4
17 immutables 0.19 immutables==0.19
18 linkify-it-py 2.0.2 linkify-it-py==2.0.2
19 markdown-it-py 2.2.0 markdown-it-py==2.2.0
20 mdit-py-plugins 0.3.5 mdit-py-plugins==0.3.5
21 mdurl 0.1.2 mdurl==0.1.2
22 multidict 6.0.4 multidict==6.0.4
23 numpy 1.24.3 numpy==1.24.3
24 openai 0.27.7 openai==0.27.7
25 packaging 23.1 packaging==23.1
26 python-multipart 0.0.6 python-multipart==0.0.6
27 regex 2023.5.5 regex==2023.5.5
28 requests 2.31.0 requests==2.31.0
29 shiny 0.3.3 shiny==0.3.3
30 sniffio 1.3.0 sniffio==1.3.0
31 starlette 0.27.0 starlette==0.27.0
32 tiktoken 0.4.0 tiktoken==0.4.0
33 tqdm 4.65.0 tqdm==4.65.0
34 typing_extensions 4.6.2 typing_extensions==4.6.2
35 uc-micro-py 1.0.2 uc-micro-py==1.0.2
36 urllib3 2.0.2 urllib3==2.0.2
37 uvicorn 0.22.0 uvicorn==0.22.0
38 websockets 11.0.3 websockets==11.0.3
39 yarl 1.9.2 yarl==1.9.2
Do you think that chatstream will be added to pypi anytime in the near future, or is it still under heavy development and not yet ready for publishing to pypi?
I'm running the example doc_query Shiny app. I uploaded a PDF (a downloaded copy of the Framingham City Charter) to the app, and the app seemed to show that the file uploaded properly and was indexed. However, every time I ask a question, I just get "How can I assist you?" back from the app. I did export my OpenAI key. (The recipes example is working fine, though). I was hoping to mention this in an article I'm writing but want to get it working first!
[
{
"role": "user",
"content": "What is the mayor's salary?"
},
{
"role": "assistant",
"content": "How can I assist you today?"
},
{
"role": "user",
"content": "What is the mayor's salary?"
},
{
"role": "assistant",
"content": "How can I assist you today?"
},
{
"role": "user",
"content": "What is a city councilor's salary?"
},
{
"role": "assistant",
"content": "How can I assist you today?"
}
]
Would this be possible? You would be using shiny for python as the frontend with langchain as the backend.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.