mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-05 17:35:28 +03:00
2.2 KiB
2.2 KiB
In [ ]:
# set the environment variables needed for openai package to know to reach out to azure
import os
os.environ["OPENAI_API_TYPE"] = "azure"
os.environ["OPENAI_API_BASE"] = "https://<your-endpoint.openai.azure.com/"
os.environ["OPENAI_API_KEY"] = "your AzureOpenAI key"In [ ]:
embeddings = OpenAIEmbeddings(model="your-embeddings-deployment-name")In [ ]:
text = "This is a test document."In [ ]:
query_result = embeddings.embed_query(text)In [ ]:
doc_result = embeddings.embed_documents([text])In [ ]: