Endpoints

POST /logs

https://app.finetunedb.com/api/v1/logs

Creates a new log.

Parameters

  • projectId: string
  • parentId (optional): string
  • name (optional): string
  • provider: enum (openai)
  • tags (optional): array of strings
  • model: string
  • source: string
  • modelParameters: object
    • model: string
    • provider (optional): string
    • max_tokens (optional): number
    • temperature (optional): number
    • top_p (optional): number
    • stop_sequences (optional): array of strings
    • presence_penalty (optional): number
    • frequency_penalty (optional): number
    • other (optional): record of any type
  • input (optional): union of input types (Documented below)
  • output (optional): union of output types (Documented below)
  • metadata (optional): record of any type
  • type: enum (CHATCOMPLETION, EMBEDDING)
  • error (optional): string
  • latencyMs (optional): number

Input Types

The log.input accepts different kinds of values.

OpenAI Completion (If type=CHATCOMPLETION)

Pass the messages value that you use in openai.chat.completions.create Example:

[
  {
    "role": "system",
    "content": "You are an expert assistant"
  },
  {
    "role": "user",
    "content": "Hello, how are you?"
  }
]

OpenAI Embedding (If type=EMBEDDING)

Pass the input value that you send to openai.embeddings.create Example:

"Hello world!"

or

["Hello", "world!"]

Output Types

The log.output accepts different kinds of values.

OpenAI Completion (If type=CHATCOMPLETION)

Pass the response value that you get from openai.chat.completions.create as an array. Example:

const response = await openai.chat.completions.create(...);
const output = [response.choices[0].message];

OpenAI Embedding (If type=EMBEDDING) Pass the response.data value that you get from openai.embeddings.create.

Example:

const response = await openai.embeddings.create(...);
const output = response.data;