File size: 520 Bytes
9c7a5d2
27d375b
3426e6e
9c7a5d2
 
27d375b
9c7a5d2
3426e6e
 
 
 
 
 
 
 
 
 
 
9c7a5d2
 
27d375b
9c7a5d2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from fastapi import FastAPI
from os import getenv
from langchain_huggingface import HuggingFaceEmbeddings

app = FastAPI()
MY_KEY = getenv("MY_KEY")

embeddings = HuggingFaceEmbeddings(model_name="jinaai/jina-embeddings-v2-small-en")


@app.get("/embeddings")
def get_embeddings():
    test = embeddings.embed_query("Hello, world!")
    return {
        "embeddings": "This is the embeddings endpoint",
        "test": test
        }

@app.get("/")
def greet_json():
    return {"Hello": "World! My key is: " + MY_KEY}