DOCS: doc-string - langchain.vectorstores.dashvector.DashVector (#13502)

- **Description:** There are several mistakes in the sample code in the
doc-string of `DashVector` class, and this pull request aims to correct
them.
The correction code has been tested against latest version (at the time
of creation of this pull request) of: `langchain==0.0.336`
`dashvector==1.0.6` .
- **Issue:** No issue is created for this.
- **Dependencies:** No dependency is required for this change,
<!-- - **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below), -->
- **Twitter handle:** `zeyanglin`

<!-- Please make sure your PR is passing linting and testing before
submitting. Run `make format`, `make lint` and `make test` to check this
locally.

See contribution guidelines for more information on how to write/run
tests, lint, etc:

https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
1. a test for the integration, preferably unit tests that do not rely on
network access,
2. an example notebook showing its use. It lives in `docs/extras`
directory.

If no one reviews your PR within a few days, please @-mention one of
@baskaryan, @eyurtsev, @hwchase17.
-->
This commit is contained in:
Zeyang Lin 2023-11-20 10:24:05 +08:00 committed by GitHub
parent 16f7912e1b
commit e53f59f01a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,15 +29,15 @@ class DashVector(VectorStore):
Example: Example:
.. code-block:: python .. code-block:: python
from langchain.vectorstores import dashvector from langchain.vectorstores import DashVector
from langchain.embeddings.openai import OpenAIEmbeddings from langchain.embeddings.openai import OpenAIEmbeddings
import dashvector import dashvector
client = dashvector.Client.init(api_key="***") client = dashvector.Client(api_key="***")
client.create("langchain") client.create("langchain", dimension=1024)
collection = client.get("langchain") collection = client.get("langchain")
embeddings = OpenAIEmbeddings() embeddings = OpenAIEmbeddings()
vectorstore = Dashvector(collection, embeddings.embed_query, "text") vectorstore = DashVector(collection, embeddings.embed_query, "text")
""" """
def __init__( def __init__(