OpenAPI-Client-OpenAI

 view release on metacpan or  search on metacpan

share/openapi.yaml  view on Meta::CPAN


                console.log(embedding);
              }

              main();
            csharp: >
              using System;


              using OpenAI.Embeddings;


              EmbeddingClient client = new(
                  model: "text-embedding-3-small",
                  apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY")
              );


              OpenAIEmbedding embedding = client.GenerateEmbedding(input: "The
              quick brown fox jumped over the lazy dog");

              ReadOnlyMemory<float> vector = embedding.ToFloats();


              for (int i = 0; i < vector.Length; i++)

              {
                  Console.WriteLine($"  [{i,4}] = {vector.Span[i]}");
              }
            node.js: |-
              import OpenAI from 'openai';

              const client = new OpenAI({
                apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
              });

              const createEmbeddingResponse = await client.embeddings.create({
                input: 'The quick brown fox jumped over the lazy dog',
                model: 'text-embedding-3-small',
              });

              console.log(createEmbeddingResponse.data);
            go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcrea...
            java: |-
              package com.openai.example;

              import com.openai.client.OpenAIClient;
              import com.openai.client.okhttp.OpenAIOkHttpClient;
              import com.openai.models.embeddings.CreateEmbeddingResponse;
              import com.openai.models.embeddings.EmbeddingCreateParams;
              import com.openai.models.embeddings.EmbeddingModel;

              public final class Main {
                  private Main() {}

                  public static void main(String[] args) {
                      OpenAIClient client = OpenAIOkHttpClient.fromEnv();

                      EmbeddingCreateParams params = EmbeddingCreateParams.builder()
                          .input("The quick brown fox jumped over the lazy dog")
                          .model(EmbeddingModel.TEXT_EMBEDDING_3_SMALL)
                          .build();
                      CreateEmbeddingResponse createEmbeddingResponse = client.embeddings().create(params);
                  }
              }
            ruby: |-
              require "openai"

              openai = OpenAI::Client.new(api_key: "My API Key")

              create_embedding_response = openai.embeddings.create(
                input: "The quick brown fox jumped over the lazy dog",
                model: :"text-embedding-3-small"
              )

              puts(create_embedding_response)
          response: |
            {
              "object": "list",
              "data": [
                {
                  "object": "embedding",
                  "embedding": [
                    0.0023064255,
                    -0.009327292,
                    .... (1536 floats total for ada-002)
                    -0.0028842222,
                  ],
                  "index": 0
                }
              ],
              "model": "text-embedding-ada-002",
              "usage": {
                "prompt_tokens": 8,
                "total_tokens": 8
              }
            }
  /evals:
    get:
      operationId: listEvals
      tags:
        - Evals
      summary: |
        List evaluations for a project.
      parameters:
        - name: after
          in: query
          description: Identifier for the last eval from the previous pagination request.
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: Number of evals to retrieve.
          required: false
          schema:
            type: integer
            default: 20
        - name: order
          in: query
          description: >-



( run in 3.537 seconds using v1.01-cache-2.11-cpan-71847e10f99 )