All URIs are relative to https://api.openai.com/v1
Method | HTTP request | Description |
---|---|---|
createEmbedding | POST /embeddings | Creates an embedding vector representing the input text. |
CreateEmbeddingResponse createEmbedding(createEmbeddingRequest)
Creates an embedding vector representing the input text.
// Import classes:
import com.github.ainoya.client.ApiClient;
import com.github.ainoya.client.ApiException;
import com.github.ainoya.client.Configuration;
import com.github.ainoya.client.auth.*;
import com.github.ainoya.client.models.*;
import com.github.ainoya.openai.client.api.EmbeddingsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.openai.com/v1");
// Configure HTTP bearer authorization: ApiKeyAuth
HttpBearerAuth ApiKeyAuth = (HttpBearerAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setBearerToken("BEARER TOKEN");
EmbeddingsApi apiInstance = new EmbeddingsApi(defaultClient);
CreateEmbeddingRequest createEmbeddingRequest = new CreateEmbeddingRequest(); // CreateEmbeddingRequest |
try {
CreateEmbeddingResponse result = apiInstance.createEmbedding(createEmbeddingRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling EmbeddingsApi#createEmbedding");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
createEmbeddingRequest | CreateEmbeddingRequest |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |