Skip to content

Commit

Permalink
Update header to X-Goog
Browse files Browse the repository at this point in the history
  • Loading branch information
databyjp committed Dec 11, 2024
1 parent f6e5207 commit 0a05f59
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 46 deletions.
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/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
16 changes: 8 additions & 8 deletions _includes/code/graphql.filters.nearText.palm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import weaviate
client = weaviate.Client(
url="http://localhost:8080",
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 @@ -100,8 +100,8 @@ func main() {
Host: "localhost:8080",
Scheme: "http",
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 @@ -170,8 +170,8 @@ import java.util.Map;
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("http", "localhost:8080", headers);
WeaviateClient client = new WeaviateClient(config);
Expand Down Expand Up @@ -249,8 +249,8 @@ echo '{
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer learn-weaviate' \
-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://edu-demo.weaviate.network/v1/graphql
```
Expand Down
4 changes: 2 additions & 2 deletions _includes/code/graphql.filters.nearText.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"X-OpenAI-Api-Key": os.getenv("OPENAI_APIKEY"),
# END NearTextOpenAI
# START NearTextGoogle
"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 NearTextGoogle
# START NearTextHuggingface
"X-HuggingFace-Api-Key": "YOUR_HUGGINGFACE_APIKEY",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func main() {
"X-Databricks-Token": os.Getenv("DATABRICKS_TOKEN"),
// END DatabricksInstantiation
// START GoogleInstantiation
"X-Google-Vertex-Key": os.Getenv("VERTEX_APIKEY"),
"X-Google-Studio-Key": os.Getenv("STUDIO_APIKEY"),
"X-Goog-rtex-Key": os.Getenv("VERTEX_APIKEY"),
"X-Goog-Studio-Key": os.Getenv("STUDIO_APIKEY"),
// END GoogleInstantiation
// START HuggingFaceInstantiation
"X-HuggingFace-Api-Key": os.Getenv("HUGGINGFACE_APIKEY"),
Expand Down
4 changes: 2 additions & 2 deletions _includes/gcp.token.expiry.notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def re_instantiate_weaviate() -> weaviate.Client:
client = weaviate.Client(
url = "https://WEAVIATE_INSTANCE_URL", # Replace WEAVIATE_INSTANCE_URL with the URL
additional_headers = {
"X-Google-Vertex-Api-Key": token,
"X-Goog-Vertex-Api-Key": token,
}
)
return client
Expand Down Expand Up @@ -98,7 +98,7 @@ def re_instantiate_weaviate() -> weaviate.Client:
cluster_url="https://WEAVIATE_INSTANCE_URL", # Replace WEAVIATE_INSTANCE_URL with the URL
auth_credentials=Auth.api_key(weaviate_api_key), # Replace with your Weaviate Cloud key
headers={
"X-Google-Vertex-Api-Key": token,
"X-Goog-Vertex-Api-Key": token,
},
)
return client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<details>
<summary>API key headers</summary>

Starting from `v1.25.1` and `v1.24.14`, there are separate headers `X-Google-Vertex-Api-Key` and `X-Google-Studio-Api-Key` for Vertex AI users and AI Studio respectively.
From `v1.27.7`, `v1.26.12` and `v1.25.27`, `X-Goog-Vertex-Api-Key` and `X-Goog-Studio-Api-Key` headers are supported for Vertex AI users and AI Studio respectively. We recommend these headers for highest compatibility.
<br/>

Prior to Weaviate `v1.25.1` or `v1.24.14`, there was one header for both Vertex AI users and AI Studio, specified with either `X-Google-Api-Key` or `X-PaLM-Api-Key`. We recommend using the new headers for clarity and future compatibility.
Consider `X-Google-Vertex-Api-Key`, `X-Google-Studio-Api-Key`, `X-Google-Api-Key` and `X-PaLM-Api-Key` deprecated.

</details>
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@
"X-Friendli-Baseurl": "https://inference.friendli.ai/dedicated",
# END FriendliDedicatedInstantiation
# START GoogleInstantiation # START GoogleVertexInstantiation
"X-Google-Vertex-Api-Key": vertex_key,
"X-Goog-Vertex-Api-Key": vertex_key,
# START GoogleInstantiation # END GoogleVertexInstantiation
"X-Google-Studio-Api-Key": studio_key,
"X-Goog-Studio-Api-Key": studio_key,
# END GoogleInstantiation
# START HuggingFaceInstantiation
"X-HuggingFace-Api-Key": huggingface_key,
Expand Down

0 comments on commit 0a05f59

Please sign in to comment.