-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from meghdadFar/feature/chat-in-streamlit
Chat functionality and chat UI
- Loading branch information
Showing
21 changed files
with
766 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Chat with Wordview | ||
################## | ||
|
||
Worldview integrates GPT-3.5-Turbo to enable the users to interact with their data and get insights from it via Natural Language. | ||
See examples of chatting with different components of Wordview below. | ||
|
||
|
||
Chat with TextStatsPlots | ||
~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
After allowing Wordview to process and analyze your corpus, you can | ||
call the `chat` method to interact with the data and get insights from it via Natural Language. | ||
|
||
.. code:: python | ||
import json | ||
import pandas as pd | ||
from wordview.text_analysis import TextStatsPlots | ||
imdb_df = pd.read_csv("data/IMDB_Dataset_sample_5k.csv") | ||
with open("wordview/chat/secrets/openai_api_key.json", "r") as f: | ||
credentials = json.load(f) | ||
tsp = TextStatsPlots(df=imdb_df, text_column="review") | ||
tsp.chat(api_key=credentials.get("openai_api_key")) | ||
The chat UI is available under http://127.0.0.1:5000/ | ||
|
||
|chat| | ||
|
||
.. |chat| image:: ../figs/chat.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
<!DOCTYPE html> | ||
<html class="writer-html5" lang="en" > | ||
<head> | ||
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" /> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Chat with Wordview — wordview "1.1.2" documentation</title> | ||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> | ||
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" /> | ||
<link rel="stylesheet" href="_static/custom.css" type="text/css" /> | ||
<link rel="stylesheet" href="_static/fonts.css" type="text/css" /> | ||
<!--[if lt IE 9]> | ||
<script src="_static/js/html5shiv.min.js"></script> | ||
<![endif]--> | ||
|
||
<script src="_static/jquery.js"></script> | ||
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script> | ||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> | ||
<script src="_static/doctools.js"></script> | ||
<script src="_static/sphinx_highlight.js"></script> | ||
<script src="_static/js/theme.js"></script> | ||
<link rel="index" title="Index" href="genindex.html" /> | ||
<link rel="search" title="Search" href="search.html" /> | ||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
<div class="wy-grid-for-nav"> | ||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search" > | ||
|
||
|
||
|
||
<a href="index.html" class="icon icon-home"> | ||
wordview | ||
</a> | ||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> | ||
<p class="caption" role="heading"><span class="caption-text">Quick Start</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="start.html">Installation</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="start.html#what-is-wordview">What is Wordview</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="start.html#tutorials">Tutorials</a></li> | ||
</ul> | ||
<p class="caption" role="heading"><span class="caption-text">Exploratory Data Analysis (EDA)</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="textstats.html">Text Analysis</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="labels.html">Label Analysis</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="mwes.html">Analysis & Extraction of Multiword Expressions (MWEs)</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="bias.html">Bias Analysis</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="anomalies.html">Analysis of Anomalies & Outliers</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="clustering.html">Cluster Analysis</a></li> | ||
</ul> | ||
<p class="caption" role="heading"><span class="caption-text">Utilities</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="utilities.html">Utilities</a></li> | ||
</ul> | ||
<p class="caption" role="heading"><span class="caption-text">Contributing</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="contributing.html">Contributing to wordview</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="codeofconduct.html">Contributor Code of Conduct</a></li> | ||
</ul> | ||
<p class="caption" role="heading"><span class="caption-text">API Reference</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="api.html">API</a></li> | ||
</ul> | ||
|
||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="index.html">wordview</a> | ||
</nav> | ||
|
||
<div class="wy-nav-content"> | ||
<div class="rst-content"> | ||
<div role="navigation" aria-label="Page navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li> | ||
<li class="breadcrumb-item active">Chat with Wordview</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
<a href="_sources/chat.rst.txt" rel="nofollow"> View page source</a> | ||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<section id="chat-with-wordview"> | ||
<h1>Chat with Wordview<a class="headerlink" href="#chat-with-wordview" title="Permalink to this heading"></a></h1> | ||
<p>Worldview integrates GPT-3.5-Turbo to enable the users to interact with their data and get insights from it via Natural Language. | ||
See examples of chatting with different components of Wordview below.</p> | ||
<section id="chat-with-textstatsplots"> | ||
<h2>Chat with TextStatsPlots<a class="headerlink" href="#chat-with-textstatsplots" title="Permalink to this heading"></a></h2> | ||
<p>After allowing Wordview to process and analyze your corpus, you can | ||
call the <cite>chat</cite> method to interact with the data and get insights from it via Natural Language.</p> | ||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">json</span> | ||
|
||
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span> | ||
|
||
<span class="kn">from</span> <span class="nn">wordview.text_analysis</span> <span class="kn">import</span> <span class="n">TextStatsPlots</span> | ||
<span class="n">imdb_df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_csv</span><span class="p">(</span><span class="s2">"data/IMDB_Dataset_sample_5k.csv"</span><span class="p">)</span> | ||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"wordview/chat/secrets/openai_api_key.json"</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> | ||
<span class="n">credentials</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">f</span><span class="p">)</span> | ||
|
||
<span class="n">tsp</span> <span class="o">=</span> <span class="n">TextStatsPlots</span><span class="p">(</span><span class="n">df</span><span class="o">=</span><span class="n">imdb_df</span><span class="p">,</span> <span class="n">text_column</span><span class="o">=</span><span class="s2">"review"</span><span class="p">)</span> | ||
<span class="n">tsp</span><span class="o">.</span><span class="n">chat</span><span class="p">(</span><span class="n">api_key</span><span class="o">=</span><span class="n">credentials</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"openai_api_key"</span><span class="p">))</span> | ||
</pre></div> | ||
</div> | ||
<p>The chat UI is available under <a class="reference external" href="http://127.0.0.1:5000/">http://127.0.0.1:5000/</a></p> | ||
<p><img alt="chat" src="_images/chat.png" /></p> | ||
</section> | ||
</section> | ||
|
||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p>© Copyright 2023, Meghdad Farahmand.</p> | ||
</div> | ||
|
||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a | ||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> | ||
provided by <a href="https://readthedocs.org">Read the Docs</a>. | ||
|
||
|
||
</footer> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
<script> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.