Skip to content

Commit

Permalink
Chat api with ollama config
Browse files Browse the repository at this point in the history
  • Loading branch information
q4 authored and q4 committed May 6, 2024
0 parents commit aa7190e
Show file tree
Hide file tree
Showing 18 changed files with 473 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
83 changes: 83 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Jonny Johnson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Empty file added MANIFEST.in
Empty file.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Topos
A simple api to use your local machine to play chat games over in the [chat arena](https://github.com/jonnyjohnson1/chat-arena).

Game options are:
1. Debate

## Install Instructions
requires `brew install just`
requires `brew install poetry`

### Step 1: Install Topos
install the topos package with the command `just build`

### Step 2: Create an SSL certificate for your local host (only necessary if app is deployed to web and needs ssl cert)
install with the command `just cert`

This will prompt you to answer a few questions about your location and name.
I think they can be left empty by typing `.`

### Step 3: Start Topos on your local machine

`topos run`
`topos run --local`
`topos run --dialogues`


## TODOs

[ ] Write curl tests to make sure the api is working
Empty file added __init__.py
Empty file.
35 changes: 35 additions & 0 deletions cert.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
-----BEGIN CERTIFICATE-----
MIIGCzCCA/OgAwIBAgIUTuLmq2K5lgPJncgPvuudjjH44OIwDQYJKoZIhvcNAQEL
BQAwgZQxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEPMA0GA1UEBwwGQXVz
dGluMRIwEAYDVQQKDAlEaWFsb2d1ZXMxETAPBgNVBAsMCGRldi10ZWFtMRUwEwYD
VQQDDAxqb25ueWpvaG5zb24xJjAkBgkqhkiG9w0BCQEWF2pvbm55am9obnNvbjFA
Z21haWwuY29tMB4XDTI0MDUwMjE1NTMzNFoXDTI1MDUwMjE1NTMzNFowgZQxCzAJ
BgNVBAYTAlVTMQ4wDAYDVQQIDAVUZX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TiTls/5KxvaoKDlOsqONOtDdrPM3hpf12I2kALbmQGva47vQKLgHOVGU+iLzFF
pzspLnGwy+Dj/V5Lcql5EiW4jvnV+xyLH9nIeB+xXURNsDVK8zuofXf4nlLcinWk
bmpdB08hS3WVL0vbjsVvZGPvQlbpBjgX/XmRHtsqNIHnSqm3mtwCm1sf9YnpN435
aqxdMTBcXgQLTJW5snKTBEi2m3Ow4Hp8zQGHBgboJiZfXR2yPNDIcsBsrDLJbP52
eo3Iab/OG6NLF4M2llOWZKoEV1rotfPRixO3IKG+9Rf6Au7LbsB7nqbgK2Vxw9Uz
OXkO6iPERAnJKjl7gmxcLYtdWeez5ddWJiZLGlP+samAqi3nryYNoV0BjS02xZmT
O7/Y+ppvUkvqo06MWotjnZ+/hTDYMj6nZDg/ZBmt9E6i8qoH0yI3IBixW9Qm/1bK
1h9LmS1mQHzQ8RaSM4PEZHdaaYP0dFLQ9C8Bvx/0ewdCBKj19dumrW7BlXiIPlBy
/ZgfeG1ZXSgY6hqa+GqgFuhQh903ihvCTA5yjEvxHy4R5fWfpQj/yfkg9zD+plJS
zA2SjoJxhzggcNl2co9uLIydeJbmmyZa1NiK6xDBDYCdDiSXjsWJtNYyykC7iZwH
0wl8YGqrXLvhPVkHOnmh
-----END CERTIFICATE-----
9 changes: 9 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build:
poetry build
pip3 install .

run:
topos run

cert:
openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365
52 changes: 52 additions & 0 deletions key.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCQWvquNKZLQ/3W
Bnj7z++GXBah4G21orZQhzryRacjwr6nRo9SpWdeknyw9mrc3t2oGymEbbQDFgWo
fHJa+CAVjNWtGpDx5vYHlJxqyoCTKSR4MFpoMTDGwv06NL5jYV59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oMNz3gWPev9qhg9ZfrisdSwfSXkXXiH5q2BLqC4q2aON9OhXe
lxCIRP5/ThlH4ZMpFvNTtGDSIZo+tzWLaBlGQpFxMPcWdtF/q7lx8WbAt7dBfO7g
tl7YYaMHbjQHwxf8Awd1OXZwLHP5/pzaobiekQKCAQEAiJRn9xzqs9s0bAtZp6mk
KZDqZ8UUZx024mREz44XbVEKyif/rluk4yw0RgmFDk1AoBhhfY7OpZIwA6uTS7jh
ZW31vW2n4IO1H7i7kJT2HenaUF8NbAJBW1ZR8oP58HgF9ky7xebVBfYbea8PEftF
8ZajtE5kgH8qs93pyj8uF0q3LYv97EZKTI194Ci3L4KnqN+2xqaCYJUCFIdlMuDb
8Q9OhbQLXkH2h0YyMuPLWcwCsy5O86LiFS8fEpr4JgiY5jGZ1GOyKZYQyLQbsvd6
QMpKPWEeJejNEGQb2XzM+G6ZaEP/PUtm6FKu1kp/YmDjwxx4Ts7/xjOJbtWFteI7
QQKCAQEAtv04daPadtd8hW4Fzx4LG4vpNcCsk00V/HWnhmOhavQY8APH+65IaE8l
YWuTdt/mnvooB4d4S1T6vGbWr6s0vz6hDs2suNpVmBsfl4yLIMDMo4FOFTT0/PjQ
Tt1LxZlYQZfTC9b4yKX5Xid1rUHbAlnqb9vzt/dbZ08tg8ZxerjFq7xmla7t2mOe
JLvjN5mXhvcPgIGmveKjUofNmVYyWbOXgGi+Li+Atvuecy+ovtRPbQpEeg5msIST
wliWxUH0FFkKODdOURAo2puoQBG66wfpefkwLvEfTrwiKMoF+iq9RG7hPhJAJ8qy
xm71ye9+IWMqkesP69dlgkEKmS8dNw==
-----END PRIVATE KEY-----
32 changes: 32 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[tool.poetry]
name = "topos"
version = "0.1"
description = "The official Python client for Topos."
authors = ["Dialogues <[email protected]>"]
license = "MIT"
readme = "README.md"
homepage = "https://dialogues.ai"

[tool.poetry.dependencies]
python = "^3.8"
httpx = "^0.25.2"
fastapi = "0.109.2"
langchain = "0.1.4"
uvicorn = "0.20.0"
websockets = "11.0.3"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.3"
pytest-asyncio = "^0.23.2"
pytest-cov = "^4.1.0"
pytest-httpserver = "^1.0.8"
pillow = "^10.2.0"
ruff = "^0.1.8"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
topos = "topos.cli:main"

17 changes: 17 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[metadata]
name = topos
version = 0.1
author = Jonny Johnson
author_email = [email protected]
description = For interacting with Topos tooling
long_description = file: README.md
long_description_content_type = text/markdown
classifiers =
Programming Language :: Python :: 3
License :: OSI Approved :: MIT License
Operating System :: OS Independent

[options]
packages = find:
python_requires = >=3.10
include_package_data = True
12 changes: 12 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from setuptools import setup, find_packages

setup(
name='topos',
version='0.1',
packages=find_packages(),
entry_points={
'console_scripts': [
'topos = topos.cli:main'
]
},
)
Binary file added topos/.DS_Store
Binary file not shown.
Empty file added topos/__init__.py
Empty file.
Loading

0 comments on commit aa7190e

Please sign in to comment.