-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
39 lines (32 loc) · 934 Bytes
/
main.py
File metadata and controls
39 lines (32 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import asyncio
from fastapi import FastAPI
from langchain.text_splitter import MarkdownTextSplitter
from langchain.vectorstores.pgvector import PGVector,DistanceStrategy
from langchain.embeddings.base import Embeddings
from langchain.schema import Document
from sse_starlette import EventSourceResponse
from langchain.docstore.document import Document as DDocument
import numpy as np
import multiprocessing as mp
mp.set_start_method("spawn")
manager = mp.Manager()
class EmbeddingsAdapter(Embeddings):
pass
doc = Document()
app = FastAPI()
app.get()
np.linalg.norm()
norm = np.reshape()
asyncio.get_event_loop()
EventSourceResponse()
np.tile()
MarkdownTextSplitter()
pg = PGVector()
pg.delete_collection()
pg.similarity_search_with_score_by_vector()
@app.get("/")
async def root():
return {"message": "Hello World"}
@app.get("/hello/{name}")
async def say_hello(name: str):
return {"message": f"Hello {name}"}