Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
[lib] Improve function calling [web] Implement custom function callin…
Browse files Browse the repository at this point in the history
…g w/ code (#28)
  • Loading branch information
maxijonson authored Jul 1, 2023
1 parent 1f25b8b commit 9996552
Show file tree
Hide file tree
Showing 94 changed files with 5,707 additions and 1,034 deletions.
52 changes: 0 additions & 52 deletions .github/ISSUE_TEMPLATE/become_maintainer.yml

This file was deleted.

57 changes: 33 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ All types of contributions are encouraged and valued. See the [Table of Contents
> - Refer this project in your project's readme
> - Mention the project at local meetups and tell your friends/colleagues
<!-- omit in toc -->
## ⚠⚠⚠ Early Development Phase ⚠⚠⚠

As I write this, my project is still in its early stages and its future is uncertain. I started this project as a hobby to experiment with OpenAI's GPT Chat Completion API across multiple environments, and while I'm excited about its potential, I'm not yet committed to it as a long-term project. However, I'm eager to see where it goes and will do my best to continue developing it. I encourage others to contribute to the project as well, as it will motivate me and prevent it from becoming another abandoned project. If you're interested in joining the project team, consult the last section of the contribution guidelines for more information. If you have suggestions for improving the guidelines, you are welcome to open an issue or pull request.

<!-- omit in toc -->
## Table of Contents

Expand All @@ -28,8 +23,10 @@ As I write this, my project is still in its early stages and its future is uncer
- [Your First Code Contribution](#your-first-code-contribution)
- [Improving The Documentation](#improving-the-documentation)
- [Styleguides](#styleguides)
- [Code Style](#code-style)
- [Library Code Style](#library-code-style)
- [React Code Style (web/cli)](#react-code-style-webcli)
- [Commit Messages](#commit-messages)
- [Join The Project Team](#join-the-project-team)

## Code of Conduct

Expand All @@ -39,7 +36,7 @@ This project and everyone participating in it is governed by the [GPT Turbo Code

> Before asking a question through the issues, please read the available [Documentation](https://github.com/maxijonson/gpt-turbo#readme).
Before you ask a question, it is best to search for existing [Issues](https://github.com/maxijonson/gpt-turbo/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
Before you ask a question, it is best to search for existing [Issues](https://github.com/maxijonson/gpt-turbo/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue.

If you then still feel the need to ask a question and need clarification, here's how you can reach out:

Expand All @@ -52,7 +49,7 @@ A `question` label will be added by the project team to your issue if it is dete
## I Want To Contribute

> ### Legal Notice <!-- omit in toc -->
> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.
> By contributing to this project, you agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute will be provided under the project license.
### Reporting Bugs

Expand Down Expand Up @@ -83,7 +80,7 @@ If you run into an issue with the project:
Once it's filed:

- The project team will label the issue accordingly.
- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced.
- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until the issue description is updated with a step-by-step reproduction of the bug.
- If the team is able to reproduce the issue, it will be marked `bug`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution).

### Suggesting Enhancements
Expand Down Expand Up @@ -124,7 +121,7 @@ Follow these steps to get your development environment set up:
2. Clone your forked repository locally.
3. Create a new branch for your changes.
4. Run the following commands at the repository root:
1. `npm install`: installs the mono-repo dependencies, bootstraps packages, and builds them.
1. `npm install`: installs the mono-repo dependencies, bootstraps packages, and builds the library used by the implementations.
2. (optional) `npm run dev`: if you plan on editing both the library and an implementation, this will watch for changes in the library and automatically rebuild it so that the implementation can use the latest version of the library.

You're now all set to start contributing! Make your changes, commit them and push them to your forked repository. Then, open a pull request to the `develop` branch of the main repository.
Expand All @@ -143,28 +140,40 @@ Before submitting your changes, run the following commands to prevent your contr
Documentation is an important part of any project. It's what makes it easy for new users to get started and for existing users to find the information they need. If you find a typo or a mistake in the documentation, or if you think it can be improved, please open an issue or a pull request.

## Styleguides

These are a set of rules that should be followed when contributing to the project. They are meant to ensure consistency across the project and make it easier to maintain.

### Code Style

A lot of code style rules are enforced by Prettier. The same `.prettierrc` is used in each package, you can see the lib's [`.prettierrc`](./packages/lib/.prettierrc) for reference on style rules that are not listed here.

- Use arrow functions (`() => {}`) instead of `function` keyword. The only exception is when using `function` is necessary (e.g. when using `this`).
- **Never** use `var`. Use `const` by default, and `let` when reassignment is necessary.
- Do not use index files to export multiple files. Simply import the file you need directly. (preferably with relative paths)
- Exceptions for the library, since index file help making sure everything is exported for consumers of the package. Implementations do not need to have everything exposed like the library. The point of this code style rule is not to use index files as a way to write shorter imports. Most IDE's will auto-import files without you having to write a single import. Use this handy feature instead!

Overall, try to keep consistency with the existing codebase, even if it's not how you would have done it. Your code should be undistinguishable from the rest of the code (i.e. it shouldn't be obvious that someone else wrote a piece of code without looking at the git history). If you think a piece of code can be improved, open an issue or a pull request to discuss it.

#### Library Code Style

- Add a TSDoc comment to every function, constant, class, method, interface, type and anything that is exported. Not only will this help client code understand what it does, but it will also be used in the auto-generated documentation.
- Export all types and interfaces, unless they are strictly used internally (i.e. only used inside a function or method. Not a parameter, return type or **sub property** of a parameter or return type). This ensures that the library's types are available to client code so they don't need to redeclare them manually if they want to use them.

#### React Code Style (web/cli)

- Use `React.*` when using a React's types, hooks and utility methods such as `createContext` (e.g. `React.useState` instead of `useState`). You don't need to use it for components, such as `Suspense`. This comes from a long lasting habit from before React 17 when React had to be in the scope to use JSX. While it is no longer necessary, this habit has made itself into the codebase and it would be weird to mix both styles.

### Commit Messages

Since commits are squashed when merged into the `develop` branch, there are no strict rules for commit messages. However, if your PR is pretty big, contains many commits and/or affects multiple packages, it is recommended to use the following prefixes for your commit messages:
There are no strict rules for commit messages as all PRs will be squashed into a single commit by a maintainer when merging. However, we try to follow the following convention, which you can use (or not) in your contribution to help reviewers when reviewing your PRs.

- `[library]`: for changes to the library or its documentation.
- `[cli]`: for changes to the CLI implementation or its documentation.
- `[web]`: for changes to the Web implementation or its documentation.
- `[nest]`: for changes to the Nest implementation or its documentation.
- `[discord]`: for changes to the Discord implementation or its documentation.
- `[docs]`: for changes to the documentation **not related to the library or one of its implementations**. (e.g. changes to the root README.md file or this contributing guide)

## Join The Project Team

Are you interested in becoming a maintainer of this project? As of now, the project is maintained by a single person, and it would be great to have more people involved beyond contributors! The only requirement I am looking for is a solid experience with [TypeScript](https://www.typescriptlang.org/), since it is at the core of the project.

It's also a plus if you have experience in the technologies used by the library and its implementations:
- [OpenAI's API](https://platform.openai.com/docs/api-reference/chat)
- [React](https://reactjs.org/)
- [Ink](https://github.com/vadimdemedes/ink)
- and more

If you're interested, please [open an issue](https://github.com/maxijonson/gpt-turbo/issues/new/choose) (or email [[email protected]](mailto:[email protected]) with the same fields as the maintainer application template) and tell us a bit about yourself and your experience! We'd love to hear from you.
- `[docs]`: for changes to the documentation **not related to the library or one of its implementations**. (e.g. changes to the root README.md file or this contributing guide). These are usually markdown files.
- `[monorepo]`: for changes to other monorepo files, such as configuration files or `.github` files.

<!-- omit in toc -->
## Attribution
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ GPT Turbo is a JavaScript library for seamless integration with OpenAI's Chat Co

## Features

> ✨ New (June 2023): Added support for **Function calling**
> ✨ New (June 2023): Added support for **Function calling**! Try it out in the web app [here](https://gpt-turbo-web.chintristan.io/functions/create).
🤖 Supports all Chat Completion models, including **GPT-4**. (full list [here](https://platform.openai.com/docs/models/model-endpoint-compatibility))

Expand Down
Loading

0 comments on commit 9996552

Please sign in to comment.