Skip to content

Commit

Permalink
Merge pull request #2674 from weaviate/20241008-updates
Browse files Browse the repository at this point in the history
20241008 updates
  • Loading branch information
databyjp authored Oct 9, 2024
2 parents b1049c3 + bc518fa commit ab09904
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 45 deletions.
2 changes: 1 addition & 1 deletion _includes/code/connections/connect-python-v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@

# Use OIDC credentials to authenticate
client = weaviate.Client("http://localhost:8080", auth_client_secret=resource_owner_config)
# END OIDCConnect
# END OIDCConnect
5 changes: 3 additions & 2 deletions _includes/code/embedded.instantiate.custom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import FilteredTextBlock from '@site/src/components/Documentation/FilteredTextBl
import PyCode from '!!raw-loader!/_includes/code/install/embedded.py';
import PyCodeV3 from '!!raw-loader!/_includes/code/install/embedded-v3.py';
import TsCodeV2 from '!!raw-loader!/_includes/code/install/embedded-v2.ts';
import TsCodeV2CustomModules from '!!raw-loader!/_includes/code/install/embedded-v2-custommodules.ts';

<Tabs groupId="languages">
<TabItem value="py" label="Python Client v4">
Expand All @@ -24,10 +25,10 @@ import TsCodeV2 from '!!raw-loader!/_includes/code/install/embedded-v2.ts';
</TabItem>
<TabItem value="js" label="JS/TS Client v2">
<FilteredTextBlock
text={TsCodeV2}
text={TsCodeV2CustomModules}
startMarker="// START CustomModules"
endMarker="// END CustomModules"
language="js"
/>
</TabItem>
</Tabs>
</Tabs>
3 changes: 2 additions & 1 deletion _includes/code/embedded.instantiate.module.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import FilteredTextBlock from '@site/src/components/Documentation/FilteredTextBl
import PyCode from '!!raw-loader!/_includes/code/install/embedded.py';
import PyCodeV3 from '!!raw-loader!/_includes/code/install/embedded-v3.py';
import TsCodeV2 from '!!raw-loader!/_includes/code/install/embedded-v2.ts';
import TsCodeV2CustomModules from '!!raw-loader!/_includes/code/install/embedded-v2-custommodules.ts';

<Tabs groupId="languages">
<TabItem value="py" label="Python Client v4">
Expand All @@ -24,7 +25,7 @@ import TsCodeV2 from '!!raw-loader!/_includes/code/install/embedded-v2.ts';
</TabItem>
<TabItem value="js" label="JS/TS Client v2">
<FilteredTextBlock
text={TsCodeV2}
text={TsCodeV2CustomModules}
startMarker="// START CustomModules"
endMarker="// END CustomModules"
language="js"
Expand Down
17 changes: 17 additions & 0 deletions _includes/code/install/embedded-v2-custommodules.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// START CustomModules
import weaviate, { EmbeddedOptions } from 'weaviate-ts-embedded';

const client = weaviate.client(
new EmbeddedOptions({
env: {
ENABLE_MODULES: "backup-s3,text2vec-openai,text2vec-cohere,text2vec-huggingface,ref2vec-centroid,generative-openai,qna-openai",
},
})
);

await client.embedded.start();

// Add your client code here.

await client.embedded.stop();
// END CustomModules
30 changes: 4 additions & 26 deletions _includes/code/install/embedded-v2.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,12 @@
// NOT TESTED TO RUN AS AN END TO END SCRIPT

// START SimpleInstance
import weaviate, { EmbeddedOptions } from 'weaviate-ts-embedded';

const client = weaviate.client(new EmbeddedOptions());
const client = weaviate.client(new EmbeddedOptions());

await client.embedded.start();
await client.embedded.start();

const response = await client.data
.creator()
.withClassName('Wine')
.withProperties({
name: 'Chardonnay',
description: 'Goes with fish',
})
.do();
// Add your client code here.

console.log(JSON.stringify(response, null, 2));
await client.embedded.stop();
// END SimpleInstance



// START CustomModules
import weaviate, { EmbeddedOptions } from 'weaviate-ts-embedded';

const client = weaviate.client(
new EmbeddedOptions({
env: {
ENABLE_MODULES: "backup-s3,text2vec-openai,text2vec-cohere,text2vec-huggingface,ref2vec-centroid,generative-openai,qna-openai",
},
})
);
// END CustomModules
21 changes: 9 additions & 12 deletions _includes/code/install/embedded-v3.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
#NOT TESTED AS A RUNNING END TO END SCRIPT

# START SimpleInstance
import weaviate
from weaviate.embedded import EmbeddedOptions

client = weaviate.Client(
embedded_options=EmbeddedOptions()
embedded_options=EmbeddedOptions()
)

data_obj = {
"name": "Chardonnay",
"description": "Goes with fish"
"name": "Chardonnay",
"description": "Goes with fish"
}

client.data_object.create(data_obj, "Wine")
# END SimpleInstance
client.close()


# START CustomModules
import weaviate
from weaviate.embedded import EmbeddedOptions

client = weaviate.Client(
embedded_options=EmbeddedOptions(
additional_env_vars={
"ENABLE_MODULES":
"backup-s3,text2vec-openai,text2vec-cohere,text2vec-huggingface,ref2vec-centroid,generative-openai,qna-openai"}
)
embedded_options=EmbeddedOptions(
additional_env_vars={
"ENABLE_MODULES":
"backup-s3,text2vec-openai,text2vec-cohere,text2vec-huggingface,ref2vec-centroid,generative-openai,qna-openai"}
)
)
# END CustomModules
client.close()
2 changes: 1 addition & 1 deletion _includes/code/install/embedded.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os

client = weaviate.connect_to_embedded(
version=weaviate_version, # e.g. version="1.23.10"
version=weaviate_version, # e.g. version="1.26.5"
headers={
"X-OpenAI-Api-Key": os.getenv("OPENAI_APIKEY") # Replace with your API key
},
Expand Down
4 changes: 2 additions & 2 deletions developers/weaviate/concepts/search/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ The following table illustrates the search process in Weaviate. Around the core

| Step | Description | Optional |
|------|-------------|----------|
| 1. [Retrieval](#retrieval) | <strong>[Filter](#retrieval-filter):</strong> Narrow result sets based on criteria<br/><strong>[Search](#retrieval-search):</strong> Find the most relevant entries, using one of [keyword](#keyword-search), [vector](#vector-search) or [hybrid](#hybrid-search) search types<br/> | Required |
| 2. [Reranking](#reranking) | Reorder results using a different (e.g. more complex) model | Optional |
| 1. [Retrieval](#retrieval-filter) | <strong>[Filter](#retrieval-filter):</strong> Narrow result sets based on criteria<br/><strong>[Search](#retrieval-search):</strong> Find the most relevant entries, using one of [keyword](#keyword-search), [vector](#vector-search) or [hybrid](#hybrid-search) search types<br/> | Required |
| 2. [Reranking](#rerank) | Reorder results using a different (e.g. more complex) model | Optional |
| 3. [Generative](#generative-search--rag) | Send retrieved data and a prompt to a generative AI model. Also called retrieval augmented generation, or RAG. | Optional |

Here is a brief overview of each step:
Expand Down

0 comments on commit ab09904

Please sign in to comment.