Skip to main content
Open In ColabOpen on GitHub

DashScope

让我们加载DashScope Embedding类。

from langchain_community.embeddings import DashScopeEmbeddings
API Reference:DashScopeEmbeddings
embeddings = DashScopeEmbeddings(
model="text-embedding-v1", dashscope_api_key="your-dashscope-api-key"
)
text = "This is a test document."
query_result = embeddings.embed_query(text)
print(query_result)
doc_results = embeddings.embed_documents(["foo"])
print(doc_results)

这个页面有帮助吗?