Skip to content

Commit

Permalink
adding contribution.mc
Browse files Browse the repository at this point in the history
  • Loading branch information
namankhurpia committed Dec 30, 2023
1 parent bd77d3f commit e6d1e7c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# How to Contribute

## How to Add a New API

### Add POJOs to API library
I have manually read all documentation given by OpenAI and then decided to make the models.

- Make all java variables camel case, and use `@JsonProperty` for fields that OpenAI returns as snake case
- Include comments for each variable, I take these directly from the OpenAI website
- Include `@Builder @NoArgsConstructor @AllArgsConstructor @Data` on every request/response/model class.
- The flow of the Application goes like - Documentation/RunnerForSingleInstance.java -> Service/EasyopenaiService.java -> DAO/DAOImpl.java -> OPENAI's server
- Add as many checks as you can to validate all mandatory parameters, saving all network requests.

### Add an Integration Test
Since 99% of the work of this library is done on OpenAI's servers, the objective of these tests is to call each endpoint at least once.
Specify every available parameter to make sure that OpenAI accepts everything, but don't create extra test cases unless a parameter drastically affects the results.

I request you to please check the file [RunnerForSingleInstance](https://github.com/namankhurpia/Easy-open-ai/blob/main/src/main/java/io/github/namankhurpia/Documentation/RunnerForSingleInstance.java) for single threaded response. Please test the function you added/changed, Make a proper call using real key.

Similarly for Concurrent - [RunnerForConcurrent](https://github.com/namankhurpia/Easy-open-ai/blob/main/src/main/java/io/github/namankhurpia/Documentation/RunnerForConcurrent.java) and [RunnerForAsync](https://github.com/namankhurpia/Easy-open-ai/blob/main/src/main/java/io/github/namankhurpia/Documentation/RunnerForAsync.java) for Asynchronous Multithreaded Tasks.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ This repository contains the community-maintained library for OpenAI's API in ja

[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.namankhurpia/easyopenai/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.namankhurpia/easyopenai)

[![Your Custom Badge](https://img.shields.io/badge/Easyopenai-1.0.6-brightgreen)](https://central.sonatype.com/artifact/io.github.namankhurpia/easyopenai)
[![Your Custom Badge](https://img.shields.io/badge/Easyopenai-1.0.7-brightgreen)](https://central.sonatype.com/artifact/io.github.namankhurpia/easyopenai)

# Usage

Expand Down

0 comments on commit e6d1e7c

Please sign in to comment.