forked from langchain-ai/langchainjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request langchain-ai#1099 from jacoblee93/pr_919
Docs fixes, parameter shim for langchain-ai#919
- Loading branch information
Showing
13 changed files
with
453 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
docs/docs/modules/indexes/vector_stores/integrations/myscale.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
sidebar_class_name: node-only | ||
--- | ||
|
||
import CodeBlock from "@theme/CodeBlock"; | ||
|
||
# MyScale | ||
|
||
:::tip Compatibility | ||
Only available on Node.js. | ||
::: | ||
|
||
[MyScale](https://myscale.com/) is an emerging AI database that harmonizes the power of vector search and SQL analytics, providing a managed, efficient, and responsive experience. | ||
|
||
## Setup | ||
|
||
1. Launch a cluster through [MyScale's Web Console](https://console.myscale.com/). See [MyScale's official documentation](https://docs.myscale.com/en/quickstart/) for more information. | ||
2. After launching a cluster, view your `Connection Details` from your cluster's `Actions` menu. You will need the host, port, username, and password. | ||
3. Install the required Node.js peer dependency in your workspace. | ||
|
||
```bash npm2yarn | ||
npm install -S @clickhouse/client | ||
``` | ||
|
||
## Index and Query Docs | ||
|
||
import InsertExample from "@examples/indexes/vector_stores/myscale_fromTexts.ts"; | ||
|
||
<CodeBlock language="typescript">{InsertExample}</CodeBlock> | ||
|
||
## Query Docs From an Existing Collection | ||
|
||
import SearchExample from "@examples/indexes/vector_stores/myscale_search.ts"; | ||
|
||
<CodeBlock language="typescript">{SearchExample}</CodeBlock> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { MyScaleStore } from "langchain/vectorstores/myscale"; | ||
import { OpenAIEmbeddings } from "langchain/embeddings/openai"; | ||
|
||
const vectorStore = await MyScaleStore.fromTexts( | ||
["Hello world", "Bye bye", "hello nice world"], | ||
[ | ||
{ id: 2, name: "2" }, | ||
{ id: 1, name: "1" }, | ||
{ id: 3, name: "3" }, | ||
], | ||
new OpenAIEmbeddings(), | ||
{ | ||
host: process.env.MYSCALE_HOST || "localhost", | ||
port: process.env.MYSCALE_PORT || "8443", | ||
username: process.env.MYSCALE_USERNAME || "username", | ||
password: process.env.MYSCALE_PASSWORD || "password", | ||
} | ||
); | ||
|
||
const results = await vectorStore.similaritySearch("hello world", 1); | ||
console.log(results); | ||
|
||
const filteredResults = await vectorStore.similaritySearch("hello world", 1, { | ||
whereStr: "metadata.name = '1'", | ||
}); | ||
console.log(filteredResults); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { MyScaleStore } from "langchain/vectorstores/myscale"; | ||
import { OpenAIEmbeddings } from "langchain/embeddings/openai"; | ||
|
||
const vectorStore = await MyScaleStore.fromExistingIndex( | ||
new OpenAIEmbeddings(), | ||
{ | ||
host: process.env.MYSCALE_HOST || "localhost", | ||
port: process.env.MYSCALE_PORT || "8443", | ||
username: process.env.MYSCALE_USERNAME || "username", | ||
password: process.env.MYSCALE_PASSWORD || "password", | ||
database: "your_database", // defaults to "default" | ||
table: "your_table", // defaults to "vector_table" | ||
} | ||
); | ||
|
||
const results = await vectorStore.similaritySearch("hello world", 1); | ||
console.log(results); | ||
|
||
const filteredResults = await vectorStore.similaritySearch("hello world", 1, { | ||
whereStr: "metadata.name = '1'", | ||
}); | ||
console.log(filteredResults); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.