Skip to content

Commit

Permalink
Merge branch 'main' into academy/ts-multimodal
Browse files Browse the repository at this point in the history
  • Loading branch information
malgamves authored Jan 7, 2025
2 parents ff45be8 + a765e1b commit 3c3b2f2
Show file tree
Hide file tree
Showing 1,051 changed files with 8,248 additions and 2,440 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ import TSCode from '!!raw-loader!/_includes/code/howto/manage-data.create.ts';
text={TSCode}
startMarker="// ValidateObject START"
endMarker="// ValidateObject END"
language="ts"
language="tsv2"
/>
</TabItem>
</Tabs>
Expand Down
63 changes: 43 additions & 20 deletions _build_scripts/update-config-versions.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,53 @@
const fetch = require('node-fetch');

const getRepoVersion = async (repoName) => {
const response = await fetch( // fetch all release versions
`https://api.github.com/repos/weaviate/${repoName}/releases`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
'authorization': // Use the github token if available
(process.env.GH_API_TOKEN) ?
`Bearer ${ process.env.GH_API_TOKEN }` : ''
try {
const response = await fetch( // fetch all release versions
`https://api.github.com/repos/weaviate/${repoName}/releases`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
'authorization': // Use the github token if available
(process.env.GH_API_TOKEN) ?
`Bearer ${ process.env.GH_API_TOKEN }` : ''
}
}
);

// First check if the response was ok
if (!response.ok) {
throw new Error(`GitHub API error: ${response.status} ${response.statusText}`);
}
);

const releases = await response.json();
const highestVersion = releases
.filter(item => !item.prerelease) // remove pre-release items
.map(item => item.tag_name) // keep only the tag_name
.sort() // sort items alphabetically – ascending
.pop() // the last item contains the highest version (what we need)
.replace('v', '') // remove the v from the name "v1.26.1" => "1.26.1"
const releases = await response.json();

// Check if releases is actually an array
if (!Array.isArray(releases)) {
// Debug log to see what we're getting
console.log(`Raw response for ${repoName}:`, JSON.stringify(releases).slice(0, 200));
console.error(`Unexpected response format for ${repoName}:`, releases);
throw new Error(`Expected array of releases but got ${typeof releases}`);
}

if (releases.length === 0) {
throw new Error(`No releases found for ${repoName}`);
}

console.log(`${repoName} ${highestVersion}`)
const highestVersion = releases
.filter(item => !item.prerelease) // remove pre-release items
.map(item => item.tag_name) // keep only the tag_name
.sort() // sort items alphabetically – ascending
.pop() // the last item contains the highest version (what we need)
.replace('v', '') // remove the v from the name "v1.26.1" => "1.26.1"

return highestVersion;
console.log(`${repoName} ${highestVersion}`);
return highestVersion;
} catch (error) {
console.error(`Error fetching version for ${repoName}:`, error);
// Maybe return a default version or rethrow depending on your needs
throw error;
}
}

// Build time versions replace values set in versions-config.json
Expand Down Expand Up @@ -63,4 +86,4 @@ const updateConfigFile = async () => {
});
}

updateConfigFile();
updateConfigFile();
11 changes: 2 additions & 9 deletions _includes/code/client-libraries/python_v4.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import weaviate

# START WVCImportExample
import weaviate.classes as wvc
# END WVCImportExample

import weaviate_datasets as wd
import os

# InstantiationV3API
import weaviate

client = weaviate.Client(
url="http://localhost:8080",
)
# END InstantiationV3API


# TryFinallyExample
import weaviate

Expand Down
4 changes: 2 additions & 2 deletions _includes/code/configuration/replication-consistency.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import FilteredTextBlock from '@site/src/components/Documentation/FilteredTextBl
text={PyCodeV3}
startMarker="# START AsyncRepair"
endMarker="# END AsyncRepair"
language="py"
language="pyv3"
/>
</TabItem>

Expand All @@ -40,7 +40,7 @@ import FilteredTextBlock from '@site/src/components/Documentation/FilteredTextBl
text={TSCodeLegacy}
startMarker="// START AsyncRepair"
endMarker="// END AsyncRepair"
language="ts"
language="tsv2"
/>
</TabItem>
<TabItem value="curl" label="cURL">
Expand Down
8 changes: 8 additions & 0 deletions _includes/code/connections/connect-python-v3.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# THIS FILE HASN'T BEEN TESTED TO RUN END-TO-END

# InstantiationV3API
import weaviate

client = weaviate.Client(
url="http://localhost:8080",
)
# END InstantiationV3API

#####################
### Cloud connect ###
#####################
Expand Down
4 changes: 2 additions & 2 deletions _includes/code/connections/oidc-connect.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import GoCode from '!!raw-loader!/_includes/code/connections/connect.go';
text={PyV3Code}
startMarker="# START OIDCConnect"
endMarker="# END OIDCConnect"
language="py"
language="pyv3"
/>
</TabItem>
<TabItem value="ts3" label="JS/TS Client v3">
Expand All @@ -39,7 +39,7 @@ import GoCode from '!!raw-loader!/_includes/code/connections/connect.go';
text={TsV2Code}
startMarker="// START OIDCConnect"
endMarker="// END OIDCConnect"
language="js"
language="tsv2"
/>
</TabItem>
<TabItem value="go" label="Go">
Expand Down
16 changes: 8 additions & 8 deletions _includes/code/core.client.palm.apikey.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ client = weaviate.Client(
url = "https://WEAVIATE_INSTANCE_URL", # Replace WEAVIATE_INSTANCE_URL with the URL
# highlight-start
additional_headers = {
"X-Google-Vertex-Api-Key": "YOUR-VERTEX-API-KEY", # Replace with your API key
"X-Google-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY", # Replace with your API key
"X-Goog-Vertex-Api-Key": "YOUR-VERTEX-API-KEY", # Replace with your API key
"X-Goog-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY", # Replace with your API key
}
# highlight-end
)
Expand All @@ -30,8 +30,8 @@ const client = weaviate.client({
// highlight-start
// Replace with your API key
headers: {
'X-Google-Vertex-Api-Key': 'YOUR-VERTEX-API-KEY', // Replace with your API key
'X-Google-Studio-Api-Key': 'YOUR-AI-STUDIO-API-KEY', // Replace with your API key
'X-Goog-Vertex-Api-Key': 'YOUR-VERTEX-API-KEY', // Replace with your API key
'X-Goog-Studio-Api-Key': 'YOUR-AI-STUDIO-API-KEY', // Replace with your API key
},
// highlight-end
});
Expand All @@ -57,8 +57,8 @@ func main() {
// highlight-start
// Replace with your API key
Headers: map[string]string{
"X-Google-Vertex-Api-Key": "YOUR-VERTEX-API-KEY", // Replace with your API key
"X-Google-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY", // Replace with your API key
"X-Goog-Vertex-Api-Key": "YOUR-VERTEX-API-KEY", // Replace with your API key
"X-Goog-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY", // Replace with your API key
}
// highlight-end
}
Expand All @@ -85,8 +85,8 @@ public class App {
// highlight-start
Map<String, String> headers = new HashMap<String, String>() { {
// Replace with your API key
put("X-Google-Vertex-Api-Key", "YOUR-VERTEX-API-KEY");
put("X-Google-Studio-Api-Key", "YOUR-AI-STUDIO-API-KEY");
put("X-Goog-Vertex-Api-Key", "YOUR-VERTEX-API-KEY");
put("X-Goog-Studio-Api-Key", "YOUR-AI-STUDIO-API-KEY");
} };
// highlight-end

Expand Down
4 changes: 2 additions & 2 deletions _includes/code/embedded.instantiate.custom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import TsCodeV2CustomModules from '!!raw-loader!/_includes/code/install/embedded
text={PyCodeV3}
startMarker="# START CustomModules"
endMarker="# END CustomModules"
language="py"
language="pyv3"
/>
</TabItem>
<TabItem value="js" label="JS/TS Client v2">
<FilteredTextBlock
text={TsCodeV2CustomModules}
startMarker="// START CustomModules"
endMarker="// END CustomModules"
language="js"
language="tsv2"
/>
</TabItem>
</Tabs>
4 changes: 2 additions & 2 deletions _includes/code/embedded.instantiate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ import TsCodeV2 from '!!raw-loader!/_includes/code/install/embedded-v2.ts';
text={PyCodeV3}
startMarker="# START SimpleInstance"
endMarker="# END SimpleInstance"
language="py"
language="pyv3"
/>
</TabItem>
<TabItem value="js" label="JS/TS Client v2">
<FilteredTextBlock
text={TsCodeV2}
startMarker="// START SimpleInstance"
endMarker="// END SimpleInstance"
language="js"
language="tsv2"
/>
</TabItem>
</Tabs>
4 changes: 2 additions & 2 deletions _includes/code/embedded.instantiate.module.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import TsCodeV2CustomModules from '!!raw-loader!/_includes/code/install/embedded
text={PyCodeV3}
startMarker="# START CustomModules"
endMarker="# END CustomModules"
language="py"
language="pyv3"
/>
</TabItem>
<TabItem value="js" label="JS/TS Client v2">
<FilteredTextBlock
text={TsCodeV2CustomModules}
startMarker="// START CustomModules"
endMarker="// END CustomModules"
language="js"
language="tsv2"
/>
</TabItem>
</Tabs>
4 changes: 2 additions & 2 deletions _includes/code/generative.groupedtask.examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"X-OpenAI-Api-Key": os.getenv("OPENAI_APIKEY"),
# END GenerativeOpenAI
# START GenerativeGoogle
"X-Google-Vertex-Api-Key": "YOUR-VERTEX-API-KEY",
"X-Google-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY",
"X-Goog-Vertex-Api-Key": "YOUR-VERTEX-API-KEY",
"X-Goog-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY",
# END GenerativeGoogle
# START GenerativeHuggingface
"X-HuggingFace-Api-Key": "YOUR_HUGGINGFACE_APIKEY",
Expand Down
16 changes: 8 additions & 8 deletions _includes/code/generative.palm.groupedresult.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import weaviate
client = weaviate.Client(
url = "https://WEAVIATE_INSTANCE_URL/", # Replace WEAVIATE_INSTANCE_URL with your instance URL
additional_headers={
"X-Google-Vertex-Api-Key": "YOUR-VERTEX-API-KEY",
"X-Google-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY",
"X-Goog-Vertex-Api-Key": "YOUR-VERTEX-API-KEY",
"X-Goog-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY",
}
)

Expand Down Expand Up @@ -97,8 +97,8 @@ func main() {
Host: "WEAVIATE_INSTANCE_URL", // Replace with your instance URL
Scheme: "https",
Headers: map[string]string{
"X-Google-Vertex-Api-Key": "YOUR-VERTEX-API-KEY",
"X-Google-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY",
"X-Goog-Vertex-Api-Key": "YOUR-VERTEX-API-KEY",
"X-Goog-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY",
},
}
client, err := weaviate.NewClient(cfg)
Expand Down Expand Up @@ -150,8 +150,8 @@ import io.weaviate.client.v1.graphql.query.fields.Field;
public class App {
public static void main(String[] args) {
Map<String, String> headers = new HashMap<String, String>() { {
put("X-Google-Vertex-Api-Key", "YOUR-VERTEX-API-KEY");
put("X-Google-Studio-Api-Key", "YOUR-AI-STUDIO-API-KEY");
put("X-Goog-Vertex-Api-Key", "YOUR-VERTEX-API-KEY");
put("X-Goog-Studio-Api-Key", "YOUR-AI-STUDIO-API-KEY");
} };
Config config = new Config("https", "WEAVIATE_INSTANCE_URL", headers);
// Replace with your instance URL
Expand Down Expand Up @@ -253,8 +253,8 @@ echo '{
-X POST \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $WEAVIATE_API_KEY" \
-H "X-Google-Vertex-Api-Key": "YOUR-VERTEX-API-KEY" \
-H "X-Google-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY" \
-H "X-Goog-Vertex-Api-Key": "YOUR-VERTEX-API-KEY" \
-H "X-Goog-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY" \
-d @- \
https://WEAVIATE_INSTANCE_URL/v1/graphql # Replace WEAVIATE_INSTANCE_URL with your instance URL
```
Expand Down
16 changes: 8 additions & 8 deletions _includes/code/generative.palm.singleresult.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import weaviate
client = weaviate.Client(
url = "https://WEAVIATE_INSTANCE_URL", # Replace WEAVIATE_INSTANCE_URL with the URL
additional_headers={
"X-Google-Vertex-Api-Key": "YOUR-VERTEX-API-KEY",
"X-Google-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY",
"X-Goog-Vertex-Api-Key": "YOUR-VERTEX-API-KEY",
"X-Goog-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY",
}
)

Expand Down Expand Up @@ -96,8 +96,8 @@ func main() {
Host: "WEAVIATE_INSTANCE_URL",
Scheme: "https",
Headers: map[string]string{
"X-Google-Vertex-Api-Key": "YOUR-VERTEX-API-KEY",
"X-Google-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY",
"X-Goog-Vertex-Api-Key": "YOUR-VERTEX-API-KEY",
"X-Goog-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY",
},
}
client, err := weaviate.NewClient(cfg)
Expand Down Expand Up @@ -152,8 +152,8 @@ import io.weaviate.client.v1.graphql.query.fields.Field;
public class App {
public static void main(String[] args) {
Map<String, String> headers = new HashMap<String, String>() { {
put("X-Google-Vertex-Api-Key", "YOUR-VERTEX-API-KEY");
put("X-Google-Studio-Api-Key", "YOUR-AI-STUDIO-API-KEY");
put("X-Goog-Vertex-Api-Key", "YOUR-VERTEX-API-KEY");
put("X-Goog-Studio-Api-Key", "YOUR-AI-STUDIO-API-KEY");
} };
Config config = new Config("https", "WEAVIATE_INSTANCE_URL", headers);
WeaviateClient client = new WeaviateClient(config);
Expand Down Expand Up @@ -263,8 +263,8 @@ echo '{
-X POST \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $WEAVIATE_API_KEY" \
-H "X-Google-Vertex-Api-Key": "YOUR-VERTEX-API-KEY" \
-H "X-Google-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY" \
-H "X-Goog-Vertex-Api-Key": "YOUR-VERTEX-API-KEY" \
-H "X-Goog-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY" \
-d @- \
https://${WEAVIATE_INSTANCE_URL}/v1/graphql
```
Expand Down
4 changes: 2 additions & 2 deletions _includes/code/generative.singleprompt.examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"X-OpenAI-Api-Key": os.getenv("OPENAI_APIKEY"),
# END GenerativeOpenAI
# START GenerativeGoogle
"X-Google-Vertex-Api-Key": "YOUR-VERTEX-API-KEY",
"X-Google-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY",
"X-Goog-Vertex-Api-Key": "YOUR-VERTEX-API-KEY",
"X-Goog-Studio-Api-Key": "YOUR-AI-STUDIO-API-KEY",
# END GenerativeGoogle
# START GenerativeHuggingface
"X-HuggingFace-Api-Key": "YOUR_HUGGINGFACE_APIKEY",
Expand Down
Loading

0 comments on commit 3c3b2f2

Please sign in to comment.