Evaluate
POSThttps://api.aleph-alpha.com/evaluate
Evaluates the model's likelihood to produce a completion given a prompt.
Request
Query Parameters
Setting this to True, will signal to the API that you intend to be nice to other users by de-prioritizing your request below concurrent ones.
- application/json
Bodyrequired
Name of model to use. A model name refers to a model architecture (number of parameters among others). Always the latest version of model is used. The model output contains information as to the model version.
Optional paramter that specifies which datacenters may process the request.
You can either set the parameter to "aleph-alpha" or omit it (defaulting to null
).
Not setting this value, or setting it to null
, gives us maximal flexibility in processing your request in our
own datacenters and on servers hosted with other providers. Choose this option for maximum availability.
Setting it to "aleph-alpha" allows us to only process the request in our own datacenters. Choose this option for maximal data privacy.
Possible values: [aleph-alpha
, null
]
prompt objectrequired
The completion that you would expect to be completed. Unconditional completion can be used with an empty string (default). The prompt may contain a zero shot or few shot task.
If set to null
, attention control parameters only apply to those tokens that have
explicitly been set in the request.
If set to a non-null value, we apply the control parameters to similar tokens as well.
Controls that have been applied to one token will then be applied to all other tokens
that have at least the similarity score defined by this parameter.
The similarity score is the cosine similarity of token embeddings.
null
true
: apply controls on prompt items by adding the log(control_factor)
to attention scores.
false
: apply controls on prompt items by (attention_scores - -attention_scores.min(-1)) * control_factor
true
Responses
- 200
- application/json
- Schema
- Example (auto)
Schema
- Token ID arrays are used as as-is.
- Text prompt items are tokenized using the tokenizers specific to the model.
- Each image is converted into a fixed amount of tokens that depends on the chosen model.
model name and version (if any) of the used model for inference
result object
The sum over the number of tokens of both the prompt
and the completion_expected
fields.
Tokenization:
{
"model_version": "2021-12",
"result": {
"log_probability": -1.2281955,
"log_perplexity": 1.2281955,
"log_perplexity_per_token": 0.24563909,
"log_perplexity_per_character": 1.2281955,
"correct_greedy": true,
"token_count": 5,
"character_count": 1,
"completion": " keeps the doctor away."
},
"num_tokens_prompt_total": 9
}
Authorization: http
name: tokentype: httpscheme: bearerdescription: Can be generated in your [Aleph Alpha profile](https://app.aleph-alpha.com/profile)
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.aleph-alpha.com/evaluate");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <TOKEN>");
var content = new StringContent("{\n \"model\": \"luminous-base\",\n \"prompt\": \"An apple a day\",\n \"completion_expected\": \"keeps the doctor away.\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());