mirror of
https://github.com/LukeHagar/log10ts.git
synced 2025-12-06 04:20:12 +00:00
16 KiB
16 KiB
Completions
(completions)
Overview
Completions
Available Operations
- create - Create a completion
- update - Update completion by id.
- listUngraded - List ungraded completions i.e. completions that have not been associated with feedback but matches task selector.
create
Create a completion
Example Usage
import {
ChatCompletionRequestAssistantMessageRole,
CreateChatCompletionRequestType,
Kind,
Log10,
Two,
} from "log10ts";
const log10 = new Log10({
log10Token: "<YOUR_API_KEY_HERE>",
xLog10Organization: "<value>",
});
async function run() {
const result = await log10.completions.create({
organizationId: "<value>",
kind: Kind.Chat,
request: {
messages: [
{
role: ChatCompletionRequestAssistantMessageRole.Assistant,
},
],
model: Two.Gpt4Turbo,
n: 1,
responseFormat: {
type: CreateChatCompletionRequestType.JsonObject,
},
temperature: 1,
topP: 1,
user: "user-1234",
},
}, "<value>");
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
completion |
models.Completion | ✔️ | N/A |
xLog10Organization |
string | ➖ | N/A |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
Response
Promise<models.CreateResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4xx-5xx | / |
update
Update completion by id.
Example Usage
import { CreateChatCompletionRequestType, Kind, Log10, Role, Two } from "log10ts";
const log10 = new Log10({
log10Token: "<YOUR_API_KEY_HERE>",
xLog10Organization: "<value>",
});
async function run() {
const result = await log10.completions.update("<value>", {
organizationId: "<value>",
kind: Kind.Prompt,
request: {
messages: [
{
content: "<value>",
role: Role.System,
},
],
model: Two.Gpt4Turbo,
n: 1,
responseFormat: {
type: CreateChatCompletionRequestType.JsonObject,
},
temperature: 1,
topP: 1,
user: "user-1234",
},
}, "<value>");
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
completionId |
string | ✔️ | The completion id to update. |
completion |
models.Completion | ✔️ | N/A |
xLog10Organization |
string | ➖ | N/A |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
Response
Promise<models.UpdateResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4xx-5xx | / |
listUngraded
List ungraded completions i.e. completions that have not been associated with feedback but matches task selector.
Example Usage
import { Log10 } from "log10ts";
const log10 = new Log10({
log10Token: "<YOUR_API_KEY_HERE>",
xLog10Organization: "<value>",
});
async function run() {
const result = await log10.completions.listUngraded("<value>");
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
xLog10Organization |
string | ➖ | N/A |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
Response
Promise<models.ListUngradedResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4xx-5xx | / |