OpenAI

Configure OpenAI specification.

When using OpenAI LLMs, you have the choice of using a built-in Graphlit model, which accrues credits for usage, or using your own OpenAI API key.

Graphlit currently supports built-in OpenAI models via the model field, such as: GPT35_TURBO, GPT35_TURBO_16K, GPT4, GPT4_32K, GPT4_TURBO_128K and GPT4O_128K. These models will always use the latest version, as defined by OpenAI.

Also, Graphlit supports date-versioned models, such as: GPT35_TURBO_0613, GPT35_TURBO_16K_0613, GPT35_TURBO_16K_1106, GPT4_0613, GPT4_32K_0613, and GPT4_TURBO_128K_1106.

As new models are released by OpenAI, Graphlit will add model enums in future releases.

See here for the latest supported OpenAI model enums.

By assigning the model field to CUSTOM, you also will need to assign thekey and modelName to use your own OpenAI developer account. You can find the list of current OpenAI models here, and use the model name syntax such as gpt-4.

Create Built-In Model Specification

Mutation:

mutation CreateSpecification($specification: SpecificationInput!) {
  createSpecification(specification: $specification) {
    id
    name
    state
    type
    serviceType
  }
}

Variables:

{
  "specification": {
    "type": "COMPLETION",
    "serviceType": "OPEN_AI",
    "openAI": {
      "model": "GPT4"
    },
    "name": "OpenAI"
  }
}

Response:

{
  "type": "COMPLETION",
  "serviceType": "OPEN_AI",
  "id": "a87ce6cd-75f4-4391-8d00-33149e9afc86",
  "name": "OpenAI",
  "state": "ENABLED"
}
Create Custom Model Specification

Mutation:

mutation CreateSpecification($specification: SpecificationInput!) {
  createSpecification(specification: $specification) {
    id
    name
    state
    type
    serviceType
  }
}

Variables:

{
  "specification": {
    "type": "COMPLETION",
    "serviceType": "OPEN_AI",
    "openAI": {
      "key": "redacted",
      "modelName": "gpt-3.5-turbo",
      "model": "CUSTOM"
    },
    "name": "OpenAI Custom"
  }
}

Response:

{
  "type": "COMPLETION",
  "serviceType": "OPEN_AI",
  "id": "3c7d107c-cc9f-4c2f-8ac5-0b0b7ddd2ddf",
  "name": "OpenAI Custom",
  "state": "ENABLED"
}

Last updated