Fahad Mattoo commited on
Commit
d4a7025
1 Parent(s): ec2081f

Simple app (#5) (#6)

Browse files

* title app

* updating the req, readme, and the app

* update

* updating pylint

* adding complete application

* linting update

* addding pytest

* updating tonl

* adad

* upda

* updating yml file

* test

.github/workflows/github-ci.yml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: lint-and-test
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ lint:
7
+ runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ matrix:
11
+ python-version: ["3.10"]
12
+
13
+ steps:
14
+ - name: Checkout code
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Set up Python ${{ matrix.python-version }}
18
+ uses: actions/setup-python@v4
19
+ with:
20
+ python-version: ${{ matrix.python-version }}
21
+
22
+ - name: Install dependencies
23
+ run: |
24
+ python -m pip install --upgrade pip
25
+ pip install pylint
26
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
27
+
28
+ - name: Run pylint
29
+ run: |
30
+ pylint $(git ls-files '*.py')
31
+
32
+ test:
33
+ runs-on: ubuntu-latest
34
+
35
+ strategy:
36
+ matrix:
37
+ python-version: ["3.10"]
38
+
39
+ steps:
40
+ - name: Checkout code
41
+ uses: actions/checkout@v4
42
+
43
+ - name: Set up Python ${{ matrix.python-version }}
44
+ uses: actions/setup-python@v4
45
+ with:
46
+ python-version: ${{ matrix.python-version }}
47
+
48
+ - name: Install dependencies
49
+ run: |
50
+ python -m pip install --upgrade pip
51
+ pip install pytest-cov
52
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
53
+
54
+ - name: Run pytest with coverage
55
+ run: |
56
+ pytest --cov=src --cov-report=term-missing --cov-branch
.github/workflows/pylint.yml DELETED
@@ -1,23 +0,0 @@
1
- name: Pylint
2
-
3
- on: [push]
4
-
5
- jobs:
6
- build:
7
- runs-on: ubuntu-latest
8
- strategy:
9
- matrix:
10
- python-version: ["3.10", "3.11"]
11
- steps:
12
- - uses: actions/checkout@v4
13
- - name: Set up Python ${{ matrix.python-version }}
14
- uses: actions/setup-python@v4
15
- with:
16
- python-version: ${{ matrix.python-version }}
17
- - name: Install dependencies
18
- run: |
19
- python -m pip install --upgrade pip
20
- pip install pylint
21
- - name: Analysing the code with pylint
22
- run: |
23
- pylint $(git ls-files '*.py')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore CHANGED
@@ -1,160 +1,160 @@
1
- # Byte-compiled / optimized / DLL files
2
- __pycache__/
3
- *.py[cod]
4
- *$py.class
5
-
6
- # C extensions
7
- *.so
8
-
9
- # Distribution / packaging
10
- .Python
11
- build/
12
- develop-eggs/
13
- dist/
14
- downloads/
15
- eggs/
16
- .eggs/
17
- lib/
18
- lib64/
19
- parts/
20
- sdist/
21
- var/
22
- wheels/
23
- share/python-wheels/
24
- *.egg-info/
25
- .installed.cfg
26
- *.egg
27
- MANIFEST
28
-
29
- # PyInstaller
30
- # Usually these files are written by a python script from a template
31
- # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
- *.manifest
33
- *.spec
34
-
35
- # Installer logs
36
- pip-log.txt
37
- pip-delete-this-directory.txt
38
-
39
- # Unit test / coverage reports
40
- htmlcov/
41
- .tox/
42
- .nox/
43
- .coverage
44
- .coverage.*
45
- .cache
46
- nosetests.xml
47
- coverage.xml
48
- *.cover
49
- *.py,cover
50
- .hypothesis/
51
- .pytest_cache/
52
- cover/
53
-
54
- # Translations
55
- *.mo
56
- *.pot
57
-
58
- # Django stuff:
59
- *.log
60
- local_settings.py
61
- db.sqlite3
62
- db.sqlite3-journal
63
-
64
- # Flask stuff:
65
- instance/
66
- .webassets-cache
67
-
68
- # Scrapy stuff:
69
- .scrapy
70
-
71
- # Sphinx documentation
72
- docs/_build/
73
-
74
- # PyBuilder
75
- .pybuilder/
76
- target/
77
-
78
- # Jupyter Notebook
79
- .ipynb_checkpoints
80
-
81
- # IPython
82
- profile_default/
83
- ipython_config.py
84
-
85
- # pyenv
86
- # For a library or package, you might want to ignore these files since the code is
87
- # intended to run in multiple environments; otherwise, check them in:
88
- # .python-version
89
-
90
- # pipenv
91
- # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
- # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
- # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
- # install all needed dependencies.
95
- #Pipfile.lock
96
-
97
- # poetry
98
- # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
- # This is especially recommended for binary packages to ensure reproducibility, and is more
100
- # commonly ignored for libraries.
101
- # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
- #poetry.lock
103
-
104
- # pdm
105
- # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
- #pdm.lock
107
- # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
- # in version control.
109
- # https://pdm.fming.dev/#use-with-ide
110
- .pdm.toml
111
-
112
- # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
- __pypackages__/
114
-
115
- # Celery stuff
116
- celerybeat-schedule
117
- celerybeat.pid
118
-
119
- # SageMath parsed files
120
- *.sage.py
121
-
122
- # Environments
123
- .env
124
- .venv
125
- env/
126
- venv/
127
- ENV/
128
- env.bak/
129
- venv.bak/
130
-
131
- # Spyder project settings
132
- .spyderproject
133
- .spyproject
134
-
135
- # Rope project settings
136
- .ropeproject
137
-
138
- # mkdocs documentation
139
- /site
140
-
141
- # mypy
142
- .mypy_cache/
143
- .dmypy.json
144
- dmypy.json
145
-
146
- # Pyre type checker
147
- .pyre/
148
-
149
- # pytype static type analyzer
150
- .pytype/
151
-
152
- # Cython debug symbols
153
- cython_debug/
154
-
155
- # PyCharm
156
- # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
- # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
- # and can be added to the global gitignore or merged into this file. For a more nuclear
159
- # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
- #.idea/
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
.streamlit/config.toml ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [client]
2
+ showErrorDetails = false
LICENSE CHANGED
@@ -1,24 +1,24 @@
1
- This is free and unencumbered software released into the public domain.
2
-
3
- Anyone is free to copy, modify, publish, use, compile, sell, or
4
- distribute this software, either in source code form or as a compiled
5
- binary, for any purpose, commercial or non-commercial, and by any
6
- means.
7
-
8
- In jurisdictions that recognize copyright laws, the author or authors
9
- of this software dedicate any and all copyright interest in the
10
- software to the public domain. We make this dedication for the benefit
11
- of the public at large and to the detriment of our heirs and
12
- successors. We intend this dedication to be an overt act of
13
- relinquishment in perpetuity of all present and future rights to this
14
- software under copyright law.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.
23
-
24
- For more information, please refer to <https://unlicense.org>
 
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <https://unlicense.org>
README.md CHANGED
@@ -1,2 +1,33 @@
1
- # simple-chat-bot
2
- This is a simple chat bot using openAI GPT models.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # simple-chat-bot
2
+ This is a simple chat bot using openAI GPT models.
3
+
4
+ ## Create env
5
+
6
+ 1. Create conda env
7
+ ```
8
+ conda create -n chat_bot_env python=3.10
9
+ ```
10
+
11
+ 2. Activate env
12
+
13
+ ```
14
+ conda activate chat_bot_env
15
+ ```
16
+
17
+ 3. install packages
18
+ ```
19
+ pip install -r requirements.txt
20
+ ```
21
+
22
+ ## Run the application
23
+
24
+ ```
25
+ streamlit run src\app.py
26
+ ```
27
+
28
+
29
+
30
+
31
+
32
+
33
+
pyproject.toml CHANGED
@@ -1,190 +1,188 @@
1
- [project]
2
- name = "simple-chat-bot"
3
- authors = [
4
- {name = "Fahad Mattoo", email = "[email protected]"},
5
- ]
6
- description = "A simple chat bot."
7
- readme = "README.md"
8
- classifiers = [
9
- "Development Status :: beta",
10
- "Programming Language :: Python :: 3 :: Only",
11
- "Programming Language :: Python :: 3.10",
12
- "Programming Language :: Python :: 3.11"
13
- ]
14
- requires-python = ">=3.10"
15
- dynamic = ["version"]
16
-
17
- [tool.black]
18
- line-length = 120
19
- fast = true
20
-
21
- [tool.coverage.run]
22
- branch = true
23
-
24
- [tool.coverage.report]
25
- fail_under = 100
26
-
27
- [tool.pytest.ini_options]
28
- addopts = "--cov-report xml:coverage.xml --cov src --cov-fail-under 0 --cov-append -m 'not integration'"
29
- pythonpath = [
30
- "src"
31
- ]
32
- testpaths = "tests"
33
-
34
- [tool.pylint]
35
- extension-pkg-whitelist= [
36
- "numpy",
37
- "torch",
38
- "cv2",
39
- "pyodbc",
40
- "pydantic",
41
- "ciso8601",
42
- "netcdf4",
43
- "scipy"
44
- ]
45
- ignore="CVS"
46
- ignore-patterns="test.*?py,conftest.py"
47
- init-hook='import sys; sys.setrecursionlimit(8 * sys.getrecursionlimit())'
48
- jobs=0
49
- limit-inference-results=100
50
- persistent="yes"
51
- suggestion-mode="yes"
52
- unsafe-load-any-extension="no"
53
-
54
- [tool.pylint.'MESSAGES CONTROL']
55
- enable="c-extension-no-member"
56
-
57
- [tool.pylint.'REPORTS']
58
- evaluation="10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)"
59
- output-format="text"
60
- reports="no"
61
- score="yes"
62
-
63
- [tool.pylint.'REFACTORING']
64
- max-nested-blocks=5
65
- never-returning-functions="sys.exit"
66
-
67
- [tool.pylint.'BASIC']
68
- argument-naming-style="snake_case"
69
- attr-naming-style="snake_case"
70
- bad-names= [
71
- "foo",
72
- "bar"
73
- ]
74
- class-attribute-naming-style="any"
75
- class-naming-style="PascalCase"
76
- const-naming-style="UPPER_CASE"
77
- docstring-min-length=-1
78
- function-naming-style="snake_case"
79
- good-names= [
80
- "i",
81
- "j",
82
- "k",
83
- "ex",
84
- "Run",
85
- "_"
86
- ]
87
- include-naming-hint="yes"
88
- inlinevar-naming-style="any"
89
- method-naming-style="snake_case"
90
- module-naming-style="any"
91
- no-docstring-rgx="^_"
92
- property-classes="abc.abstractproperty"
93
- variable-naming-style="snake_case"
94
-
95
- [tool.pylint.'FORMAT']
96
- ignore-long-lines="^\\s*(# )?.*['\"]?<?https?://\\S+>?"
97
- indent-after-paren=4
98
- indent-string=' '
99
- max-line-length=120
100
- max-module-lines=1000
101
- single-line-class-stmt="no"
102
- single-line-if-stmt="no"
103
-
104
- [tool.pylint.'LOGGING']
105
- logging-format-style="old"
106
- logging-modules="logging"
107
-
108
- [tool.pylint.'MISCELLANEOUS']
109
- notes= [
110
- "FIXME",
111
- "XXX",
112
- "TODO"
113
- ]
114
-
115
- [tool.pylint.'SIMILARITIES']
116
- ignore-comments="yes"
117
- ignore-docstrings="yes"
118
- ignore-imports="yes"
119
- min-similarity-lines=7
120
-
121
- [tool.pylint.'SPELLING']
122
- max-spelling-suggestions=4
123
- spelling-store-unknown-words="no"
124
-
125
- [tool.pylint.'STRING']
126
- check-str-concat-over-line-jumps="no"
127
-
128
- [tool.pylint.'TYPECHECK']
129
- contextmanager-decorators="contextlib.contextmanager"
130
- generated-members="numpy.*,np.*,pyspark.sql.functions,collect_list"
131
- ignore-mixin-members="yes"
132
- ignore-none="yes"
133
- ignore-on-opaque-inference="yes"
134
- ignored-classes="optparse.Values,thread._local,_thread._local,numpy,torch,swagger_client"
135
- ignored-modules="numpy,torch,swagger_client,netCDF4,scipy"
136
- missing-member-hint="yes"
137
- missing-member-hint-distance=1
138
- missing-member-max-choices=1
139
-
140
- [tool.pylint.'VARIABLES']
141
- additional-builtins="dbutils"
142
- allow-global-unused-variables="yes"
143
- callbacks= [
144
- "cb_",
145
- "_cb"
146
- ]
147
- dummy-variables-rgx="_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_"
148
- ignored-argument-names="_.*|^ignored_|^unused_"
149
- init-import="no"
150
- redefining-builtins-modules="six.moves,past.builtins,future.builtins,builtins,io"
151
-
152
- [tool.pylint.'CLASSES']
153
- defining-attr-methods= [
154
- "__init__",
155
- "__new__",
156
- "setUp",
157
- "__post_init__"
158
- ]
159
- exclude-protected= [
160
- "_asdict",
161
- "_fields",
162
- "_replace",
163
- "_source",
164
- "_make"
165
- ]
166
- valid-classmethod-first-arg="cls"
167
- valid-metaclass-classmethod-first-arg="cls"
168
-
169
- [tool.pylint.'DESIGN']
170
- max-args=5
171
- max-attributes=7
172
- max-bool-expr=5
173
- max-branches=12
174
- max-locals=15
175
- max-parents=7
176
- max-public-methods=20
177
- max-returns=6
178
- max-statements=50
179
- min-public-methods=2
180
-
181
- [tool.pylint.'IMPORTS']
182
- allow-wildcard-with-all="no"
183
- analyse-fallback-blocks="no"
184
- deprecated-modules="optparse,tkinter.tix"
185
-
186
- [tool.pylint.'EXCEPTIONS']
187
- overgeneral-exceptions= [
188
- "BaseException",
189
- "Exception"
190
- ]
 
1
+ [project]
2
+ name = "simple-chat-bot"
3
+ authors = [
4
+ {name = "Fahad Mattoo", email = "[email protected]"},
5
+ ]
6
+ description = "A simple chat bot."
7
+ readme = "README.md"
8
+ classifiers = [
9
+ "Development Status :: beta",
10
+ "Programming Language :: Python :: 3 :: Only",
11
+ "Programming Language :: Python :: 3.10",
12
+ "Programming Language :: Python :: 3.11"
13
+ ]
14
+ requires-python = ">=3.10"
15
+ dynamic = ["version"]
16
+
17
+ [tool.black]
18
+ line-length = 120
19
+ fast = true
20
+
21
+ [tool.coverage.run]
22
+ branch = true
23
+
24
+ [tool.coverage.report]
25
+ fail_under = 0
26
+
27
+ [tool.pytest.ini_options]
28
+ pythonpath = [
29
+ "src"
30
+ ]
31
+
32
+ [tool.pylint]
33
+ extension-pkg-whitelist= [
34
+ "numpy",
35
+ "torch",
36
+ "cv2",
37
+ "pyodbc",
38
+ "pydantic",
39
+ "ciso8601",
40
+ "netcdf4",
41
+ "scipy"
42
+ ]
43
+ ignore="CVS"
44
+ ignore-patterns="test.*?py,conftest.py"
45
+ init-hook='import sys; sys.setrecursionlimit(8 * sys.getrecursionlimit())'
46
+ jobs=0
47
+ limit-inference-results=100
48
+ persistent="yes"
49
+ suggestion-mode="yes"
50
+ unsafe-load-any-extension="no"
51
+
52
+ [tool.pylint.'MESSAGES CONTROL']
53
+ enable="c-extension-no-member"
54
+
55
+ [tool.pylint.'REPORTS']
56
+ evaluation="10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)"
57
+ output-format="text"
58
+ reports="no"
59
+ score="yes"
60
+
61
+ [tool.pylint.'REFACTORING']
62
+ max-nested-blocks=5
63
+ never-returning-functions="sys.exit"
64
+
65
+ [tool.pylint.'BASIC']
66
+ argument-naming-style="snake_case"
67
+ attr-naming-style="snake_case"
68
+ bad-names= [
69
+ "foo",
70
+ "bar"
71
+ ]
72
+ class-attribute-naming-style="any"
73
+ class-naming-style="PascalCase"
74
+ const-naming-style="UPPER_CASE"
75
+ docstring-min-length=-1
76
+ function-naming-style="snake_case"
77
+ good-names= [
78
+ "i",
79
+ "j",
80
+ "k",
81
+ "ex",
82
+ "Run",
83
+ "_"
84
+ ]
85
+ include-naming-hint="yes"
86
+ inlinevar-naming-style="any"
87
+ method-naming-style="snake_case"
88
+ module-naming-style="any"
89
+ no-docstring-rgx="^_"
90
+ property-classes="abc.abstractproperty"
91
+ variable-naming-style="snake_case"
92
+
93
+ [tool.pylint.'FORMAT']
94
+ ignore-long-lines="^\\s*(# )?.*['\"]?<?https?://\\S+>?"
95
+ indent-after-paren=4
96
+ indent-string=' '
97
+ max-line-length=120
98
+ max-module-lines=1000
99
+ single-line-class-stmt="no"
100
+ single-line-if-stmt="no"
101
+
102
+ [tool.pylint.'LOGGING']
103
+ logging-format-style="old"
104
+ logging-modules="logging"
105
+
106
+ [tool.pylint.'MISCELLANEOUS']
107
+ notes= [
108
+ "FIXME",
109
+ "XXX",
110
+ "TODO"
111
+ ]
112
+
113
+ [tool.pylint.'SIMILARITIES']
114
+ ignore-comments="yes"
115
+ ignore-docstrings="yes"
116
+ ignore-imports="yes"
117
+ min-similarity-lines=7
118
+
119
+ [tool.pylint.'SPELLING']
120
+ max-spelling-suggestions=4
121
+ spelling-store-unknown-words="no"
122
+
123
+ [tool.pylint.'STRING']
124
+ check-str-concat-over-line-jumps="no"
125
+
126
+ [tool.pylint.'TYPECHECK']
127
+ contextmanager-decorators="contextlib.contextmanager"
128
+ generated-members="numpy.*,np.*,pyspark.sql.functions,collect_list"
129
+ ignore-mixin-members="yes"
130
+ ignore-none="yes"
131
+ ignore-on-opaque-inference="yes"
132
+ ignored-classes="optparse.Values,thread._local,_thread._local,numpy,torch,swagger_client"
133
+ ignored-modules="numpy,torch,swagger_client,netCDF4,scipy"
134
+ missing-member-hint="yes"
135
+ missing-member-hint-distance=1
136
+ missing-member-max-choices=1
137
+
138
+ [tool.pylint.'VARIABLES']
139
+ additional-builtins="dbutils"
140
+ allow-global-unused-variables="yes"
141
+ callbacks= [
142
+ "cb_",
143
+ "_cb"
144
+ ]
145
+ dummy-variables-rgx="_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_"
146
+ ignored-argument-names="_.*|^ignored_|^unused_"
147
+ init-import="no"
148
+ redefining-builtins-modules="six.moves,past.builtins,future.builtins,builtins,io"
149
+
150
+ [tool.pylint.'CLASSES']
151
+ defining-attr-methods= [
152
+ "__init__",
153
+ "__new__",
154
+ "setUp",
155
+ "__post_init__"
156
+ ]
157
+ exclude-protected= [
158
+ "_asdict",
159
+ "_fields",
160
+ "_replace",
161
+ "_source",
162
+ "_make"
163
+ ]
164
+ valid-classmethod-first-arg="cls"
165
+ valid-metaclass-classmethod-first-arg="cls"
166
+
167
+ [tool.pylint.'DESIGN']
168
+ max-args=5
169
+ max-attributes=7
170
+ max-bool-expr=5
171
+ max-branches=12
172
+ max-locals=15
173
+ max-parents=7
174
+ max-public-methods=20
175
+ max-returns=6
176
+ max-statements=50
177
+ min-public-methods=2
178
+
179
+ [tool.pylint.'IMPORTS']
180
+ allow-wildcard-with-all="no"
181
+ analyse-fallback-blocks="no"
182
+ deprecated-modules="optparse,tkinter.tix"
183
+
184
+ [tool.pylint.'EXCEPTIONS']
185
+ overgeneral-exceptions= [
186
+ "BaseException",
187
+ "Exception"
188
+ ]
 
 
requirements.txt CHANGED
@@ -0,0 +1,2 @@
 
 
 
1
+ streamlit==1.31.1
2
+ openai==1.13.3
src/app.py CHANGED
@@ -1,5 +1,103 @@
1
- """Module doc string"""
2
-
3
- import os
4
-
5
- os.getcwd()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Module doc string"""
2
+
3
+ import openai
4
+ import streamlit as st
5
+ from openai import OpenAI
6
+
7
+ def return_true():
8
+ """_summary_
9
+ """
10
+ return True
11
+
12
+ def reset_history():
13
+ """_summary_"""
14
+ st.session_state.messages = []
15
+
16
+
17
+ def check_openai_api_key():
18
+ """_summary_"""
19
+ try:
20
+ client = OpenAI(api_key=st.session_state.openai_api_key)
21
+ try:
22
+ client.models.list()
23
+ except openai.AuthenticationError as error:
24
+ with st.chat_message("assistant"):
25
+ st.error(str(error))
26
+ return False
27
+ return True
28
+ except Exception as error:
29
+ with st.chat_message("assistant"):
30
+ st.error(str(error))
31
+ return False
32
+
33
+
34
+ def main():
35
+ """_summary_"""
36
+ st.set_page_config(
37
+ page_title="Test", layout="centered", initial_sidebar_state="auto"
38
+ )
39
+ st.title("Simple Chat Bot")
40
+
41
+ if "messages" not in st.session_state:
42
+ st.session_state.messages = []
43
+
44
+ if "openai_model" not in st.session_state:
45
+ st.session_state["openai_model"] = "gpt-3.5-turbo"
46
+
47
+ if "openai_api_key" not in st.session_state:
48
+ st.session_state["openai_api_key"] = None
49
+
50
+ if "openai_maxtokens" not in st.session_state:
51
+ st.session_state["openai_maxtokens"] = 50
52
+
53
+ if st.session_state.openai_api_key is not None:
54
+ if check_openai_api_key():
55
+ client = OpenAI(api_key=st.session_state.openai_api_key)
56
+
57
+ for message in st.session_state.messages:
58
+ with st.chat_message(message["role"]):
59
+ st.markdown(message["content"])
60
+
61
+ if prompt := st.chat_input("Type your Query"):
62
+ with st.chat_message("user"):
63
+ st.markdown(prompt)
64
+ st.session_state.messages.append({"role": "user", "content": prompt})
65
+
66
+ with st.chat_message("assistant"):
67
+ stream = client.chat.completions.create(
68
+ model=st.session_state["openai_model"],
69
+ messages=[
70
+ {"role": m["role"], "content": m["content"]}
71
+ for m in st.session_state.messages
72
+ ],
73
+ max_tokens=st.session_state["openai_maxtokens"],
74
+ stream=True,
75
+ )
76
+ response = st.write_stream(stream)
77
+ st.session_state.messages.append(
78
+ {"role": "assistant", "content": response}
79
+ )
80
+ else:
81
+ reset_history()
82
+
83
+ with st.sidebar:
84
+ st.text_input(
85
+ label="OpenAI API key",
86
+ value="***",
87
+ key="openai_api_key",
88
+ help="This will not be saved or stored.",
89
+ type="password",
90
+ )
91
+
92
+ st.selectbox(
93
+ "Select the GPT model",
94
+ ("gpt-3.5-turbo", "gpt-4-turbo-preview"),
95
+ )
96
+ st.slider(
97
+ "Max Tokens", min_value=20, max_value=80, step=10, key="openai_maxtokens"
98
+ )
99
+ st.button(label="Reset Chat", on_click=reset_history)
100
+
101
+
102
+ if __name__ == "__main__":
103
+ main()
tests/test_return_true.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import pytest
2
+ from app import return_true
3
+
4
+
5
+ def test_reset_history():
6
+ assert return_true() == True