Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Standardize BaichuanTextEmbeddings docstrings #24674

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions libs/community/langchain_community/embeddings/baichuan.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,34 @@
class BaichuanTextEmbeddings(BaseModel, Embeddings):
"""Baichuan Text Embedding models.

To use, you should set the environment variable ``BAICHUAN_API_KEY`` to
your API key or pass it as a named parameter to the constructor.
Setup:
To use, you should set the environment variable ``BAICHUAN_API_KEY`` to
your API key or pass it as a named parameter to the constructor.

Example:
.. code-block:: bash

export BAICHUAN_API_KEY="your-api-key"

Instantiate:
.. code-block:: python

from langchain_community.embeddings import BaichuanTextEmbeddings

baichuan = BaichuanTextEmbeddings(baichuan_api_key="my-api-key")
"""
embeddings = BaichuanTextEmbeddings()

Embed:
.. code-block:: python

# embed the documents
vectors = embeddings.embed_documents([text1, text2, ...])

# embed the query
vectors = embeddings.embed_query(text)
""" # noqa: E501

session: Any #: :meta private:
model_name: str = Field(default="Baichuan-Text-Embedding", alias="model")
"""The model used to embed the documents."""
baichuan_api_key: Optional[SecretStr] = Field(default=None, alias="api_key")
"""Automatically inferred from env var `BAICHUAN_API_KEY` if not provided."""
chunk_size: int = 16
Expand Down
Loading