Skip to content

Commit

Permalink
Merge branch 'main' into patents-batch
Browse files Browse the repository at this point in the history
  • Loading branch information
holtskinner authored Jan 8, 2025
2 parents f46ad24 + 560c0b4 commit 6298ecf
Show file tree
Hide file tree
Showing 78 changed files with 30,191 additions and 395 deletions.
13 changes: 13 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ PYINK
Pakeman
Paquete
Parmar
Pastra
Pengyu
Persero
Phaidon
Expand Down Expand Up @@ -452,6 +453,7 @@ TPUs
TSLA
TSMC
TSNE
TTFB
TTFT
TTH
TTT
Expand Down Expand Up @@ -555,6 +557,7 @@ alloydb
antiword
apikey
apikeys
apk
appspot
appuser
apredict
Expand Down Expand Up @@ -719,6 +722,7 @@ etils
eur
evals
evse
evt
expl
faiss
fastapi
Expand Down Expand Up @@ -856,6 +860,7 @@ kenleejr
keras
keychain
kfp
khz
kickstart
konnte
kotlin
Expand Down Expand Up @@ -921,6 +926,7 @@ mrag
mrr
mrtydi
msmarco
msr
multitool
mvn
mvnw
Expand Down Expand Up @@ -948,6 +954,7 @@ newaxis
newaxisngram
nfcorpus
nfl
nginx
ngram
ngrams
nlp
Expand All @@ -972,6 +979,7 @@ onesie
onesies
openai
openfda
opsz
osm
osx
outdir
Expand Down Expand Up @@ -1150,6 +1158,7 @@ timechart
tion
titlebar
tobytes
toolcall
toself
toset
tqdm
Expand Down Expand Up @@ -1201,11 +1210,14 @@ webcam
webclient
webpage
webpages
webfonts
webrtc
websites
weightage
welcom
werden
whatsapp
wght
wiffle
wikipedia
wil
Expand All @@ -1215,6 +1227,7 @@ wip
wishlist
womens
workarounds
worklets
wparam
wscore
wscores
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spelling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
dictionary_source_prefixes: '{"cspell": "https://raw.githubusercontent.com/streetsidesoftware/cspell-dicts/main/dictionaries/"}'
extra_dictionaries: |
cspell:aws/dict/aws.txt
cspell:bash/src/bash-words.txt
cspell:bash/samples/bash-words.txt
cspell:companies/dict/companies.txt
cspell:css/dict/css.txt
cspell:data-science/dict/data-science-models.txt
Expand Down
1 change: 1 addition & 0 deletions audio/speech/use-cases/podcast/multi-speaker-podcast.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"## Overview\n",
"\n",
"This notebook demonstrates how to use the [Gemini API in Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/overview) to generate an engaging multi-speaker podcast using studio voices in the [Text-to-Speech API](https://cloud.google.com/text-to-speech). \n",
"Note: [Generate dialogue with multiple speakers](https://cloud.google.com/text-to-speech/docs/create-dialogue-with-multispeakers) is only available to projects in allowlist. Please [contact Google Cloud](https://cloud.google.com/contact) if you want to use this feature.\n",
"\n",
"This can be useful for creating interviews, interactive storytelling, video games, e-learning platforms, and accessibility solutions.\n",
"\n",
Expand Down
73 changes: 40 additions & 33 deletions gemini/chat-completions/intro_chat_completions_api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {
"id": "tFy3H3aPgx12"
},
"outputs": [],
"source": [
"%pip install --upgrade --quiet openai"
"%pip install --upgrade --quiet openai google-auth requests"
]
},
{
Expand Down Expand Up @@ -188,7 +188,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {
"id": "NyKGtVQjgx13"
},
Expand Down Expand Up @@ -217,14 +217,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {
"id": "Nqwi-5ufWp_B"
},
"outputs": [],
"source": [
"PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\"}\n",
"LOCATION = \"us-central1\" # @param {type:\"string\"}"
"import os\n",
"\n",
"PROJECT_ID = \"[your-project-id]\" # @param {type: \"string\", placeholder: \"[your-project-id]\", isTemplate: true}\n",
"if not PROJECT_ID or PROJECT_ID == \"[your-project-id]\":\n",
" PROJECT_ID = str(os.environ.get(\"GOOGLE_CLOUD_PROJECT\"))\n",
"\n",
"LOCATION = os.environ.get(\"GOOGLE_CLOUD_REGION\", \"us-central1\")"
]
},
{
Expand Down Expand Up @@ -254,7 +259,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {
"id": "kolJkBLdHaw0"
},
Expand All @@ -272,12 +277,12 @@
"source": [
"#### Authentication\n",
"\n",
"You can request an access token from the default credentials for the current environment. Note that the access token lives for 1 hour by default (https://cloud.google.com/docs/authentication/token-types#at-lifetime); after expiration, it must be refreshed.\n"
"You can request an access token from the default credentials for the current environment. Note that the access token lives for [1 hour by default](https://cloud.google.com/docs/authentication/token-types#at-lifetime); after expiration, it must be refreshed.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {
"id": "i0qceuiQEPHv"
},
Expand All @@ -299,7 +304,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {
"id": "c-MRhsnlj6iw"
},
Expand All @@ -319,12 +324,16 @@
"source": [
"#### Gemini models\n",
"\n",
"You can experiment with [various supported Gemini models](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/call-gemini-using-openai-library#supported_models). If you are not sure which model to use, then try `gemini-1.5-flash`. `gemini-1.5-flash` is optimized for multimodal use cases where speed and cost are important."
"You can experiment with [various supported Gemini models](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/call-gemini-using-openai-library#supported_models).\n",
"\n",
"If you are not sure which model to use, then try `gemini-1.5-flash`.\n",
"\n",
"`gemini-1.5-flash` is optimized for multimodal use cases where speed and cost are important."
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {
"id": "r7OhyH46H2H5"
},
Expand All @@ -348,7 +357,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {
"id": "JQTWLCzoHyUA"
},
Expand All @@ -370,7 +379,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {
"id": "DdfWBfggOvtf"
},
Expand All @@ -390,7 +399,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {
"id": "LxpdxYCxH51u"
},
Expand All @@ -410,7 +419,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {
"id": "zOwEvNkCMiMF"
},
Expand All @@ -434,7 +443,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"metadata": {
"id": "3hO8yLqnJEgh"
},
Expand All @@ -447,7 +456,7 @@
")\n",
"\n",
"for chunk in response:\n",
" print(chunk.choices[0].delta.content)"
" print(chunk.choices[0].delta.content, end=\"\")"
]
},
{
Expand All @@ -464,7 +473,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 15,
"metadata": {
"id": "KOIu1Me-PQ6e"
},
Expand All @@ -489,7 +498,7 @@
" ],\n",
")\n",
"\n",
"print(response.choices[0].message.content)"
"Markdown(response.choices[0].message.content)"
]
},
{
Expand All @@ -509,7 +518,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 18,
"metadata": {
"id": "arshz2C4W_ck"
},
Expand All @@ -535,22 +544,21 @@
" }\n",
"]\n",
"\n",
"messages = []\n",
"messages.append(\n",
"messages = [\n",
" {\n",
" \"role\": \"system\",\n",
" \"content\": \"Don't make assumptions about what values to plug into functions. Ask for clarification if a user request is ambiguous.\",\n",
" }\n",
")\n",
"messages.append({\"role\": \"user\", \"content\": \"What is the weather in Boston?\"})\n",
" },\n",
" {\"role\": \"user\", \"content\": \"What is the weather in Boston?\"},\n",
"]\n",
"\n",
"response = client.chat.completions.create(\n",
" model=MODEL_ID,\n",
" messages=messages,\n",
" tools=tools,\n",
")\n",
"\n",
"print(print(response.choices[0].message.tool_calls))"
"print(response.choices[0].message.tool_calls)"
]
},
{
Expand All @@ -568,7 +576,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 19,
"metadata": {
"id": "GoEv7CKNXZu1"
},
Expand All @@ -594,14 +602,13 @@
" }\n",
"]\n",
"\n",
"messages = []\n",
"messages.append(\n",
"messages = [\n",
" {\n",
" \"role\": \"system\",\n",
" \"content\": \"Don't make assumptions about what values to plug into functions. Ask for clarification if a user request is ambiguous.\",\n",
" }\n",
")\n",
"messages.append({\"role\": \"user\", \"content\": \"What is the weather in Boston?\"})\n",
" },\n",
" {\"role\": \"user\", \"content\": \"What is the weather in Boston?\"},\n",
"]\n",
"\n",
"response = client.chat.completions.create(\n",
" model=MODEL_ID,\n",
Expand Down
Loading

0 comments on commit 6298ecf

Please sign in to comment.