Git Product home page Git Product logo

generative-ai-docs's Introduction

Google Gemini API Website & Documentation

These are the source files for the guide and tutorials on the Generative AI developer site, home to the Gemini API and Gemma.

Path Description
site/ Notebooks and other content used directly on ai.google.dev.
demos/ Demos apps. Larger than examples, typically consists of working apps.
examples/ Examples. Smaller, single-purpose code for demonstrating specific concepts.

To contribute to the site documentation, please read CONTRIBUTING.md.

To contribute as a demo app maintainer, please read DEMO_MAINTAINERS.md.

To file an issue, please use the GitHub issue tracker.

License

Apache License 2.0

generative-ai-docs's People

Contributors

8bitmp3 avatar aaron-wade avatar anirudh161 avatar data-wombat avatar dependabot[bot] avatar doggy8088 avatar elisabandy avatar ghat0tkach avatar jameswex avatar jayjicheng avatar joefernandez avatar josbecker avatar keertk avatar kyolee415 avatar markdaoust avatar markmcd avatar mayureshagashe2105 avatar nidhinpd-yml avatar owahltinez avatar pcoet avatar shilpakancharla avatar shuvo31 avatar singhniraj08 avatar soosung80 avatar thesanju avatar tymichaelchen avatar williamito avatar windmaple avatar ymodak avatar ziyadf296 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

generative-ai-docs's Issues

Unexpected error in rest_quickstart.ipynb

Description of the bug:

When running in the google collab notebook , every bash command is giving the following error
image

Actual vs expected behavior:

There should be output as expected
image

Any other information you'd like to share?

If we are using ! instead of %%bash , we may get indentation errors or probably no output
However when I ran the following command using subprocess, I got the output
image

AI Studio 403

Description of the bug:

Screenshot - 14_12_2023 , 15_23_55

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

Function schemas don't allow maxItems/minItems

Description of the bug:

Using the Gemini Pro API, If you have a function definition like this:

{
  name: "myFunction",
  parameters: {
    type: "object",
    properties: {
      choices: {
        type: "array",
        minItems: 5,
        maxItems: 5,
        items: {type: "string"}
      }
    }
  }
}

the API will return an error about minItems and maxItems like:

Invalid JSON payload received. Unknown name "maxItems" at 'tools[0].function_declarations[0].parameters.properties[0].value': Cannot find field.
Invalid JSON payload received. Unknown name "minItems" at 'tools[0].function_declarations[0].parameters.properties[0].value': Cannot find field.

Actual vs expected behavior:

It should accept the maxItems/minItems properties, which are part of JSON/OpenAPI schemas.

PaLM API : 400 User location is not supported for the API use.

Hi, Let me ask a question.
I received an invitation to join the PaLM API this morning and tried the Colab sample provided.
PaLM API: Text works fine, but when I run PaLM API: Chat, I get FailedPrecondition: 400 User location is not supported for the API use.
Is there currently a location restriction on Chat use?

exec the code below

# Create a new conversation
response = palm.chat(messages='Hello')

# Last contains the model's response:
response.last

then error

---------------------------------------------------------------------------
_InactiveRpcError                         Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/google/api_core/grpc_helpers.py](https://localhost:8080/#) in error_remapped_callable(*args, **kwargs)
     71         try:
---> 72             return callable_(*args, **kwargs)
     73         except grpc.RpcError as exc:

7 frames
_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
	status = StatusCode.FAILED_PRECONDITION
	details = "User location is not supported for the API use."
	debug_error_string = "UNKNOWN:Error received from peer ipv4:173.194.69.95:443 {grpc_message:"User location is not supported for the API use.", grpc_status:9, created_time:"2023-06-14T23:35:32.272660998+00:00"}"
>

The above exception was the direct cause of the following exception:

FailedPrecondition                        Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/google/api_core/grpc_helpers.py](https://localhost:8080/#) in error_remapped_callable(*args, **kwargs)
     72             return callable_(*args, **kwargs)
     73         except grpc.RpcError as exc:
---> 74             raise exceptions.from_grpc_error(exc) from exc
     75 
     76     return error_remapped_callable

FailedPrecondition: 400 User location is not supported for the API use.

Talking-character: Example won't compile. Error

Hi, I'm excited to try this but can't get it to compile. Here the error I get after running npm start:

Failed to compile.

./src/apis/speechRecognition.ts 132:47
Module parse failed: Unexpected token (132:47)
You may need an appropriate loader to handle this file type.
|                 while (1) switch (_context2.prev = _context2.next) {
|                   case 0:
>                     base64Data = reader.result?.toString().split(',')[1];
|                     if (!base64Data) {
|                       _context2.next = 7;

I'm running this in VSCode on a M1 Macbook btw

Call for demo app maintainers

Hi everyone,

We currently have 6 demo apps hosted in this repository that are referenced in the PaLM API site. We're looking to folks in the community to help maintain them. This could include fixing issues, reviewing PR contributions, adding tests, making sure they're in a working state, etc.

If you're interested or have any questions, please reach out to us.
Thank you in advance for all your support and contributions!

cc @google/generative-ai-admin @google/gtech-llm-support

A Web UI to check for tokens and character count of palm api

Description of the feature request:

A web ui where a user can come and input his text to check for tokens and character.

What problem are you trying to solve with this feature?

This would help the user to check his character count. In fine tuning a model in maker suite the output should be less than 5000 character. This way the user can open the webapp and past his output o check for characters.

Any other information you'd like to share?

https://platform.openai.com/tokenizer
U can check this for reference. Something like this for palm api would be fantastic.

Language model API key

I wonder what's the LANGUAGE_MODEL_API_KEY needed here? Is it the same API KEY as GOOGLE_CLOUD_API_KEY that I get from google cloud console? If not, I struggle to find how to generate a separate language model api key despite I have Vertex AI enabled.

Could someone please help? Thanks!

image

MediaPipe folder misplaced

it's in the third-party directory. when running, the mediapipe_audio_blendshape reports module not found. Simple mitigation by copying the mediapipe folder over inside /src

image

Compiling problems

Hi everyone,
big and amazing projects on this repo! thank you for sharing!!!

I'm reaching some problems with the npm start on my local workstation, here below the last attempt:

Compiled with problems:
Γ—
ERROR in ./src/apis/mediapipe_audio_blendshapes.ts 19:0-92
Module not found: Error: Can't resolve './mediapipe/web/graph_runner/graph_runner' in 'C:\Users\VIMALLEM\OneDrive - Capgemini\Desktop\Codici APP\talking-character\src\apis'
ERROR in src/apis/mediapipe_audio_blendshapes.ts:17:59
TS2307: Cannot find module './mediapipe/web/graph_runner/graph_runner' or its corresponding type declarations.
15 | */
16 |

17 | import {createMediaPipeLib, GraphRunner, WasmModule} from './mediapipe/web/graph_runner/graph_runner';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18 |
19 | declare interface AudioBlendshapesWasmModule {
20 | updateBlendshape: (name: string, value: number) => void;
ERROR in src/apis/mediapipe_audio_blendshapes.ts:44:10
TS2339: Property 'finishProcessing' does not exist on type 'MediaPipeAudioBlendshapes'.
42 | */
43 | getBlendshapes(): Blendshapes {
44 | this.finishProcessing();
| ^^^^^^^^^^^^^^^^
45 | return this.blendshapes;
46 | }
47 | }
ERROR in src/apis/talkingHead.ts:17:58
TS2307: Cannot find module './mediapipe/web/graph_runner/graph_runner' or its corresponding type declarations.
15 | */
16 |
17 | import {createGraphRunner, GraphRunner, WasmModule} from './mediapipe/web/graph_runner/graph_runner';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18 | import {createMediaPipeAudioBlendshapes, MediaPipeAudioBlendshapes} from './mediapipe_audio_blendshapes';
19 | // import {trustedResourceUrl} from 'safevalues';
20 |
ERROR in src/apis/talkingHead.ts:118:26
TS2339: Property 'wasmModule' does not exist on type 'MediaPipeAudioBlendshapes'.
116 | isV2?'talking_head_v2/talking_heads_v2_microphone_assets.js':'talking_head_v1/talking_heads_microphone_assets.js');
117 | wasmModule =
118 | audioBlendshapes.wasmModule as WasmModule & TalkingHeadsWasmModule;
| ^^^^^^^^^^
119 | wasmModule.NUM_QUEUED_AUDIO_PACKETS = 0;
120 | audioBlendshapes.configureAudio(1, NUM_SAMPLES, SAMPLE_RATE);
121 | await audioBlendshapes.initializeGraph(isV2?'talking_head_v2/talking_heads_v2_demo.binarypb':'talking_head_v1/talking_heads_demo.binarypb');
ERROR in src/apis/talkingHead.ts:120:22
TS2339: Property 'configureAudio' does not exist on type 'MediaPipeAudioBlendshapes'.
118 | audioBlendshapes.wasmModule as WasmModule & TalkingHeadsWasmModule;
119 | wasmModule.NUM_QUEUED_AUDIO_PACKETS = 0;
120 | audioBlendshapes.configureAudio(1, NUM_SAMPLES, SAMPLE_RATE);
| ^^^^^^^^^^^^^^
121 | await audioBlendshapes.initializeGraph(isV2?'talking_head_v2/talking_heads_v2_demo.binarypb':'talking_head_v1/talking_heads_demo.binarypb');
122 | // streamMicrophoneThroughGraph(audioBlendshapes);
123 | }
ERROR in src/apis/talkingHead.ts:121:28
TS2339: Property 'initializeGraph' does not exist on type 'MediaPipeAudioBlendshapes'.
119 | wasmModule.NUM_QUEUED_AUDIO_PACKETS = 0;
120 | audioBlendshapes.configureAudio(1, NUM_SAMPLES, SAMPLE_RATE);
121 | await audioBlendshapes.initializeGraph(isV2?'talking_head_v2/talking_heads_v2_demo.binarypb':'talking_head_v1/talking_heads_demo.binarypb');
| ^^^^^^^^^^^^^^^
122 | // streamMicrophoneThroughGraph(audioBlendshapes);
123 | }
124 | }
ERROR in src/apis/talkingHead.ts:148:22
TS2339: Property 'addAudioToStream' does not exist on type 'MediaPipeAudioBlendshapes'.
146 | const timestamp = lastAudioT + NUM_SAMPLES * 1000.0 / SAMPLE_RATE;
147 | if (timestamp > lastAudioT) {
148 | audioBlendshapes.addAudioToStream(audioData, 'input_audio', timestamp);
| ^^^^^^^^^^^^^^^^
149 | }
150 | lastAudioT = timestamp;
151 | }

can you help me?

ReferenceError: AudioContext is not defined

Description of the bug:

While running the npm test, tests are failing with error:
FAIL src/App.test.tsx (5.214 s)
βœ• renders learn react link (72 ms)

● renders learn react link

ReferenceError: AudioContext is not defined

  41 | const useTextToSpeech =
  42 |     () => {
> 43 |       const audioContext = useRef(new AudioContext());
     |                                       ^
  44 |       const processor =
  45 |           useRef(audioContext.current.createScriptProcessor(1024, 1, 1));
  46 |       const dest = useRef(audioContext.current.createMediaStreamDestination());

  at useTextToSpeech (src/apis/textToSpeech.ts:43:39)

Actual vs expected behavior:

No response

Any other information you'd like to share?

Even while running the App the character appears but the speechtotext part is not working and it can't process any audio

API rejects multiple role: "user" messages in a row

Description of the bug:

If you submit a prompt like this to Gemini Pro:

{
  contents: [
    { role: "user", ...}
    { role: "user", ....}
  ]
}

The API will respond that the last message must come from user.

This occurred when I was translating my GPT role: "system" messages to be role: "user". (But GPT also doesn't reject multiple user messages in a row)

Actual vs expected behavior:

  1. The error message should be accurate
  2. The API shouldn't reject two user messages in a row

Any other information you'd like to share?

No response

Execute operation "model.generate_content(content).text" and cause error '*** IndexError: list index out of range'

Description of the bug:

model.generate_content(content).text

Actual vs expected behavior:

(Pdb) len(content)
31256
(Pdb) model.generate_content(content)
<google.generativeai.types.generation_types.GenerateContentResponse object at 0x116f2b350>
(Pdb) rep = model.generate_content(content)
(Pdb) rep
<google.generativeai.types.generation_types.GenerateContentResponse object at 0x11758c350>
(Pdb) rep.text
*** IndexError: list index out of range

Any other information you'd like to share?

No response

Getting some issue while running mood-food demo

I am getting this error:

Generative Language API (Staging) has not been used in project 131675271456 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/staging-generativelanguage.sandbox.googleapis.com/overview?project=131675271456 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

ANd if i open that given link, then i got this error in cloud console:

`Failed to load.
There was an error while loading /apis/library/staging-generativelanguage.sandbox.googleapis.com?project=gen-lang-client-0632657658. Please try again.

It may be a browser or network issue. Go to the loading issues help page to troubleshoot the issue.

Request ID: 4086745051195540863`
252891128-9906c448-5083-4ea0-946e-27f3ed453780

How to proceed from here to test this mood-food demo app?

Consistent 500 error

Description of the bug:

I get lots of intermittent 500 errors (lots and lots!) but this request gives consistent 500 errors:

{"contents":
  [
    {"role":"user","parts":[{"text":""},{"text":""}]}
  ],
  "tools":[{"functionDeclarations":[{"name":"locationFamilyInfo","description":"Identify the status/classes of people in Mycenae in 1200BC.","parameters":{"type":"object","properties":{"classes":{"type":"array","items":{"type":"string","description":"A list of classes or status of people in the location, such as \"upper class\", \"surf\", \"untouchable\", etc. Include some exceptional classes, such as \"royalty\", \"nobility\", \"priesthood\", \"warrior\", etc. Give the full range of classes/status in society at the time."}},"ethnicities":{"type":"array","items":{"type":"string","description":"A list of races and ethnicities in the location, such as \"white\", \"hispanic\", \"Hmong\", etc."}},"religions":{"type":"array","items":{"type":"string","description":"A list of religions in the location, such as \"Christian\", \"Muslim\", \"Hindu\", etc. Can include denominations, such as \"Catholic\", \"Protestant\", \"Sunni\", \"Shia\", etc."}}},"required":["classes","ethnicities","religions"]}}]}],
  "generationConfig":{"temperature":0.5}
}

Notably the request text is weird. GPT answers this successfully and accurately based on the function call alone.

Actual vs expected behavior:

No 500 error

Any other information you'd like to share?

No response

Query about sharing my fine-tuned model

Hi everyone,

I'm very new to this. I have a question. After I fine-tune a model through PaLM API on my own dataset how do I share my tuned model with others?

Thanks.

Not able to communicate with the character

I'm able to run the project and get the character to appear. However, the input field for texting with the character does not seem to be ready for input. Also, even though the microphone can be enabled and my voice appears to be heard, there's no indication that the ASR is working. Here is a video of what I am experiencing.

Talking.Character.-.No.text.or.voice.input.mp4

Gemini API: Quickstart with Python

Description of the feature request:

This quickstart demonstrates how to use the Python SDK for the Gemini API, which gives you access to Google's Gemini large language models. In this quickstart, you will learn how to:

Set up your development environment and API access to use Gemini.
Generate text responses from text inputs.
Generate text responses from multimodal inputs (text and images).
Use Gemini for multi-turn conversations (chat).
Use embeddings for large language models.

What problem are you trying to solve with this feature?

You can run this quickstart in Google Colab, which runs this notebook directly in the browser and does not require additional environment configuration.

Alternatively, to complete this quickstart locally, ensure that your development environment meets the following requirements:

Python 3.9+
An installation of jupyter to run the notebook.

Any other information you'd like to share?

No response

Standardized Model Name

Do we have standardized model names in the Palm API? For example OpenAI API have GPT-3.5 and GPT-4 model name which always use latest version of the GPT model. They have multiple versions of GPT-3.5 but if an user uses "GPT-3.5", it would always consider the latest version of it. Do we currently have or plan for the same in PaLM API? I understand it's in public preview stage but not available for production use.. It'll be a great help for developers so to minimize changes for future. As of now finding the name by listing all models and finding "generateText" is an overhead..

Weird Response

When I use API for translation, it does not return output. Instead it applies some filtering like below..

{
  "filters": [
    {
      "reason": "OTHER"
    }
  ]
}

Here's my curl command. It works for "hindi" language but not for "german", that's weird.. But it works on Bard Website which I am assuming using the same API --
$ curl https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key=$PALM_API_KEY -H 'Content-Type: application/json' -X POST -d '{"prompt": { "text": "Act like a human translator and translate the following text to german language. \n I love you." } }'

max_output_tokens

what is the maximum value of this max_output_tokens argument? Can it take more than 10k tokens if I input some document in the prompt and expect output accordingly? I couldn't find max_input_tokens argument so assuming no limit for prompt..

Rest API

Could you release a Rest API?

MakerSuite does not work -- instructions ignored.

Hello, I am evaluating Google Palm 2 API and I am using MakerSuite for testing. I must be doing something wrong, but I am not understanding how the "context" prompt input works in MakerSuite. I simply write the following context: "Do not talk about baseball." and also provided an example user/model input stating not to talk about baseball, but when I run the test and ask "What is baseball?", the model responds back talking about baseball:

image

So, what am I doing wrong?

Accessibility

Description of the feature request:

I want contribute by adding text. that users can access the project's directly from codespaces. Can submit pr for that. Pretty plz πŸ₯Ί
Can you tell me what are guidelines ? (asking Because when i contributed to Microsoft they Deleted all lines and then PR.)

PS: PR will/can be

Users can try the demos, examples, templates by simple clicking Code < > button -> then click on Codespaces -> and then click + button

codespces.mp4

Thenks mates XD

What problem are you trying to solve with this feature?

Accessibility for implementing demo projects

Any other information you'd like to share?

No response

Talking Character: Getting HTTP 403 for staging-sanbox bison API, but can't activate it from console - getting "Failed to load"

Talking Character: Getting a 403 error that can't be fixed from console for the chat bison staging-sandbox API:
HTTP request: https://autopush-generativelanguage.sandbox.googleapis.com/v1beta1/models/chat-bison-001:generateMessage?key=
HTTP response 403:
{
"error": {
"code": 403,
"message": "Generative Language API (Staging) has not been used in project before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/staging-generativelanguage.sandbox.googleapis.com/overview?project= then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developers console API activation",
"url": "https://console.developers.google.com/apis/api/staging-generativelanguage.sandbox.googleapis.com/overview?project="
}
]
},
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "SERVICE_DISABLED",
"domain": "googleapis.com",
"metadata": {
"consumer": "projects/",
"service": "staging-generativelanguage.sandbox.googleapis.com"
}
}
]
}
}

When visiting the suggested staging-sandbox URL - Getting the following console error:

Failed to load.
There was an error while loading /apis/library/staging-generativelanguage.sandbox.googleapis.com?project=. Please try again.

It may be a browser or network issue. Go to the loading issues help page to troubleshoot the issue.

Screenshot 2023-07-04 at 3 32 48 PM

camelCase or Underscore

Description of the bug:

Hi Team - I just wanted to highlight that fields in the request body are both in camelCase and Underscore in the REST API Guide LINK . Check "candidate_count" in the first example and "Request body" section in the link. Wanted to confirm the right format.

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

Convert Docs into markdown files

Description of the feature request:

For a normal business case, we have tons of docs, sheet, decks in the format of Google doc, Microsoft office, or PDF. I believe Doc Agent will be much more useful if it can convert those documents into markdown or directly into vector database.

What problem are you trying to solve with this feature?

I want to create assistive Agent to answer strategy, product and marketing answers instead of me. It can also be used by the junior team members to onboard and grow.

Any other information you'd like to share?

No response

Talking_character: TS2590: Expression produces a union type that is too complex to represent.

ERROR in src/pages/character.tsx:
ERROR in src/pages/character.tsx:76:9
TS2590: Expression produces a union type that is too complex to represent.
    74 |     [CharacterState.Idle]: (
    75 |       <IconButton
  > 76 |         className="shadow-box"
       |         ^^^^^^^^^^^^^^^^^^^^^^
  > 77 |         onClick={onMicButtonPressed}
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 78 |         aria-label="Start Recording"
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 79 |         sx={{
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 80 |           width: '10vh',
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 81 |           height: '10vh',
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 82 |           marginTop: '30px',
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 83 |           padding: '16px',
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 84 |           borderRadius: '50%',
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 85 |           color: COLORS.primary,
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 86 |           backgroundColor: COLORS.bgcolor,
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 87 |           '&:hover': {
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 88 |             backgroundColor: COLORS.bgcolor,
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 89 |             '@media (hover: none)': {
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 90 |               backgroundColor: COLORS.bgcolor,
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 91 |             },
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 92 |           },
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 93 |         }}>
       | ^^^^^^^^^^^
    94 |         <KeyboardVoiceOutlined sx={{fontSize: '40px'}} />
    95 |       </IconButton>
    96 |     ),
ERROR in src/pages/character.tsx:94:32
TS2590: Expression produces a union type that is too complex to represent.
    92 |           },
    93 |         }}>
  > 94 |         <KeyboardVoiceOutlined sx={{fontSize: '40px'}} />
       |                                ^^^^^^^^^^^^^^^^^^^^^^^
    95 |       </IconButton>
    96 |     ),
    97 |     [CharacterState.Listening]: (
ERROR in src/pages/character.tsx:94:36
TS2590: Expression produces a union type that is too complex to represent.
    92 |           },
    93 |         }}>
  > 94 |         <KeyboardVoiceOutlined sx={{fontSize: '40px'}} />
       |                                    ^^^^^^^^^^^^^^^^^^
    95 |       </IconButton>
    96 |     ),
    97 |     [CharacterState.Listening]: (
ERROR in src/pages/character.tsx:157:9
TS2590: Expression produces a union type that is too complex to represent.
    155 |       }}>
    156 |       <AppBar
  > 157 |         position="static"
        |         ^^^^^^^^^^^^^^^^^
  > 158 |         color="transparent"
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 159 |         elevation={0}
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 160 |         sx={{width: boxWidth, alignSelf: 'center'}}>
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    161 |         <Toolbar className="tool-bar">
    162 |           <Box
    163 |             component="div"
ERROR in src/pages/character.tsx:161:18
TS2590: Expression produces a union type that is too complex to represent.
    159 |         elevation={0}
    160 |         sx={{width: boxWidth, alignSelf: 'center'}}>
  > 161 |         <Toolbar className="tool-bar">
        |                  ^^^^^^^^^^^^^^^^^^^^
    162 |           <Box
    163 |             component="div"
    164 |             className="shadow-back-button"
ERROR in src/pages/character.tsx:233:11
TS2590: Expression produces a union type that is too complex to represent.
    231 |             overflow: 'hidden',
    232 |           }}>
  > 233 |           <Typography>{transcript[0]}</Typography>
        |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    234 |         </Box>
    235 |
    236 |         <Box
ERROR in src/pages/personality.tsx:328:13
TS2590: Expression produces a union type that is too complex to represent.
    326 |           }}>
    327 |           <Button
  > 328 |             className = "shadow-update-button"
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 329 |             sx={{
        | ^^^^^^^^^^^^^^^^^
  > 330 |               color: COLORS.grey,
        | ^^^^^^^^^^^^^^^^^
  > 331 |             }}
        | ^^^^^^^^^^^^^^^^^
  > 332 |             onClick={handleCancelUploadImage}>
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    333 |             Cancel
    334 |           </Button>
    335 |           <Button

Talking-character: Uncaught runtime errors: Could not load /Doggo07.glb: sRGBEncoding is not defined)

I am getting the below error while running the demo app :

Uncaught runtime errors:
Could not load /Doggo07.glb: sRGBEncoding is not defined)
    at http://localhost:3000/static/js/bundle.js:27729:36
    at _onError (http://localhost:3000/static/js/bundle.js:117017:9)

Repo Hyperlink:
https://github.com/google/generative-ai-docs/tree/340b0a1fcc2c0f4c95861eb5638b2b867024c280/demos/palm/web/talking-character
Screenshot from 2023-05-26 00-55-33

more info :
while running npm run test below error shows .

` FAIL src/App.test.tsx
βœ• renders learn react link (66 ms)
ReferenceError: AudioContext is not defined

  40 | const useTextToSpeech =
  41 |     () => {
> 42 |       const audioContext = useRef(new AudioContext());
     |                                       ^
  43 |       const processor =
  44 |           useRef(audioContext.current.createScriptProcessor(1024, 1, 1));
  45 |       const dest = useRef(audioContext.current.createMediaStreamDestination());

  at useTextToSpeech (src/apis/textToSpeech.ts:42:39)
  at Character (src/pages/character.tsx:43:60)
  at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:16305:18)
  at mountIndeterminateComponent (node_modules/react-dom/cjs/react-dom.development.js:20074:13)
  at beginWork (node_modules/react-dom/cjs/react-dom.development.js:21587:16)
  at beginWork$1 (node_modules/react-dom/cjs/react-dom.development.js:27426:14)
  at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:26560:12)
  at workLoopSync (node_modules/react-dom/cjs/react-dom.development.js:26466:5)
  at renderRootSync (node_modules/react-dom/cjs/react-dom.development.js:26434:7)
  at recoverFromConcurrentError (node_modules/react-dom/cjs/react-dom.development.js:25850:20)
  at performConcurrentWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:25750:22)
  at flushActQueue (node_modules/react/cjs/react.development.js:2667:24)
  at act (node_modules/react/cjs/react.development.js:2582:11)
  at node_modules/@testing-library/react/dist/act-compat.js:63:25
  at renderRoot (node_modules/@testing-library/react/dist/pure.js:159:26)
  at render (node_modules/@testing-library/react/dist/pure.js:246:10)
  at Object.<anonymous> (src/App.test.tsx:22:9)

Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 4.26 s, estimated 5 s
Ran all test suites related to changed files.`

500 An internal error has occurred

Description of the bug:

Quickstart in Google Colab went successfully, but when I try to setup this locally. I got an error
InternalServerError: 500 An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting

image image image

Actual vs expected behavior:

It must run locally as it run in Google colab

It ran successfully in colab but not in local jupyter server

Any other information you'd like to share?

No response

ReadTimeout: HTTPConnectionPool(host='localhost', port=36469): Read timed out. (read timeout=60.0)

Description of the bug:

When I tried to use python code to call the gemin model on colab to generate a long article, it timed out. I couldn't find an option to extend the timeout.Is there any solution?

Actual vs expected behavior:

response = model.generate_content(prompt_parts, stream=True)


TimeoutError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)
536 try:
--> 537 response = conn.getresponse()
538 except (BaseSSLError, OSError) as e:

25 frames
TimeoutError: timed out

The above exception was the direct cause of the following exception:

ReadTimeoutError Traceback (most recent call last)
ReadTimeoutError: HTTPConnectionPool(host='localhost', port=36469): Read timed out. (read timeout=60.0)

During handling of the above exception, another exception occurred:

ReadTimeout Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
530 raise SSLError(e, request=request)
531 elif isinstance(e, ReadTimeoutError):
--> 532 raise ReadTimeout(e, request=request)
533 elif isinstance(e, _InvalidHeader):
534 raise InvalidHeader(e, request=request)

ReadTimeout: HTTPConnectionPool(host='localhost', port=36469): Read timed out. (read timeout=60.0)

Any other information you'd like to share?

No response

travel-planner demo stuck at Day 1 itinerary

Followed the installation instruction to run wanderlust demo locally:

yarn dev

Enter a destination (i.e I want to go to Galveston Beach Texas this weekend) or click one of the sample trip plan. The app shows the day 1 itinerary properly (without Map or place), then it stuck with loading your itinerary..., eventually page timed out and returns to the home page.

I do have proper API key set up for both Place and Generative language.

PaLM: Error trying to use python API

When trying to use the google-generativeai library in python, I get the following error trying to import:

Traceback (most recent call last):
File "palm_summarizer.py", line 3, in
import google.generativeai as palm
File "/home/bill/.local/lib/python3.8/site-packages/google/generativeai/init.py", line 59, in
from google.generativeai import types
File "/home/bill/.local/lib/python3.8/site-packages/google/generativeai/types/init.py", line 19, in
from google.generativeai.types.text_types import *
File "/home/bill/.local/lib/python3.8/site-packages/google/generativeai/types/text_types.py", line 34, in
class Completion(abc.ABC):
File "/home/bill/.local/lib/python3.8/site-packages/google/generativeai/types/text_types.py", line 49, in Completion
filters: Optional[list[safety_types.ContentFilterDict]]
TypeError: 'type' object is not subscriptable

I'm using Python 3.8; couldn't find a required version in the docs. Does it require a different version? Or is something else wrong here?

Talking-character use in android

Description of the feature request:

how to use this in android

What problem are you trying to solve with this feature?

No response

Any other information you'd like to share?

No response

Upgrade examples to use Colab User Secrets.

Description of the feature request:

Upgrade examples to use Colab User Secrets.

Left Bar > πŸ”‘ User secrets

What problem are you trying to solve with this feature?

No response

Any other information you'd like to share?

No response

Candidate was blocked due to SAFETY at the time when the BLOCK_NONE setting was set

Description of the bug:

[GoogleGenerativeAI Error]: Candidate was blocked due to SAFETY

result.response.candidates[0].safetyRatings has the following value

 [
  { category: 'HARM_CATEGORY_SEXUALLY_EXPLICIT', probability: 'LOW' },
  { category: 'HARM_CATEGORY_HATE_SPEECH', probability: 'NEGLIGIBLE' },
  { category: 'HARM_CATEGORY_HARASSMENT', probability: 'HIGH' },
  {
    category: 'HARM_CATEGORY_DANGEROUS_CONTENT',
    probability: 'NEGLIGIBLE'
  }
]

My model.safetySettings

[
  { category: 'HARM_CATEGORY_HATE_SPEECH', threshold: 'BLOCK_NONE' },
  {
    category: 'HARM_CATEGORY_SEXUALLY_EXPLICIT',
    threshold: 'BLOCK_NONE'
  },
  { category: 'HARM_CATEGORY_HARASSMENT', threshold: 'BLOCK_NONE' },
  {
    category: 'HARM_CATEGORY_DANGEROUS_CONTENT',
    threshold: 'BLOCK_NONE'
  }
  ]

Actual vs expected behavior:

Content should not be blocked.

Any other information you'd like to share?

No response

International text FX

Description of the feature request:

It would need to be able to use text FX tools in other languages than English.

What problem are you trying to solve with this feature?

I would love to use these tools in my first language, Italian. And some other languages too, why not.

Any other information you'd like to share?

No response

Working with PDF files

Description of the feature request:

Hello, I think adding the possibility to chat with PDF files will be a good feature to add.

What problem are you trying to solve with this feature?

No response

Any other information you'd like to share?

No response

PaLM API: "INVALID_ARGUMENT" error for prompt

I know that I am successfully sending requests to the PaLM API because other prompts have succeeded.
This one, however, returns an error:

{"prompt": {"text": "What tools are targets of this attack, if any? Respond in JSON.\n\n4 / 7Analysis After analyzing the captured samples, Sangfor found that it is nearlly identical to the first version in code structure. After launch, the virus will first create a note file (HOW T O BACK YOUR FILES.exe) and then disable the family group and then Windows defender . Subsequently , the virus will create an auto-startup item named WindowsUpdateCheck, which will be executed through CMD to delete disk volumes, stop database service, traverse and mount volumes and traverse disk files: 5 / 7 After encrypting files, the virus will duplicate the note file to the encrypted file directory: Finally , the virus executes command through CMD to delete the RDP connection and system logs and delete itself. Solutions Currently there is no decryption tool for victims. Y ou may isolate infected hosts and disconnect them from network. We recommend performing a virus scan and removal as soon as possible. Detection and Removal 6 / 7Sangfor EDR and NGAF products are capable of detecting and removing this ransom virus. Sangfor of fers customers and users free anti-malware software to scan for and remove the virus. Protection The Sangfor Security T eam recommends proactive protection, as there is no way to decrypt the files encrypted by majority of ransom viruses. 1. Fix the vulnerability quickly by installing the corresponding patch on the host. 2. Back up critical data files regularly to other hosts or storage devices. 3. Do not click on any email attachment from unknown sources and do not download any software from untrusted websites. 4. Disable unnecessary file sharing. 5. Strengthen your computer password and do not use the same passwords for multiple computers to avoid compromising a series of computers. 6. Disable RDP if it is unnecessary for your business. When computers are attacked, use Sangfor NGAF or EDR to block port 3389 and stop the virus from spreading. 7. Sangfor NGAF and EDR can prevent brute-force attacks. T urn on brute-force attack prevention on NGAF and enable Rules 1 1080051, 1 1080027 and 1 1080016. T urn on brute- force attack prevention on Sangfor EDR. 8. For Sangfor NGAF customers, update NGAF to version 8.0.5 and enable AI-based Sangfor Engine Zero to achieve the most comprehensive protection. 7 / 79. Deploy Sangfor security products and connect to cloud-based Sangfor Neural-X to detect new threats. 10. Sangfor SOC, featuring AI, is ready to quickly enhance security capabilities. SOC provides services including checks on device security policies, security threats and relevant vulnerabilities to ensure timely risk detection, remediation and prevention, as well as policy update. 11. Perform a security scan and virus removal on the entire network to enhance network security . We recommend Sangfor NGAF and EDR to detect, prevent and protect your internal network."}}

This parses as valid JSON, has what I believe to be a valid number of tokens, and is in the same format as other successful prompts, but I get this response.

{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Parsing terminated before end of input.\n\"}}\n                {\"prompt\": {\"text\": \n                    ^",
    "status": "INVALID_ARGUMENT"
  }
}

Am I missing something here?

I keep getting a strange response when I make an API call to PaLM

Here's my prompt:

{"prompt":{"text":"Using at least 1024 tokens, Tell me about the stock ESPR whose company name is Esperion Therapeutics, Inc.  and list the exactly the following about the stock:\nDetailed Analysis on Business Model and Strategy\nRecent Events\nProduct Launches and products in pipeline\nRegulatory Changes\nMarket Position\nCompetition Analysis\nMergers and Acquisitions\nTechnological Innovations and Disruptions\nStrategic Partnerships and Alliances\nCrisis Events\nIndustry trends and Market Conditions"}}

This is the response I get below:

{
  "filters": [
    {
      "reason": "OTHER"
    }
  ]
}

As you can see it's lacking the candidate in the response. Can someone tell me why this is happening?

web UI not working/running on localhost:5000

Description of the bug:

my host name is Archie, when I run the script with port number 5000 poetry run ./chatbot/launch.sh -p 5000 then when I open localhost:5000 or Archie:5000 it's not running up there

Actual vs expected behavior:

expected to work but it's not even working.

Any other information you'd like to share?

what am seeing on chrome
This site can’t be reachedlocalhost refused to connect. Try: Checking the connection [Checking the proxy and the firewall](chrome-error://chromewebdata/#buttons) ERR_CONNECTION_REFUSED

Error when attempting to speak to character

I now have the API keys installed in the project. I started up the character, activated the mic, and spoke. Nothing happened so I thought the speak recognition still wasn't working. But then I suddenly saw, for just a split second, the words that I had spoken appear in the box under "You." I had said "Hi pup, how are you doing" and that's what showed up in the box. But then, right after that, I got an error screen with this message."

Uncaught Runtime Error

Cannot read properties of undefined (reading 'concat')
Typeerror: Cannot read properties of undefined (reading 'concat')
at send Message (http://localhost:3000/static/js/bundle.js:316:34)

Update examples to take advantage of batched embeddings.

Description of the feature request:

There are several examples that loop over chunks of text and call embed_text on each one.

These should pass lists of chunks to embed_text, and embed text will return lists of vectors.

What problem are you trying to solve with this feature?

No response

Any other information you'd like to share?

No response

How can I create/use my own 3d avatar in talking char demo?

Description of the feature request:

In demo we have 2 models but I want to use different model.
How to create new model from photo ?
How to use it in project

What problem are you trying to solve with this feature?

No response

Any other information you'd like to share?

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.