mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-11 04:15:12 +03:00
3.7 KiB
3.7 KiB
In [1]:
from langchain.embeddings import LocalAIEmbeddingsIn [2]:
embeddings = LocalAIEmbeddings(openai_api_base="http://localhost:8080", model="embedding-model-name")In [3]:
text = "This is a test document."In [4]:
query_result = embeddings.embed_query(text)In [5]:
doc_result = embeddings.embed_documents([text])In [ ]:
from langchain.embeddings import LocalAIEmbeddingsIn [ ]:
embeddings = LocalAIEmbeddings(openai_api_base="http://localhost:8080", model="embedding-model-name")In [ ]:
text = "This is a test document."In [ ]:
query_result = embeddings.embed_query(text)In [ ]:
doc_result = embeddings.embed_documents([text])In [ ]:
# if you are behind an explicit proxy, you can use the OPENAI_PROXY environment variable to pass through
os.environ["OPENAI_PROXY"] = "http://proxy.yourcompany.com:8080"