GithubHelp home page GithubHelp logo

ai-for-java / openai4j Goto Github PK

View Code? Open in Web Editor NEW
58.0 2.0 20.0 256 KB

Java client library for OpenAI API

License: Apache License 2.0

Java 100.00%
chatgpt chatgpt-api java openai openai-api openai-chatgpt

openai4j's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

openai4j's Issues

[FEATURE] Support OpenAI Audio API

Is your feature request related to a problem? Please describe.
I want to use the audio API (https://platform.openai.com/docs/api-reference/audio) offered by OpenAI.

Describe the solution you'd like
Support the audio API and provide examples of usage.

Describe alternatives you've considered
An alternative might be to use https://github.com/TheoKanning/openai-java

Additional context
Support for speech, transcriptions and translations as per the OpenAI audio API.

Add a way to get the content to the `Message` interface

Is your feature request related to a problem? Please describe.
It's impossible to store all types of messages and get their content

Describe the solution you'd like
A some sort of getStringContent() method to the Message interface which will return the content of any form of message, for the UserMessage it'll return the content if the content is a string, otherwise if it's a Content it'll return the text content or the image url

Api key

Hello,
I'm trying to use our Azure OpenAI deployment using openai4j. Problem is, the tenant expects the API key within a header called "Ocp-Apim-Subscription-Key" and not "api-key" as it has been hardcoded in src/main/java/dev/ai4j/openai4j/ApiKeyHeaderInjector.java.

The MS documentation says we can change the headers' name, but it just won't work and always reply 401 to all requests. Only works if the header is called "Ocp-Apim-Subscription-Key":
https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions

Any recommended solutions, besides forking the code and making the change in this file :) ? Thanks in advance !

Juan

retrofit

trying out v13 and get retrofit2 error

Caused by: java.lang.NoClassDefFoundError: retrofit2.Converter$Factory at dev.ai4j.openai4j.OpenAiClient.builder(OpenAiClient.java:54) at

List models

Is your feature request related to a problem? Please describe.

It looks like there is no way to list the models.

See https://platform.openai.com/docs/api-reference/models

Describe the solution you'd like
I would like a listModels() method that returns all the models.

Describe alternatives you've considered
I can get it myself using any HTTP client, but it breaks the experience of working with a Java library that wraps an API.

The other alternative is of course to use another library :-)

Additional context

btw, the terminology of openai4j, which uses Model to describe its domain objects: ChatCompletionModel, ImageCompletionModel, etc is confusing when dealing with language models. Ideally , there shouldn't be overloading of the term Model.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.