From 0a05f59dddb81c6061425042525d64d7ad1d1e99 Mon Sep 17 00:00:00 2001 From: JP Hwang Date: Wed, 11 Dec 2024 10:54:56 +0000 Subject: [PATCH 1/2] Update header to X-Goog --- _includes/code/core.client.palm.apikey.mdx | 16 ++++++++-------- .../code/generative.groupedtask.examples.py | 4 ++-- _includes/code/generative.palm.groupedresult.mdx | 16 ++++++++-------- _includes/code/generative.palm.singleresult.mdx | 16 ++++++++-------- .../code/generative.singleprompt.examples.py | 4 ++-- _includes/code/graphql.filters.nearText.palm.mdx | 16 ++++++++-------- _includes/code/graphql.filters.nearText.py | 4 ++-- .../go/docs/model-providers/1-connect/main.go | 4 ++-- _includes/gcp.token.expiry.notes.mdx | 4 ++-- .../_includes/google-api-key-note.md | 4 ++-- .../_includes/provider.connect.py | 4 ++-- 11 files changed, 46 insertions(+), 46 deletions(-) diff --git a/_includes/code/core.client.palm.apikey.mdx b/_includes/code/core.client.palm.apikey.mdx index c262941e75..f610352aee 100644 --- a/_includes/code/core.client.palm.apikey.mdx +++ b/_includes/code/core.client.palm.apikey.mdx @@ -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 ) @@ -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 }); @@ -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 } @@ -85,8 +85,8 @@ public class App { // highlight-start Map headers = new HashMap() { { // 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 diff --git a/_includes/code/generative.groupedtask.examples.py b/_includes/code/generative.groupedtask.examples.py index 985347f7d1..7d7d314bad 100644 --- a/_includes/code/generative.groupedtask.examples.py +++ b/_includes/code/generative.groupedtask.examples.py @@ -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", diff --git a/_includes/code/generative.palm.groupedresult.mdx b/_includes/code/generative.palm.groupedresult.mdx index 04f0daf21b..a318467fd2 100644 --- a/_includes/code/generative.palm.groupedresult.mdx +++ b/_includes/code/generative.palm.groupedresult.mdx @@ -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", } ) @@ -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) @@ -150,8 +150,8 @@ import io.weaviate.client.v1.graphql.query.fields.Field; public class App { public static void main(String[] args) { Map headers = new HashMap() { { - 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 @@ -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 ``` diff --git a/_includes/code/generative.palm.singleresult.mdx b/_includes/code/generative.palm.singleresult.mdx index c3a285359f..0cc08592a5 100644 --- a/_includes/code/generative.palm.singleresult.mdx +++ b/_includes/code/generative.palm.singleresult.mdx @@ -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", } ) @@ -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) @@ -152,8 +152,8 @@ import io.weaviate.client.v1.graphql.query.fields.Field; public class App { public static void main(String[] args) { Map headers = new HashMap() { { - 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); @@ -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 ``` diff --git a/_includes/code/generative.singleprompt.examples.py b/_includes/code/generative.singleprompt.examples.py index c4eb68f568..b443f818f5 100644 --- a/_includes/code/generative.singleprompt.examples.py +++ b/_includes/code/generative.singleprompt.examples.py @@ -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", diff --git a/_includes/code/graphql.filters.nearText.palm.mdx b/_includes/code/graphql.filters.nearText.palm.mdx index 6a036463b3..aac309929a 100644 --- a/_includes/code/graphql.filters.nearText.palm.mdx +++ b/_includes/code/graphql.filters.nearText.palm.mdx @@ -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", } ) @@ -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) @@ -170,8 +170,8 @@ import java.util.Map; public class App { public static void main(String[] args) { Map headers = new HashMap() { { - 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); @@ -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 ``` diff --git a/_includes/code/graphql.filters.nearText.py b/_includes/code/graphql.filters.nearText.py index cb00221c9e..d635e09d99 100644 --- a/_includes/code/graphql.filters.nearText.py +++ b/_includes/code/graphql.filters.nearText.py @@ -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", diff --git a/_includes/code/howto/go/docs/model-providers/1-connect/main.go b/_includes/code/howto/go/docs/model-providers/1-connect/main.go index ecff53f23d..8a68a3ab9c 100644 --- a/_includes/code/howto/go/docs/model-providers/1-connect/main.go +++ b/_includes/code/howto/go/docs/model-providers/1-connect/main.go @@ -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"), diff --git a/_includes/gcp.token.expiry.notes.mdx b/_includes/gcp.token.expiry.notes.mdx index 0b33a80090..74a8a0cd08 100644 --- a/_includes/gcp.token.expiry.notes.mdx +++ b/_includes/gcp.token.expiry.notes.mdx @@ -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 @@ -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 diff --git a/developers/weaviate/model-providers/_includes/google-api-key-note.md b/developers/weaviate/model-providers/_includes/google-api-key-note.md index 3d410d215b..47e45d8efd 100644 --- a/developers/weaviate/model-providers/_includes/google-api-key-note.md +++ b/developers/weaviate/model-providers/_includes/google-api-key-note.md @@ -1,9 +1,9 @@
API key headers -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.
-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.
diff --git a/developers/weaviate/model-providers/_includes/provider.connect.py b/developers/weaviate/model-providers/_includes/provider.connect.py index 5525acf4c3..d04123c34b 100644 --- a/developers/weaviate/model-providers/_includes/provider.connect.py +++ b/developers/weaviate/model-providers/_includes/provider.connect.py @@ -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, From 895dc57e8bea91f1b04c33ce946095789d1b9f0b Mon Sep 17 00:00:00 2001 From: JP Hwang Date: Wed, 11 Dec 2024 11:14:19 +0000 Subject: [PATCH 2/2] fix typo --- _includes/code/howto/go/docs/model-providers/1-connect/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/code/howto/go/docs/model-providers/1-connect/main.go b/_includes/code/howto/go/docs/model-providers/1-connect/main.go index 8a68a3ab9c..9ffea82a9c 100644 --- a/_includes/code/howto/go/docs/model-providers/1-connect/main.go +++ b/_includes/code/howto/go/docs/model-providers/1-connect/main.go @@ -34,7 +34,7 @@ func main() { "X-Databricks-Token": os.Getenv("DATABRICKS_TOKEN"), // END DatabricksInstantiation // START GoogleInstantiation - "X-Goog-rtex-Key": os.Getenv("VERTEX_APIKEY"), + "X-Goog-Vertex-Key": os.Getenv("VERTEX_APIKEY"), "X-Goog-Studio-Key": os.Getenv("STUDIO_APIKEY"), // END GoogleInstantiation // START HuggingFaceInstantiation