Google PaLM (Independent Publisher) (#3032)
* Create readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Update readme.md * Add files via upload * Update readme.md * Update readme.md * Delete independent-publisher-connectors/Google PaLM/apiProperties.json * Delete independent-publisher-connectors/Google PaLM/apiDefinition.swagger.json * Add files via upload * Update readme.md * Update readme.md * Update readme.md
This commit is contained in:
Родитель
6a8d5e4598
Коммит
5290188cf7
|
@ -0,0 +1,625 @@
|
|||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"version": "1.0",
|
||||
"title": "Google PaLM",
|
||||
"description": "Google Palm offers advanced text generation and manipulation capabilities",
|
||||
"contact": {
|
||||
"name": "Priyaranjan KS",
|
||||
"url": "https://www.tcs.com/",
|
||||
"email": "Priyaranjan.Sathyavrathan@tcs.com"
|
||||
}
|
||||
},
|
||||
"x-ms-connector-metadata": [
|
||||
{
|
||||
"propertyName": "Website",
|
||||
"propertyValue": "https://ai.google/discover/palm2/"
|
||||
},
|
||||
{
|
||||
"propertyName": "Privacy policy",
|
||||
"propertyValue": "https://policies.google.com/privacy?hl=en"
|
||||
},
|
||||
{
|
||||
"propertyName": "Categories",
|
||||
"propertyValue": "AI"
|
||||
}
|
||||
],
|
||||
"host": "generativelanguage.googleapis.com",
|
||||
"basePath": "/",
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"securityDefinitions": {
|
||||
"API Key": {
|
||||
"type": "apiKey",
|
||||
"in": "query",
|
||||
"name": "key"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"API Key": []
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/{APIVersion}/models": {
|
||||
"get": {
|
||||
"summary": "List Models",
|
||||
"description": "Retrieves the list of available models.",
|
||||
"operationId": "ListModels",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "APIVersion",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "Required.API version to use for the endpoint. Examples:v1beta2,v1beta3.",
|
||||
"x-ms-summary": "API Version",
|
||||
"x-ms-url-encoding": "single"
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "pageSize",
|
||||
"type": "integer",
|
||||
"description": "Optional.The maximum number of Models to return (per page).",
|
||||
"x-ms-summary": "Page Size"
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "pageToken",
|
||||
"type": "string",
|
||||
"description": "Optional.A page token, received from a previous models.list call.",
|
||||
"x-ms-summary": "Page Token"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad request"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
},
|
||||
"404": {
|
||||
"description": "Not found"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/{APIVersion}/models/{name}": {
|
||||
"get": {
|
||||
"summary": "Get Model",
|
||||
"description": "Retrieves the details of a specific model.",
|
||||
"operationId": "GetModel",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "APIVersion",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "Required.API version to use for the endpoint. Examples:v1beta2,v1beta3.",
|
||||
"x-ms-summary": "API Version",
|
||||
"x-ms-url-encoding": "single"
|
||||
},
|
||||
{
|
||||
"in": "path",
|
||||
"name": "name",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-ms-url-encoding": "single",
|
||||
"description": "Required. The resource name of the model. Eg: text-bison-001,chat-bison-001",
|
||||
"x-ms-summary": "Model Name"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/{APIVersion}/{modelType}/{modelName}:generateText": {
|
||||
"post": {
|
||||
"summary": "Generate Text",
|
||||
"description": "Generates text based on a provided prompt, with optional constraints like safety settings and stop sequences.",
|
||||
"operationId": "GenerateText",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "APIVersion",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "Required.API version to use for the endpoint. Examples:v1beta2,v1beta3.",
|
||||
"x-ms-summary": "API Version",
|
||||
"x-ms-url-encoding": "single"
|
||||
},
|
||||
{
|
||||
"in": "path",
|
||||
"name": "modelType",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-ms-url-encoding": "single",
|
||||
"description": "Required. The type of the model to use for text generation. Examples: 'models', 'tunedModels'.",
|
||||
"x-ms-summary": "Model Type"
|
||||
},
|
||||
{
|
||||
"in": "path",
|
||||
"name": "modelName",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-ms-url-encoding": "single",
|
||||
"description": "Required. The name of the model to use for generating the completion. Examples: text-bison-001, sentence-translator-u3b7m.",
|
||||
"x-ms-summary": "Model Name"
|
||||
},
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"prompt": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"text": {
|
||||
"type": "string",
|
||||
"description": "Required. The input text given to the model as a prompt.",
|
||||
"x-ms-summary": "Prompt"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"text"
|
||||
]
|
||||
},
|
||||
"temperature": {
|
||||
"type": "number",
|
||||
"description": "Optional. Controls the randomness of the output.",
|
||||
"x-ms-summary": "Temperature"
|
||||
},
|
||||
"candidateCount": {
|
||||
"type": "integer",
|
||||
"description": "Optional. Number of generated responses to return.",
|
||||
"x-ms-summary": "Candidate Count"
|
||||
},
|
||||
"maxOutputTokens": {
|
||||
"type": "integer",
|
||||
"description": "Optional. Maximum number of tokens to include in a candidate.",
|
||||
"x-ms-summary": "Max Output Tokens"
|
||||
},
|
||||
"topP": {
|
||||
"type": "number",
|
||||
"description": "Optional. Maximum cumulative probability of tokens to consider when sampling.",
|
||||
"x-ms-summary": "Top P"
|
||||
},
|
||||
"topK": {
|
||||
"type": "integer",
|
||||
"description": "Optional. Maximum number of tokens to consider when sampling.",
|
||||
"x-ms-summary": "Top K"
|
||||
},
|
||||
"safetySettings": {
|
||||
"type": "array",
|
||||
"description": "Optional. A list of unique SafetySetting instances for blocking unsafe content.",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"description": "Optional. Safety settings to block unsafe content"
|
||||
},
|
||||
"x-ms-summary": "Safety Settings"
|
||||
},
|
||||
"stopSequences": {
|
||||
"type": "array",
|
||||
"description": "Optional. Character sequences that will stop output generation.",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "Optional. Character sequences to stop output generation."
|
||||
},
|
||||
"x-ms-summary": "Stop Sequences"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad request"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
},
|
||||
"404": {
|
||||
"description": "Not found"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/{APIVersion}/models/{model}:generateMessage": {
|
||||
"post": {
|
||||
"summary": "Generate Message",
|
||||
"description": "Generates a response from the model given an input message prompt.",
|
||||
"operationId": "GenerateMessage",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "APIVersion",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "Required.API version to use for the endpoint. Examples:v1beta2,v1beta3.",
|
||||
"x-ms-summary": "API Version",
|
||||
"x-ms-url-encoding": "single"
|
||||
},
|
||||
{
|
||||
"in": "path",
|
||||
"name": "model",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-ms-url-encoding": "single",
|
||||
"description": "Required. The name of the Model to use for generating the completion. Example: chat-bison-001.",
|
||||
"x-ms-summary": "Model Name"
|
||||
},
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"prompt"
|
||||
],
|
||||
"properties": {
|
||||
"prompt": {
|
||||
"type": "object",
|
||||
"description": "Required. The textual input given to model as prompt",
|
||||
"required": [
|
||||
"messages"
|
||||
],
|
||||
"properties": {
|
||||
"messages": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"content"
|
||||
],
|
||||
"properties": {
|
||||
"content": {
|
||||
"type": "string",
|
||||
"description": "Required. The textual input given to model as prompt"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-ms-summary": "Messages"
|
||||
}
|
||||
}
|
||||
},
|
||||
"temperature": {
|
||||
"type": "number",
|
||||
"description": "Optional. Controls the randomness of the output.",
|
||||
"x-ms-summary": "Temperature"
|
||||
},
|
||||
"topP": {
|
||||
"type": "number",
|
||||
"description": "Optional. Maximum cumulative probability of tokens to consider when sampling.",
|
||||
"x-ms-summary": "Top P"
|
||||
},
|
||||
"topK": {
|
||||
"type": "integer",
|
||||
"description": "Optional. Maximum number of tokens to consider when sampling.",
|
||||
"x-ms-summary": "Top K"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad request"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
},
|
||||
"404": {
|
||||
"description": "Not found"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/{APIVersion}/models/{model}:countTextTokens": {
|
||||
"post": {
|
||||
"summary": "Count Text Tokens",
|
||||
"description": "Counts the number of tokens in the provided text prompt.",
|
||||
"operationId": "CountTextTokens",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "APIVersion",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "Required.API version to use for the endpoint. Examples:v1beta3.",
|
||||
"x-ms-summary": "API Version",
|
||||
"x-ms-url-encoding": "single"
|
||||
},
|
||||
{
|
||||
"in": "path",
|
||||
"name": "model",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-ms-url-encoding": "single",
|
||||
"description": "Required. The model's resource name. Eg: text-bison-001 .Call List Models to see the list of supported models ",
|
||||
"x-ms-summary": "Model Name"
|
||||
},
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"prompt"
|
||||
],
|
||||
"properties": {
|
||||
"prompt": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"text"
|
||||
],
|
||||
"properties": {
|
||||
"text": {
|
||||
"type": "string",
|
||||
"description": "Required.The text prompt to analyze.",
|
||||
"x-ms-summary": "Text"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"prompt": {
|
||||
"text": "Write a story about a magic backpack."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/{APIVersion}/models/{model}:countMessageTokens": {
|
||||
"post": {
|
||||
"summary": "Count Message Tokens",
|
||||
"description": "Counts the number of tokens in the provided message prompt.",
|
||||
"operationId": "CountMessageTokens",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "APIVersion",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "Required.API version to use for the endpoint. Examples:v1beta2,v1beta3.",
|
||||
"x-ms-summary": "API Version",
|
||||
"x-ms-url-encoding": "single"
|
||||
},
|
||||
{
|
||||
"in": "path",
|
||||
"name": "model",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-ms-url-encoding": "single",
|
||||
"description": "Required. The model's resource name.Eg: chat-bison-001 . Call List Models to see the list of supported models ",
|
||||
"x-ms-summary": "Model Name"
|
||||
},
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"prompt"
|
||||
],
|
||||
"properties": {
|
||||
"prompt": {
|
||||
"type": "object",
|
||||
"description": "Required. The prompt, whose token count is to be returned.",
|
||||
"required": [
|
||||
"messages"
|
||||
],
|
||||
"properties": {
|
||||
"messages": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"content"
|
||||
],
|
||||
"properties": {
|
||||
"content": {
|
||||
"type": "string",
|
||||
"description": "Required. The content of the message."
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-ms-summary": "Messages"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"prompt": {
|
||||
"messages": [
|
||||
{
|
||||
"content": "How many tokens?"
|
||||
},
|
||||
{
|
||||
"content": "For this whole conversation?"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad request"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
},
|
||||
"404": {
|
||||
"description": "Not found"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/{APIVersion}/models/{model}:embedText": {
|
||||
"post": {
|
||||
"summary": "Text Embedding",
|
||||
"description": "Turns the provided free-form input text into an embedding.",
|
||||
"operationId": "EmbedText",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "APIVersion",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "Required.API version to use for the endpoint. Examples:v1beta2,v1beta3.",
|
||||
"x-ms-summary": "API Version",
|
||||
"x-ms-url-encoding": "single"
|
||||
},
|
||||
{
|
||||
"in": "path",
|
||||
"name": "model",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-ms-url-encoding": "single",
|
||||
"description": "Required. The name of the Model to use for generating the embedding. Eg: embedding-gecko-001.",
|
||||
"x-ms-summary": "Model Name"
|
||||
},
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"text"
|
||||
],
|
||||
"properties": {
|
||||
"text": {
|
||||
"type": "string",
|
||||
"description": "Required. The free-form input text that the model will turn into an embedding.",
|
||||
"x-ms-summary": "Text"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"text": "say something nice!"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"embedding": {
|
||||
"type": "object",
|
||||
"description": "The embedding generated from the input text.",
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number"
|
||||
},
|
||||
"description": "The numerical representation of the text in the embedding space."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad request"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
},
|
||||
"404": {
|
||||
"description": "Not found"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"properties": {
|
||||
"connectionParameters": {
|
||||
"api_key": {
|
||||
"type": "securestring",
|
||||
"uiDefinition": {
|
||||
"displayName": "API Key",
|
||||
"description": "The API Key for this api",
|
||||
"tooltip": "Provide your API Key from : https://makersuite.google.com/app/apikey",
|
||||
"constraints": {
|
||||
"tabIndex": 2,
|
||||
"clearText": false,
|
||||
"required": "true"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"iconBrandColor": "#da3b01",
|
||||
"capabilities": [],
|
||||
"publisher": "Priyaranjan KS",
|
||||
"stackOwner": "Google"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
# Google PaLM
|
||||
|
||||
## Publisher: Priyaranjan KS, Vidya Sagar Alti [Tata Consultancy Services]
|
||||
|
||||
## Overview
|
||||
The Google PaLM API offers advanced text generation and manipulation capabilities. This documentation covers the endpoints, their parameters, and other essential details.
|
||||
|
||||
## Prerequisites
|
||||
You need to get an API key from Google Make Suite site for authenticating the connector.
|
||||
|
||||
### Obtaining an API Key
|
||||
|
||||
Follow these steps to get your API key:
|
||||
|
||||
1. **Visit the API Key Generation Page**
|
||||
- Go to [Google MakerSuite](https://makersuite.google.com/app/apikey) to access the API key generation interface.
|
||||
|
||||
2. **Create API Key**
|
||||
- Once on the page, you have two options:
|
||||
- **Create API Key in New Project**: Select this if you want to create a new project for your API key.
|
||||
- **Create API Key in Existing Project**: Choose this if you prefer to use an existing project for your API key.
|
||||
|
||||
By following these steps, you will obtain an API key that is required to authenticate and use the PaLM API.
|
||||
|
||||
**Note**: Ensure to keep your API key secure and do not share it publicly.
|
||||
|
||||
## Supported Operations
|
||||
|
||||
### 1. List Models
|
||||
#### GET `/{APIVersion}/models`
|
||||
Retrieves a list of available models through the API.
|
||||
|
||||
#### Parameters
|
||||
| Name | Optional | Description |
|
||||
|------------|----------|-----------------------------------------|
|
||||
| `Page Size` | Yes | The maximum number of models to return. |
|
||||
| `Page Token`| Yes | A token for pagination across multiple pages. |
|
||||
| `API Version` | No | The version number of the PaLM API. |
|
||||
|
||||
### 2. Get Model
|
||||
#### GET `/{APIVersion}/models/{name}`
|
||||
Retrieves the details of a specific model.
|
||||
|
||||
#### Parameters
|
||||
| Name | Optional | Description |
|
||||
|-------|----------|-----------------------------------------|
|
||||
| `Model Name`| No | The unique identifier of the model. |
|
||||
| `API Version` | No | The version number of the PaLM API. |
|
||||
|
||||
### 3. Generate Text
|
||||
#### POST `/{APIVersion}/{modelType}/{modelName}:generateText`
|
||||
Generates text based on a provided prompt.
|
||||
|
||||
#### Path Parameters
|
||||
| Name | Optional | Description |
|
||||
|-------------|----------|-----------------------------------|
|
||||
| `Model Type` | No | The type of the model. |
|
||||
| `Model Name` | No | The name of the model. |
|
||||
| `API Version` | No | The version number of the PaLM API. |
|
||||
|
||||
#### Request Body Parameters
|
||||
| Name | Optional | Description |
|
||||
|-------------------|----------|---------------------------------------------------|
|
||||
| `Prompt` | No | The input text prompt. |
|
||||
| `Safety Settings` | Yes | Settings for filtering unsafe content. |
|
||||
| `Stop Sequences` | Yes | Sequences that signal the end of text generation. |
|
||||
| `Temperature` | Yes | Controls the randomness of generated text. |
|
||||
| `Candidate Count` | Yes | Number of response options to generate. |
|
||||
| `Max Output Tokens` | Yes | The maximum size of the generated text. |
|
||||
| `Top P` | Yes | Cumulative probability for token selection. |
|
||||
| `Top K` | Yes | The number of top tokens to consider during generation. |
|
||||
|
||||
### 4. Generate Message
|
||||
#### POST `/{APIVersion}/models/{model}:generateMessage`
|
||||
Generates a response message based on the input prompt.
|
||||
|
||||
#### Path Parameters
|
||||
| Name | Optional | Description |
|
||||
|--------|----------|-----------------------------------|
|
||||
| `Model Name`| No | The name of the model. |
|
||||
| `API Version` | No | The version number of the PaLM API. |
|
||||
|
||||
#### Request Body Parameters
|
||||
| Name | Optional | Description |
|
||||
|-------------|----------|-----------------------------------------------|
|
||||
| `Messages` | No | The structured textual input given as a prompt. |
|
||||
| `Temperature`| Yes | Controls the randomness of the output. |
|
||||
| `Top P` | Yes | Cumulative probability for token selection. |
|
||||
| `Top K` | Yes | The number of top tokens to consider during sampling. |
|
||||
|
||||
### 5. Count Text Tokens
|
||||
#### POST /{APIVersion}/models/{model}:countTextTokens
|
||||
Counts the number of tokens in the provided text prompt.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Parameter | Optional | Description |
|
||||
|----------------|----------|-----------------------------------------------------------------------------------------------|
|
||||
| API Version | No | API version to use for the endpoint. Examples: v1beta3. |
|
||||
| Model Name | No | The model's resource name. Eg: text-bison-001. |
|
||||
| Text | No | The text prompt to analyze. |
|
||||
|
||||
|
||||
### 6. Count Message Tokens
|
||||
#### POST /{APIVersion}/models/{model}:countMessageTokens
|
||||
Counts the number of tokens in the provided message prompt.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Parameter | Optional | Description |
|
||||
|--------------------|----------|---------------------------------------------------------------------------------------------|
|
||||
| API Version | No | API version to use for the endpoint. Examples: v1beta2, v1beta3. |
|
||||
| Model Name | No | The model's resource name. Eg: chat-bison-001. |
|
||||
| Messages | No | The prompt, whose token count is to be returned. |
|
||||
|
||||
|
||||
### 7. Text Embedding
|
||||
#### POST /{APIVersion}/models/{model}:embedText
|
||||
Turns the provided free-form input text into an embedding.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Parameter | Optional | Description |
|
||||
|-------------|----------|-----------------------------------------------------------------------------------|
|
||||
| API Version | No | API version to use for the endpoint. Examples: v1beta3. |
|
||||
| Model | No | The model's resource name. Eg: text-bison-001. |
|
||||
| Text | No | The free-form input text for embedding. |
|
||||
|
||||
*Please replace `{APIVersion}`,`{model}`, `{modelName}`, and `{modelType}` with appropriate values as per your use case.*
|
||||
|
||||
|
||||
## Known Issues and Limitations
|
||||
The PaLM API has several limitations which users should be aware of:
|
||||
|
||||
1. **Edge Cases**
|
||||
- The API may struggle with rare or unusual situations that are not well-represented in the training data.
|
||||
- This can lead to issues like model overconfidence, misinterpretation of context, or inappropriate outputs.
|
||||
|
||||
2. **Model Hallucinations, Grounding, and Factuality**
|
||||
- The API can lack grounding in real-world knowledge, leading to outputs that are plausible but factually incorrect, irrelevant, or nonsensical.
|
||||
|
||||
3. **Data Quality and Tuning**
|
||||
- The performance of the API is heavily dependent on the quality and accuracy of the input data.
|
||||
- Inaccurate or biased input data can lead to suboptimal performance or false model outputs.
|
||||
|
||||
4. **Bias Amplification**
|
||||
- The API may inadvertently amplify existing biases in the training data, leading to outputs that reinforce societal prejudices.
|
||||
|
||||
5. **Language Quality**
|
||||
- The API's multilingual capabilities are stronger in English, with potential for reduced performance in non-English languages or less-represented English dialects.
|
||||
- Fairness evaluations are primarily conducted in English, which may not cover all potential biases in other languages.
|
||||
|
||||
6. **Limited Domain Expertise**
|
||||
- The API may not provide accurate or detailed responses on highly specialized or technical topics.
|
||||
- For complex use cases, domain-specific tuning and human supervision are recommended.
|
||||
|
||||
7. **Length and Structure of Inputs and Outputs**
|
||||
- The API has a maximum input token limit of 8k and output token limit of 1k.
|
||||
- Safety classifiers are not applied if these limits are exceeded, potentially leading to poor model performance.
|
||||
- The API's performance can be affected by inputs with unusual or complex structures.
|
||||
|
||||
## API Documentation
|
||||
Visit [Google PaLM APIs reference](https://developers.generativeai.google/tutorials/curl_quickstart) page for further details.
|
||||
|
||||
---
|
Загрузка…
Ссылка в новой задаче