Coder Social home page Coder Social logo

tudor44 / assistant-api-java Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 5.0 11 KB

Lightweight Java client for easy integration with OpenAI Assistant API, enabling Generative AI in Java applications

Java 100.00%
api artificial-intelligence client generative-ai java llm openai

assistant-api-java's Introduction

OpenAI Assistant API for Java

This project offers a lightweight and straightforward Java client for interacting with the OpenAI Assistant API. It's specifically designed to facilitate the integration of Generative AI technology into Java applications.

Important considerations

This repository uses Assistant API to intelligently address user problems. This process may involve multiple calls to the OpenAI API. Please be aware that in the event of an error during processing a request, there is a risk of rapidly escalating API calls, which could dramatically increase usage costs. This is especially important if you plan to use it as an unsupervised service performing tasks in the background. This note is relevant for any usage of Assistant API, not just this repository. Always use Assistant API with caution.

Features

  • Create an assistant.
  • Create a thread.
  • Send messages in a thread.
  • Fetch messages from a thread.
  • Handle responses for assistants, threads, and messages.

For detailed information on the OpenAI API and its capabilities, visit OpenAI's official documentation. https://platform.openai.com/docs/assistants/overview

Requirements

  • Java 17 (for now)
  • Maven

Setup and Usage

  1. Clone the repository.
  2. Add your OpenAI API key to src/main/resources/application.properties.
  3. Build the project using Maven: mvn clean install.
  4. Run the Main.java class to see the client in action.

Contributing

Contributions to the project are welcome! Feel free to fork the repository, make changes, and submit pull requests.

License

This project is open-sourced under the MIT License.

assistant-api-java's People

Contributors

pawelszpyt avatar tudor44 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

assistant-api-java's Issues

Simple promt results in tens of responses

I wrote a prompt that basically said something like "scrap me the header of this site: sitename_here", and I got TENS of responses. There is no way to control that as far as I know, and you are billed for every token returned. And its not a small bill, it can add up fast. Why you can't instruct assistant that a request of this specific type should not take more than 3 responses, for example? You can limit tokens as far as I know but I don't want to do that, but I also don't like the idea of getting literally TENS of short responses with similar content for a simple question, and getting billed for every token TENS of times (that also includes billing tens of times for prompt and for instructions). It is horrific design from OpenAI. I don't see use of it for me, as a software developer, in the current state. I will look into Chat Completions API now, as at first glance that is something more reliable.

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.