create AI memory infrastructure

This commit is contained in:
Dobromir Popov
2024-03-06 19:17:28 +02:00
parent 4100fe5877
commit c6899e4ded
5 changed files with 106 additions and 0 deletions

6
store-all/api/Dockerfile Normal file
View File

@ -0,0 +1,6 @@
FROM python:3.9-slim
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "app.py"]

30
store-all/api/app.py Normal file
View File

@ -0,0 +1,30 @@
from flask import Flask, jsonify, request
from neo4j import GraphDatabase
from pymilvus import connections, Collection
app = Flask(__name__)
# Neo4j Connection
neo4j_driver = GraphDatabase.driver("bolt://neo4j:7687", auth=("neo4j", "testpassword"))
# Milvus Connection
connections.connect("default", host="milvus", port="19530")
@app.route('/')
def home():
return jsonify({'message': 'Hello, World!'})
@app.route('/neo4j_test')
def neo4j_test():
with neo4j_driver.session() as session:
result = session.run("MATCH (n) RETURN count(n) AS count")
count = result.single()["count"]
return jsonify({'neo4j_node_count': count})
@app.route('/milvus_test')
def milvus_test():
collections = Collection.list()
return jsonify({'milvus_collections': collections})
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)

View File

@ -0,0 +1,4 @@
Flask==2.0.3
neo4j==4.4.1
pymilvus==2.0.2
gunicorn==20.1.0