from langchain_huggingface.embeddings import HuggingFaceEmbeddings from fastapi import FastAPI from typing import Union app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/embeddings") def read_item(): embeddings = HuggingFaceEmbeddings() return embeddings @app.get("/test/{text}") def read_item(text): embeddings = HuggingFaceEmbeddings() return embeddings.embed_query(text)