diff --git a/packages/vertexai/src/methods/chat-session-helpers.ts b/packages/vertexai/src/methods/chat-session-helpers.ts index b797c3071ff..0ac00ad0a1c 100644 --- a/packages/vertexai/src/methods/chat-session-helpers.ts +++ b/packages/vertexai/src/methods/chat-session-helpers.ts @@ -30,13 +30,17 @@ const VALID_PART_FIELDS: Array = [ const VALID_PARTS_PER_ROLE: { [key in Role]: Array } = { user: ['text', 'inlineData'], function: ['functionResponse'], - model: ['text', 'functionCall'] + model: ['text', 'functionCall'], + // System instructions shouldn't be in history anyway. + system: ['text'] }; const VALID_PREVIOUS_CONTENT_ROLES: { [key in Role]: Role[] } = { user: ['model'], function: ['model'], - model: ['user', 'function'] + model: ['user', 'function'], + // System instructions shouldn't be in history. + system: [] }; export function validateChatHistory(history: Content[]): void { diff --git a/packages/vertexai/src/methods/chat-session.ts b/packages/vertexai/src/methods/chat-session.ts index 2f49b1131e7..c685d84908a 100644 --- a/packages/vertexai/src/methods/chat-session.ts +++ b/packages/vertexai/src/methods/chat-session.ts @@ -82,6 +82,8 @@ export class ChatSession { safetySettings: this.params?.safetySettings, generationConfig: this.params?.generationConfig, tools: this.params?.tools, + toolConfig: this.params?.toolConfig, + systemInstruction: this.params?.systemInstruction, contents: [...this._history, newContent] }; let finalResult = {} as GenerateContentResult; @@ -135,6 +137,8 @@ export class ChatSession { safetySettings: this.params?.safetySettings, generationConfig: this.params?.generationConfig, tools: this.params?.tools, + toolConfig: this.params?.toolConfig, + systemInstruction: this.params?.systemInstruction, contents: [...this._history, newContent] }; const streamPromise = generateContentStream( diff --git a/packages/vertexai/src/methods/generate-content.test.ts b/packages/vertexai/src/methods/generate-content.test.ts index 4fdda9e40f8..5503c172c96 100644 --- a/packages/vertexai/src/methods/generate-content.test.ts +++ b/packages/vertexai/src/methods/generate-content.test.ts @@ -24,6 +24,7 @@ import * as request from '../requests/request'; import { generateContent } from './generate-content'; import { GenerateContentRequest, + HarmBlockMethod, HarmBlockThreshold, HarmCategory } from '../types'; @@ -47,7 +48,8 @@ const fakeRequestParams: GenerateContentRequest = { safetySettings: [ { category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, - threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE, + method: HarmBlockMethod.SEVERITY } ] }; diff --git a/packages/vertexai/src/models/generative-model.test.ts b/packages/vertexai/src/models/generative-model.test.ts index 5c930f36fc7..a97b7bfc003 100644 --- a/packages/vertexai/src/models/generative-model.test.ts +++ b/packages/vertexai/src/models/generative-model.test.ts @@ -14,9 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { expect } from 'chai'; +import { use, expect } from 'chai'; import { GenerativeModel } from './generative-model'; -import { VertexAI } from '../public-types'; +import { FunctionCallingMode, VertexAI } from '../public-types'; +import * as request from '../requests/request'; +import { match, restore, stub } from 'sinon'; +import { getMockResponse } from '../../test-utils/mock-response'; +import sinonChai from 'sinon-chai'; + +use(sinonChai); const fakeVertexAI: VertexAI = { app: { @@ -53,4 +59,157 @@ describe('GenerativeModel', () => { }); expect(genModel.model).to.equal('tunedModels/my-model'); }); + it('passes params through to generateContent', async () => { + const genModel = new GenerativeModel(fakeVertexAI, { + model: 'my-model', + tools: [{ functionDeclarations: [{ name: 'myfunc' }] }], + toolConfig: { functionCallingConfig: { mode: FunctionCallingMode.NONE } }, + systemInstruction: { role: 'system', parts: [{ text: 'be friendly' }] } + }); + expect(genModel.tools?.length).to.equal(1); + expect(genModel.toolConfig?.functionCallingConfig.mode).to.equal( + FunctionCallingMode.NONE + ); + expect(genModel.systemInstruction?.parts[0].text).to.equal('be friendly'); + const mockResponse = getMockResponse( + 'unary-success-basic-reply-short.json' + ); + const makeRequestStub = stub(request, 'makeRequest').resolves( + mockResponse as Response + ); + await genModel.generateContent('hello'); + expect(makeRequestStub).to.be.calledWith( + 'publishers/google/models/my-model', + request.Task.GENERATE_CONTENT, + match.any, + false, + match((value: string) => { + return ( + value.includes('myfunc') && + value.includes(FunctionCallingMode.NONE) && + value.includes('be friendly') + ); + }), + {} + ); + restore(); + }); + it('generateContent overrides model values', async () => { + const genModel = new GenerativeModel(fakeVertexAI, { + model: 'my-model', + tools: [{ functionDeclarations: [{ name: 'myfunc' }] }], + toolConfig: { functionCallingConfig: { mode: FunctionCallingMode.NONE } }, + systemInstruction: { role: 'system', parts: [{ text: 'be friendly' }] } + }); + expect(genModel.tools?.length).to.equal(1); + expect(genModel.toolConfig?.functionCallingConfig.mode).to.equal( + FunctionCallingMode.NONE + ); + expect(genModel.systemInstruction?.parts[0].text).to.equal('be friendly'); + const mockResponse = getMockResponse( + 'unary-success-basic-reply-short.json' + ); + const makeRequestStub = stub(request, 'makeRequest').resolves( + mockResponse as Response + ); + await genModel.generateContent({ + contents: [{ role: 'user', parts: [{ text: 'hello' }] }], + tools: [{ functionDeclarations: [{ name: 'otherfunc' }] }], + toolConfig: { functionCallingConfig: { mode: FunctionCallingMode.AUTO } }, + systemInstruction: { role: 'system', parts: [{ text: 'be formal' }] } + }); + expect(makeRequestStub).to.be.calledWith( + 'publishers/google/models/my-model', + request.Task.GENERATE_CONTENT, + match.any, + false, + match((value: string) => { + return ( + value.includes('otherfunc') && + value.includes(FunctionCallingMode.AUTO) && + value.includes('be formal') + ); + }), + {} + ); + restore(); + }); + it('passes params through to chat.sendMessage', async () => { + const genModel = new GenerativeModel(fakeVertexAI, { + model: 'my-model', + tools: [{ functionDeclarations: [{ name: 'myfunc' }] }], + toolConfig: { functionCallingConfig: { mode: FunctionCallingMode.NONE } }, + systemInstruction: { role: 'system', parts: [{ text: 'be friendly' }] } + }); + expect(genModel.tools?.length).to.equal(1); + expect(genModel.toolConfig?.functionCallingConfig.mode).to.equal( + FunctionCallingMode.NONE + ); + expect(genModel.systemInstruction?.parts[0].text).to.equal('be friendly'); + const mockResponse = getMockResponse( + 'unary-success-basic-reply-short.json' + ); + const makeRequestStub = stub(request, 'makeRequest').resolves( + mockResponse as Response + ); + await genModel.startChat().sendMessage('hello'); + expect(makeRequestStub).to.be.calledWith( + 'publishers/google/models/my-model', + request.Task.GENERATE_CONTENT, + match.any, + false, + match((value: string) => { + return ( + value.includes('myfunc') && + value.includes(FunctionCallingMode.NONE) && + value.includes('be friendly') + ); + }), + {} + ); + restore(); + }); + it('startChat overrides model values', async () => { + const genModel = new GenerativeModel(fakeVertexAI, { + model: 'my-model', + tools: [{ functionDeclarations: [{ name: 'myfunc' }] }], + toolConfig: { functionCallingConfig: { mode: FunctionCallingMode.NONE } }, + systemInstruction: { role: 'system', parts: [{ text: 'be friendly' }] } + }); + expect(genModel.tools?.length).to.equal(1); + expect(genModel.toolConfig?.functionCallingConfig.mode).to.equal( + FunctionCallingMode.NONE + ); + expect(genModel.systemInstruction?.parts[0].text).to.equal('be friendly'); + const mockResponse = getMockResponse( + 'unary-success-basic-reply-short.json' + ); + const makeRequestStub = stub(request, 'makeRequest').resolves( + mockResponse as Response + ); + await genModel + .startChat({ + tools: [{ functionDeclarations: [{ name: 'otherfunc' }] }], + toolConfig: { + functionCallingConfig: { mode: FunctionCallingMode.AUTO } + }, + systemInstruction: { role: 'system', parts: [{ text: 'be formal' }] } + }) + .sendMessage('hello'); + expect(makeRequestStub).to.be.calledWith( + 'publishers/google/models/my-model', + request.Task.GENERATE_CONTENT, + match.any, + false, + match((value: string) => { + return ( + value.includes('otherfunc') && + value.includes(FunctionCallingMode.AUTO) && + value.includes('be formal') + ); + }), + {} + ); + restore(); + }); }); diff --git a/packages/vertexai/src/models/generative-model.ts b/packages/vertexai/src/models/generative-model.ts index 04f30036365..eec3297de9f 100644 --- a/packages/vertexai/src/models/generative-model.ts +++ b/packages/vertexai/src/models/generative-model.ts @@ -20,6 +20,7 @@ import { generateContentStream } from '../methods/generate-content'; import { + Content, CountTokensRequest, CountTokensResponse, GenerateContentRequest, @@ -31,7 +32,8 @@ import { RequestOptions, SafetySetting, StartChatParams, - Tool + Tool, + ToolConfig } from '../types'; import { ChatSession } from '../methods/chat-session'; import { countTokens } from '../methods/count-tokens'; @@ -52,6 +54,8 @@ export class GenerativeModel { safetySettings: SafetySetting[]; requestOptions?: RequestOptions; tools?: Tool[]; + toolConfig?: ToolConfig; + systemInstruction?: Content; constructor( vertexAI: VertexAI, @@ -88,6 +92,8 @@ export class GenerativeModel { this.generationConfig = modelParams.generationConfig || {}; this.safetySettings = modelParams.safetySettings || []; this.tools = modelParams.tools; + this.toolConfig = modelParams.toolConfig; + this.systemInstruction = modelParams.systemInstruction; this.requestOptions = requestOptions || {}; } @@ -106,6 +112,8 @@ export class GenerativeModel { generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, + toolConfig: this.toolConfig, + systemInstruction: this.systemInstruction, ...formattedParams }, this.requestOptions @@ -129,6 +137,8 @@ export class GenerativeModel { generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, + toolConfig: this.toolConfig, + systemInstruction: this.systemInstruction, ...formattedParams }, this.requestOptions @@ -145,6 +155,8 @@ export class GenerativeModel { this.model, { tools: this.tools, + toolConfig: this.toolConfig, + systemInstruction: this.systemInstruction, ...startChatParams }, this.requestOptions diff --git a/packages/vertexai/src/types/enums.ts b/packages/vertexai/src/types/enums.ts index 817450a069b..2f3f655e8f0 100644 --- a/packages/vertexai/src/types/enums.ts +++ b/packages/vertexai/src/types/enums.ts @@ -25,7 +25,7 @@ export type Role = (typeof POSSIBLE_ROLES)[number]; * Possible roles. * @public */ -export const POSSIBLE_ROLES = ['user', 'model', 'function'] as const; +export const POSSIBLE_ROLES = ['user', 'model', 'function', 'system'] as const; /** * Harm categories that would cause prompts or candidates to be blocked. @@ -133,3 +133,22 @@ export enum FinishReason { // Unknown reason. OTHER = 'OTHER' } + +/** + * @public + */ +export enum FunctionCallingMode { + // Unspecified function calling mode. This value should not be used. + MODE_UNSPECIFIED = 'MODE_UNSPECIFIED', + // Default model behavior, model decides to predict either a function call + // or a natural language repspose. + AUTO = 'AUTO', + // Model is constrained to always predicting a function call only. + // If "allowed_function_names" is set, the predicted function call will be + // limited to any one of "allowed_function_names", else the predicted + // function call will be any one of the provided "function_declarations". + ANY = 'ANY', + // Model will not predict any function call. Model behavior is same as when + // not passing any function declarations. + NONE = 'NONE' +} diff --git a/packages/vertexai/src/types/requests.ts b/packages/vertexai/src/types/requests.ts index 7083341c1cd..aa1e5bafa10 100644 --- a/packages/vertexai/src/types/requests.ts +++ b/packages/vertexai/src/types/requests.ts @@ -16,7 +16,12 @@ */ import { Content } from './content'; -import { HarmBlockMethod, HarmBlockThreshold, HarmCategory } from './enums'; +import { + FunctionCallingMode, + HarmBlockMethod, + HarmBlockThreshold, + HarmCategory +} from './enums'; /** * Base parameters for a number of methods. @@ -34,6 +39,8 @@ export interface BaseParams { export interface ModelParams extends BaseParams { model: string; tools?: Tool[]; + toolConfig?: ToolConfig; + systemInstruction?: Content; } /** @@ -43,6 +50,8 @@ export interface ModelParams extends BaseParams { export interface GenerateContentRequest extends BaseParams { contents: Content[]; tools?: Tool[]; + toolConfig?: ToolConfig; + systemInstruction?: Content; } /** @@ -77,6 +86,8 @@ export interface GenerationConfig { export interface StartChatParams extends BaseParams { history?: Content[]; tools?: Tool[]; + toolConfig?: ToolConfig; + systemInstruction?: Content; } /** @@ -220,3 +231,19 @@ export interface FunctionDeclarationSchemaProperty { /** Optional. The example of the property. */ example?: unknown; } + +/** + * Tool config. This config is shared for all tools provided in the request. + * @public + */ +export interface ToolConfig { + functionCallingConfig: FunctionCallingConfig; +} + +/** + * @public + */ +export interface FunctionCallingConfig { + mode?: FunctionCallingMode; + allowedFunctionNames?: string[]; +} diff --git a/packages/vertexai/test-utils/mocks-lookup.ts b/packages/vertexai/test-utils/mocks-lookup.ts deleted file mode 100644 index 4dd8a5963d4..00000000000 --- a/packages/vertexai/test-utils/mocks-lookup.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @license - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Generated from mocks text files. - -export const mocksLookup: Record = { - 'streaming-failure-empty-content.txt': - 'data: {"candidates": [{"content": {},"index": 0}],"promptFeedback": {"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}}\r\n\r\n', - 'streaming-failure-finish-reason-safety.txt': - 'data: {"candidates": [{"content": {"parts": [{"text": "No"}]},"finishReason": "SAFETY","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "HIGH"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}],"promptFeedback": {"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}}\r\n\r\n', - 'streaming-failure-prompt-blocked-safety.txt': - 'data: {"promptFeedback": {"blockReason": "SAFETY","safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "HIGH"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}}\r\n\r\n', - 'streaming-failure-recitation-no-content.txt': - 'data: {"candidates": [{"content": {"parts": [{"text": "Copyrighted text goes here"}],"role": "model"},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}],"promptFeedback": {"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": "More copyrighted text"}],"role": "model"},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "LOW"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}],"citationMetadata": {"citations": [{"startIndex": 30,"endIndex": 179,"uri": "https://www.example.com","license": ""}]}}]}\r\n\r\ndata: {"candidates": [{"finishReason": "RECITATION","index": 0}]}\r\n\r\n', - 'streaming-success-basic-reply-long.txt': - 'data: {"candidates": [{"content": {"parts": [{"text": "**Cats:**\\n\\n- **Physical Characteristics:**\\n - Size: Cats come"}]},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}],"promptFeedback": {"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": " in a wide range of sizes, from small breeds like the Singapura to large breeds like the Maine Coon.\\n - Fur: Cats have soft, furry coats"}]},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}]}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": " that can vary in length and texture depending on the breed.\\n - Eyes: Cats have large, expressive eyes that can be various colors, including green, blue, yellow, and hazel.\\n - Ears: Cats have pointed, erect ears that are sensitive to sound.\\n - Tail: Cats have long"}]},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}]}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": ", flexible tails that they use for balance and communication.\\n\\n- **Behavior and Personality:**\\n - Independent: Cats are often described as independent animals that enjoy spending time alone.\\n - Affectionate: Despite their independent nature, cats can be very affectionate and form strong bonds with their owners.\\n - Playful: Cats are naturally playful and enjoy engaging in activities such as chasing toys, climbing, and pouncing.\\n - Curious: Cats are curious creatures that love to explore their surroundings.\\n - Vocal: Cats communicate through a variety of vocalizations, including meows, purrs, hisses, and grow"}]},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}]}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": "ls.\\n\\n- **Health and Care:**\\n - Diet: Cats are obligate carnivores, meaning they require animal-based protein for optimal health.\\n - Grooming: Cats spend a significant amount of time grooming themselves to keep their fur clean and free of mats.\\n - Exercise: Cats need regular exercise to stay healthy and active. This can be achieved through play sessions or access to outdoor space.\\n - Veterinary Care: Regular veterinary checkups are essential for maintaining a cat\'s health and detecting any potential health issues early on.\\n\\n**Dogs:**\\n\\n- **Physical Characteristics:**\\n - Size: Dogs come in a wide range of sizes, from small breeds like the Chihuahua to giant breeds like the Great Dane.\\n - Fur: Dogs have fur coats that can vary in length, texture, and color depending on the breed.\\n - Eyes: Dogs have expressive eyes that can be various colors, including brown, blue, green, and hazel.\\n - Ears: Dogs have floppy or erect ears that are sensitive to sound.\\n - Tail: Dogs have long, wagging tails that they use for communication and expressing emotions.\\n\\n- **Behavior and Personality:**\\n - Loyal: Dogs are known for their loyalty and"}]},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}]}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": " devotion to their owners.\\n - Friendly: Dogs are generally friendly and outgoing animals that enjoy interacting with people and other animals.\\n - Playful: Dogs are playful and energetic creatures that love to engage in activities such as fetching, running, and playing with toys.\\n - Trainable: Dogs are highly trainable and can learn a variety of commands and tricks.\\n - Vocal: Dogs communicate through a variety of vocalizations, including barking, howling, whining, and growling.\\n\\n- **Health and Care:**\\n - Diet: Dogs are omnivores and can eat a variety of foods, including meat, vegetables, and grains.\\n - Grooming: Dogs require regular grooming to keep their fur clean and free of mats. The frequency of grooming depends on the breed and coat type.\\n - Exercise: Dogs need regular exercise to stay healthy and active. The amount of exercise required varies depending on the breed and age of the dog.\\n - Veterinary Care: Regular veterinary checkups are essential for maintaining a dog\'s health and detecting any potential health issues early on."}]},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}]}\r\n\r\n', - 'streaming-success-basic-reply-short.txt': - 'data: {"candidates": [{"content": {"parts": [{"text": "Cheyenne"}]},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}],"promptFeedback": {"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}}\r\n\r\n', - 'streaming-success-citations.txt': - 'data: {"candidates": [{"content": {"parts": [{"text": "1. **Definition:**\\nQuantum mechanics is a fundamental theory in physics that provides"}],"role": "model"},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}],"promptFeedback": {"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": " the foundation for understanding the physical properties of nature at the scale of atoms and subatomic particles. It is based on the idea that energy, momentum, angular momentum"}],"role": "model"},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}]}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": ", and other quantities are quantized, meaning they can exist only in discrete values. \\n\\n2. **Key Concepts:**\\n - **Wave-particle Duality:** Particles such as electrons and photons can exhibit both wave-like and particle-like behaviors. \\n - **Uncertainty Principle:** Proposed by Werner"}],"role": "model"},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}]}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": " Heisenberg, it states that the more precisely the position of a particle is known, the less precisely its momentum can be known, and vice versa. \\n - **Superposition:** A quantum system can exist in multiple states simultaneously until it is observed or measured, at which point it \\"collapses\\" into a single state.\\n - **Quantum Entanglement:** Two or more particles can become correlated in such a way that the state of one particle cannot be described independently of the other, even when they are separated by large distances. \\n\\n3. **Applications:**\\n - **Quantum Computing:** It explores the use of quantum"}],"role": "model"},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}],"citationMetadata": {"citations": [{"startIndex": 574,"endIndex": 705,"uri": "https://www.example.com","license": ""},{"startIndex": 899,"endIndex": 1026,"uri": "https://www.example.com","license": ""}]}}]}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": "-mechanical phenomena to perform complex calculations and solve problems that are intractable for classical computers. \\n - **Quantum Cryptography:** Utilizes the principles of quantum mechanics to develop secure communication channels. \\n - **Quantum Imaging:** Employs quantum effects to enhance the resolution and sensitivity of imaging techniques in fields such as microscopy and medical imaging. \\n - **Quantum Sensors:** Leverages quantum properties to develop highly sensitive sensors for detecting magnetic fields, accelerations, and other physical quantities. \\n\\n4. **Learning Resources:**\\n - **Books:**\\n - \\"Quantum Mechanics for Mathematicians\\" by James Glimm and Arthur Jaffe\\n - \\"Principles of Quantum Mechanics\\" by R. Shankar\\n - \\"Quantum Mechanics: Concepts and Applications\\" by Nouredine Zettili\\n - **Online Courses:**\\n - \\"Quantum Mechanics I\\" by MIT OpenCourseWare\\n - \\"Quantum Mechanics for Everyone\\" by Coursera\\n - \\"Quantum Mechanics\\" by Stanford Online\\n - **Documentaries and Videos:**\\n - \\"Quantum Mechanics: The Strangest Theory\\" (BBC Documentary)\\n - \\"Quantum Mechanics Explained Simply\\" by Veritasium (YouTube Channel)\\n - \\"What is Quantum Mechanics?\\" by Minute"}],"role": "model"},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}],"citationMetadata": {"citations": [{"startIndex": 574,"endIndex": 705,"uri": "https://www.example.com","license": ""},{"startIndex": 899,"endIndex": 1026,"uri": "https://www.example.com","license": ""}]}}]}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": "Physics (YouTube Channel)"}],"role": "model"},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}],"citationMetadata": {"citations": [{"startIndex": 574,"endIndex": 705,"uri": "https://www.example.com","license": ""},{"startIndex": 899,"endIndex": 1026,"uri": "https://www.example.com","license": ""}]}}]}\r\n\r\n', - 'streaming-success-function-call-short.txt': - 'data: {"candidates": [{"content": {"parts": [{ "functionCall": { "name": "getTemperature", "args": { "city": "San Jose" } } }]}, "finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}],"promptFeedback": {"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}}\r\n\r\n', - 'streaming-success-utf8.txt': - 'data: { "candidates": [ { "content": { "parts": [ { "text": "秋风瑟瑟,叶落纷纷,\\n西风残照,寒" } ], "role": "model" }, "finishReason": "STOP", "index": 0, "safetyRatings": [ { "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_HATE_SPEECH", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_HARASSMENT", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "probability": "NEGLIGIBLE" } ] } ], "promptFeedback": { "safetyRatings": [ { "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_HATE_SPEECH", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_HARASSMENT", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "probability": "NEGLIGIBLE" } ] } }\r\n\r\ndata: { "candidates": [ { "content": { "parts": [ { "text": "霜渐浓。\\n枫叶红了,菊花黄了,\\n秋雨绵绵,秋意浓浓。\\n\\n秋夜漫漫,思" } ], "role": "model" }, "finishReason": "STOP", "index": 0, "safetyRatings": [ { "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_HATE_SPEECH", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_HARASSMENT", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "probability": "NEGLIGIBLE" } ] } ] }\r\n\r\ndata: { "candidates": [ { "content": { "parts": [ { "text": "绪万千,\\n明月当空,星星眨眼。\\n思念远方的亲人,\\n祝愿他们幸福安康。\\n\\n秋天是收获的季节,\\n人们忙着收割庄稼,\\n为一年的辛劳画上圆满的句号。\\n秋天也是团圆的季节" } ], "role": "model" }, "finishReason": "STOP", "index": 0, "safetyRatings": [ { "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_HATE_SPEECH", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_HARASSMENT", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "probability": "NEGLIGIBLE" } ] } ] }\r\n\r\ndata: { "candidates": [ { "content": { "parts": [ { "text": ",\\n一家人围坐在一起,\\n分享丰收的喜悦,共度美好时光。\\n\\n秋天是一个美丽的季节,\\n它有着独特的韵味,\\n让人沉醉其中,流连忘返。\\n让我们一起欣赏秋天的美景,\\n感受秋天的气息,领悟秋天的哲理。" } ], "role": "model" }, "finishReason": "STOP", "index": 0, "safetyRatings": [ { "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_HATE_SPEECH", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_HARASSMENT", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "probability": "NEGLIGIBLE" } ] } ] }\r\n\r\n', - 'streaming-unknown-enum.txt': - 'data: {"candidates": [{"content": {"parts": [{"text": "**Cats:**\\n\\n- **Physical Characteristics:**\\n - Size: Cats come"}]},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}],"promptFeedback": {"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": " in a wide range of sizes, from small breeds like the Singapura to large breeds like the Maine Coon.\\n - Fur: Cats have soft, furry coats"}]},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}]}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": " that can vary in length and texture depending on the breed.\\n - Eyes: Cats have large, expressive eyes that can be various colors, including green, blue, yellow, and hazel.\\n - Ears: Cats have pointed, erect ears that are sensitive to sound.\\n - Tail: Cats have long"}]},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}]}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": ", flexible tails that they use for balance and communication.\\n\\n- **Behavior and Personality:**\\n - Independent: Cats are often described as independent animals that enjoy spending time alone.\\n - Affectionate: Despite their independent nature, cats can be very affectionate and form strong bonds with their owners.\\n - Playful: Cats are naturally playful and enjoy engaging in activities such as chasing toys, climbing, and pouncing.\\n - Curious: Cats are curious creatures that love to explore their surroundings.\\n - Vocal: Cats communicate through a variety of vocalizations, including meows, purrs, hisses, and grow"}]},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}]}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": "ls.\\n\\n- **Health and Care:**\\n - Diet: Cats are obligate carnivores, meaning they require animal-based protein for optimal health.\\n - Grooming: Cats spend a significant amount of time grooming themselves to keep their fur clean and free of mats.\\n - Exercise: Cats need regular exercise to stay healthy and active. This can be achieved through play sessions or access to outdoor space.\\n - Veterinary Care: Regular veterinary checkups are essential for maintaining a cat\'s health and detecting any potential health issues early on.\\n\\n**Dogs:**\\n\\n- **Physical Characteristics:**\\n - Size: Dogs come in a wide range of sizes, from small breeds like the Chihuahua to giant breeds like the Great Dane.\\n - Fur: Dogs have fur coats that can vary in length, texture, and color depending on the breed.\\n - Eyes: Dogs have expressive eyes that can be various colors, including brown, blue, green, and hazel.\\n - Ears: Dogs have floppy or erect ears that are sensitive to sound.\\n - Tail: Dogs have long, wagging tails that they use for communication and expressing emotions.\\n\\n- **Behavior and Personality:**\\n - Loyal: Dogs are known for their loyalty and"}]},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}]}\r\n\r\ndata: {"candidates": [{"content": {"parts": [{"text": " devotion to their owners.\\n - Friendly: Dogs are generally friendly and outgoing animals that enjoy interacting with people and other animals.\\n - Playful: Dogs are playful and energetic creatures that love to engage in activities such as fetching, running, and playing with toys.\\n - Trainable: Dogs are highly trainable and can learn a variety of commands and tricks.\\n - Vocal: Dogs communicate through a variety of vocalizations, including barking, howling, whining, and growling.\\n\\n- **Health and Care:**\\n - Diet: Dogs are omnivores and can eat a variety of foods, including meat, vegetables, and grains.\\n - Grooming: Dogs require regular grooming to keep their fur clean and free of mats. The frequency of grooming depends on the breed and coat type.\\n - Exercise: Dogs need regular exercise to stay healthy and active. The amount of exercise required varies depending on the breed and age of the dog.\\n - Veterinary Care: Regular veterinary checkups are essential for maintaining a dog\'s health and detecting any potential health issues early on."}]},"finishReason": "FAKE_ENUM","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT_NEW_ENUM","probability": "NEGLIGIBLE_UNKNOWN_ENUM"}]}]}\r\n\r\n', - 'unary-failure-empty-content.json': - '{\n "candidates": [\n {\n "content": {},\n "index": 0\n }\n ],\n "promptFeedback": {\n "safetyRatings": [\n {\n "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HATE_SPEECH",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HARASSMENT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_DANGEROUS_CONTENT",\n "probability": "NEGLIGIBLE"\n }\n ]\n }\n}\n', - 'unary-failure-finish-reason-safety.json': - '{\n "candidates": [\n {\n "content": {\n "parts": [\n {\n "text": "No"\n }\n ]\n },\n "finishReason": "SAFETY",\n "index": 0,\n "safetyRatings": [\n {\n "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HATE_SPEECH",\n "probability": "HIGH"\n },\n {\n "category": "HARM_CATEGORY_HARASSMENT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_DANGEROUS_CONTENT",\n "probability": "NEGLIGIBLE"\n }\n ]\n }\n ],\n "promptFeedback": {\n "safetyRatings": [\n {\n "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HATE_SPEECH",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HARASSMENT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_DANGEROUS_CONTENT",\n "probability": "NEGLIGIBLE"\n }\n ]\n }\n}\n', - 'unary-failure-image-rejected.json': - '{\n "error": {\n "code": 400,\n "message": "Request contains an invalid argument.",\n "status": "INVALID_ARGUMENT",\n "details": [\n {\n "@type": "type.googleapis.com/google.rpc.DebugInfo",\n "detail": "[ORIGINAL ERROR] generic::invalid_argument: invalid status photos.thumbnailer.Status.Code::5: Source image 0 too short"\n }\n ]\n }\n}\n', - 'unary-failure-prompt-blocked-safety.json': - '{\n "promptFeedback": {\n "blockReason": "SAFETY",\n "safetyRatings": [\n {\n "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HATE_SPEECH",\n "probability": "HIGH"\n },\n {\n "category": "HARM_CATEGORY_HARASSMENT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_DANGEROUS_CONTENT",\n "probability": "NEGLIGIBLE"\n }\n ]\n }\n}\n', - 'unary-success-basic-reply-long.json': - '{\n "candidates": [\n {\n "content": {\n "parts": [\n {\n "text": "1. **Use Freshly Ground Coffee**:\\n - Grind your coffee beans just before brewing to preserve their flavor and aroma.\\n - Use a burr grinder for a consistent grind size.\\n\\n\\n2. **Choose the Right Water**:\\n - Use filtered or spring water for the best taste.\\n - Avoid using tap water, as it may contain impurities that can affect the flavor.\\n\\n\\n3. **Measure Accurately**:\\n - Use a kitchen scale to measure your coffee and water precisely.\\n - A general rule of thumb is to use 1:16 ratio of coffee to water (e.g., 15 grams of coffee to 240 grams of water).\\n\\n\\n4. **Preheat Your Equipment**:\\n - Preheat your coffee maker or espresso machine before brewing to ensure a consistent temperature.\\n\\n\\n5. **Control the Water Temperature**:\\n - The ideal water temperature for brewing coffee is between 195°F (90°C) and 205°F (96°C).\\n - Too hot water can extract bitter flavors, while too cold water won\'t extract enough flavor.\\n\\n\\n6. **Steep the Coffee**:\\n - For drip coffee, let the water slowly drip through the coffee grounds for optimal extraction.\\n - For pour-over coffee, pour the water in a circular motion over the coffee grounds, allowing it to steep for 30-45 seconds before continuing.\\n\\n\\n7. **Clean Your Equipment**:\\n - Regularly clean your coffee maker or espresso machine to prevent the buildup of oils and residue that can affect the taste of your coffee.\\n\\n\\n8. **Experiment with Different Coffee Beans**:\\n - Try different coffee beans from various regions and roasts to find your preferred flavor profile.\\n - Experiment with different grind sizes and brewing methods to optimize the flavor of your chosen beans.\\n\\n\\n9. **Store Coffee Properly**:\\n - Store your coffee beans in an airtight container in a cool, dark place to preserve their freshness and flavor.\\n - Avoid storing coffee in the refrigerator or freezer, as this can cause condensation and affect the taste.\\n\\n\\n10. **Enjoy Freshly Brewed Coffee**:\\n - Drink your coffee as soon as possible after brewing to enjoy its peak flavor and aroma.\\n - Coffee starts to lose its flavor and aroma within 30 minutes of brewing."\n }\n ]\n },\n "index": 0,\n "safetyRatings": [\n {\n "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HATE_SPEECH",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HARASSMENT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_DANGEROUS_CONTENT",\n "probability": "NEGLIGIBLE"\n }\n ]\n }\n ],\n "promptFeedback": {\n "safetyRatings": [\n {\n "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HATE_SPEECH",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HARASSMENT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_DANGEROUS_CONTENT",\n "probability": "NEGLIGIBLE"\n }\n ]\n }\n}\n', - 'unary-success-basic-reply-short.json': - '{\n "candidates": [\n {\n "content": {\n "parts": [\n {\n "text": "Helena"\n }\n ]\n },\n "index": 0,\n "safetyRatings": [\n {\n "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HATE_SPEECH",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HARASSMENT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_DANGEROUS_CONTENT",\n "probability": "NEGLIGIBLE"\n }\n ]\n }\n ],\n "promptFeedback": {\n "safetyRatings": [\n {\n "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HATE_SPEECH",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HARASSMENT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_DANGEROUS_CONTENT",\n "probability": "NEGLIGIBLE"\n }\n ]\n }\n}\n', - 'unary-success-citations.json': - '{\n "candidates": [\n {\n "content": {\n "parts": [\n {\n "text": "1. **Definition:**\\nQuantum mechanics is a fundamental theory in physics that provides the foundation for understanding the physical properties of nature at the scale of atoms and subatomic particles. It is based on the idea that energy, momentum, angular momentum, and other quantities are quantized, meaning they can only exist in discrete values. \\n\\n2. **Key Concepts:**\\n - **Wave-particle Duality:** Particles such as electrons and photons can exhibit both wave-like and particle-like behaviors. \\n - **Uncertainty Principle:** Proposed by Werner Heisenberg, it states that the more precisely the position of a particle is known, the less precisely its momentum can be known, and vice versa. \\n - **Quantum Superposition:** A quantum system can exist in multiple states simultaneously until it is measured. \\n - **Quantum Entanglement:** Two or more particles can become linked in such a way that the state of one affects the state of the others, regardless of the distance between them. \\n\\n3. **Implications and Applications:**\\n - **Atomic and Molecular Structure:** Quantum mechanics explains the structure of atoms, molecules, and chemical bonds. \\n - **Quantum Computing:** It enables the development of quantum computers that can solve certain computational problems much faster than classical computers. \\n - **Quantum Cryptography:** Quantum principles are used to develop secure communication methods. \\n - **Quantum Field Theory (QFT):** A relativistic theory that describes interactions between particles in quantum mechanics. It underpins the Standard Model of Physics. \\n - **Quantum Gravity:** Attempts to reconcile quantum mechanics with general relativity to explain the behavior of matter and gravity at very small scales. \\n\\n4. **Learning Resources:**\\n - **Books:**\\n - \\"Quantum Mechanics for Mathematicians\\" by James Glimm and Arthur Jaffe \\n - \\"Principles of Quantum Mechanics\\" by R. Shankar\\n - \\"Quantum Mechanics: Concepts and Applications\\" by Nouredine Zettili \\n - **Online Courses and Tutorials:**\\n - [Quantum Mechanics I](https://www.example.com) on Coursera\\n - [MIT OpenCourseWare](https://www.example.com) Quantum Physics I course materials \\n - [Khan Academy](https://www.example.com) Quantum Physics video tutorials \\n - **Videos and Documentaries:**\\n - [Quantum Mechanics - Crash Course Physics](https://www.example.com)\\n - [Quantum Mechanics: The Strangest Theory](https://www.example.com)\\n - [BBC: The Quantum World with Jim Al-Khalili](https://www.example.com)\\n - [NOVA: The Fabric of the Cosmos](https://www.example.com)"\n }\n ],\n "role": "model"\n },\n "finishReason": "STOP",\n "index": 0,\n "safetyRatings": [\n {\n "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HATE_SPEECH",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HARASSMENT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_DANGEROUS_CONTENT",\n "probability": "NEGLIGIBLE"\n }\n ],\n "citationMetadata": {\n "citations": [\n {\n "startIndex": 574,\n "endIndex": 705,\n "uri": "https://www.example.com",\n "license": ""\n }\n ]\n }\n }\n ],\n "promptFeedback": {\n "safetyRatings": [\n {\n "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HATE_SPEECH",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HARASSMENT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_DANGEROUS_CONTENT",\n "probability": "NEGLIGIBLE"\n }\n ]\n }\n}\n', - 'unary-unknown-enum.json': - '{\n "candidates": [\n {\n "content": {\n "parts": [\n {\n "text": "1. **Use Freshly Ground Coffee**:\\n - Grind your coffee beans just before brewing to preserve their flavor and aroma.\\n - Use a burr grinder for a consistent grind size.\\n\\n\\n2. **Choose the Right Water**:\\n - Use filtered or spring water for the best taste.\\n - Avoid using tap water, as it may contain impurities that can affect the flavor.\\n\\n\\n3. **Measure Accurately**:\\n - Use a kitchen scale to measure your coffee and water precisely.\\n - A general rule of thumb is to use 1:16 ratio of coffee to water (e.g., 15 grams of coffee to 240 grams of water).\\n\\n\\n4. **Preheat Your Equipment**:\\n - Preheat your coffee maker or espresso machine before brewing to ensure a consistent temperature.\\n\\n\\n5. **Control the Water Temperature**:\\n - The ideal water temperature for brewing coffee is between 195°F (90°C) and 205°F (96°C).\\n - Too hot water can extract bitter flavors, while too cold water won\'t extract enough flavor.\\n\\n\\n6. **Steep the Coffee**:\\n - For drip coffee, let the water slowly drip through the coffee grounds for optimal extraction.\\n - For pour-over coffee, pour the water in a circular motion over the coffee grounds, allowing it to steep for 30-45 seconds before continuing.\\n\\n\\n7. **Clean Your Equipment**:\\n - Regularly clean your coffee maker or espresso machine to prevent the buildup of oils and residue that can affect the taste of your coffee.\\n\\n\\n8. **Experiment with Different Coffee Beans**:\\n - Try different coffee beans from various regions and roasts to find your preferred flavor profile.\\n - Experiment with different grind sizes and brewing methods to optimize the flavor of your chosen beans.\\n\\n\\n9. **Store Coffee Properly**:\\n - Store your coffee beans in an airtight container in a cool, dark place to preserve their freshness and flavor.\\n - Avoid storing coffee in the refrigerator or freezer, as this can cause condensation and affect the taste.\\n\\n\\n10. **Enjoy Freshly Brewed Coffee**:\\n - Drink your coffee as soon as possible after brewing to enjoy its peak flavor and aroma.\\n - Coffee starts to lose its flavor and aroma within 30 minutes of brewing."\n }\n ]\n },\n "index": 0,\n "safetyRatings": [\n {\n "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT_ENUM_NEW",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HATE_SPEECH",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HARASSMENT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_DANGEROUS_CONTENT",\n "probability": "NEGLIGIBLE"\n }\n ]\n }\n ],\n "promptFeedback": {\n "safetyRatings": [\n {\n "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HATE_SPEECH",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_HARASSMENT",\n "probability": "NEGLIGIBLE"\n },\n {\n "category": "HARM_CATEGORY_DANGEROUS_CONTENT_LIKE_A_NEW_ENUM",\n "probability": "NEGLIGIBLE_NEW_ENUM"\n }\n ]\n }\n}\n' -};