Skip to content

Commit

Permalink
Merge branch 'ballerina-platform:main' into header-sanitation-draft
Browse files Browse the repository at this point in the history
  • Loading branch information
SanduniU authored Aug 21, 2024
2 parents 657dd41 + d384c76 commit 8f49367
Show file tree
Hide file tree
Showing 19 changed files with 90 additions and 58 deletions.
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,26 @@

[OpenAI](https://openai.com/), an AI research organization focused on creating friendly AI for humanity, offers the [OpenAI API](https://platform.openai.com/docs/api-reference/introduction) to access its powerful AI models for tasks like natural language processing and image generation.

The `ballarinax/openai.Assistants` connector allows developers to seamlessly integrate OpenAI's advanced language models into their applications by interacting with [OpenAI REST API v1](https://platform.openai.com/docs/api-reference/assistants). This connector provides tools to build powerful [OpenAI Assistants](https://platform.openai.com/docs/assistants/overview) capable of performing a wide range of tasks, such as generating human-like text, managing conversations with persistent threads, and utilizing multiple tools in parallel. OpenAI has recently announced a variety of new features and improvements to the Assistants API, moving their Beta to a [new API version](https://platform.openai.com/docs/assistants/whats-new), `OpenAI-Beta: assistants=v2`. The users can interact with both the API v1 and v2 by [passing the respective API version header with the request.](https://platform.openai.com/docs/assistants/migration/changing-beta-versions)
The `ballarinax/openai.assistants` connector allows developers to seamlessly integrate OpenAI's advanced language models into their applications by interacting with [OpenAI REST API v1](https://platform.openai.com/docs/api-reference/assistants). This connector provides tools to build powerful [OpenAI Assistants](https://platform.openai.com/docs/assistants/overview) capable of performing a wide range of tasks, such as generating human-like text, managing conversations with persistent threads, and utilizing multiple tools in parallel. OpenAI has recently announced a variety of new features and improvements to the Assistants API, moving their Beta to a [new API version](https://platform.openai.com/docs/assistants/whats-new), `OpenAI-Beta: assistants=v2`. The users can interact with both the API v1 and v2 by [passing the respective API version header with the request.](https://platform.openai.com/docs/assistants/migration/changing-beta-versions)


## Setup guide

To use the OpenAI Connector, you must have access to the OpenAI API through a [OpenAI Platform account](https://platform.openai.com) and a project under it. If you do not have a OpenAI Platform account, you can sign up for one [here](https://platform.openai.com/signup).


1. Open the [OpenAI Platform Dashboard](https://platform.openai.com).


2. Navigate to Dashboard -> API keys
<img src=https://github.com/user-attachments/assets/b2e09c6d-c15f-4cfa-a596-6328b1383162 alt="OpenAI Platform" style="width: 70%;">

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-openai.assistants/main/docs/setup/resources/navigate-api-key-dashboard.png alt="OpenAI Platform" style="width: 70%;">

3. Click on the "Create new secret key" button
<img src=https://github.com/user-attachments/assets/bf1adab4-5e3f-4094-9a56-5b4c3cc3c19e alt="OpenAI Platform" style="width: 70%;">

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-openai.assistants/main/docs/setup/resources/api-key-dashboard.png alt="OpenAI Platform" style="width: 70%;">

4. Fill the details and click on Create secret key
<img src=https://github.com/user-attachments/assets/1c565923-e968-4d5f-9864-7ed2022b8079 alt="OpenAI Platform" style="width: 70%;">

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-openai.assistants/main/docs/setup/resources/create-new-secret-key.png alt="OpenAI Platform" style="width: 70%;">

5. Store the API key securely to use in your application
<img src=https://github.com/user-attachments/assets/bbbf8f38-d551-40ee-9664-f4cf2bd98997 alt="OpenAI Platform" style="width: 70%;">
<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-openai.assistants/main/docs/setup/resources/saved-key.png alt="OpenAI Platform" style="width: 70%;">


## Quickstart
Expand Down Expand Up @@ -106,11 +101,11 @@ bal run

## Examples

The `OpenAI Assistants` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/module-ballerinax-openai.assistants/tree/main/examples/), covering the following use cases:
The `OpenAI Assistants` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples), covering the following use cases:

1. [Math tutor bot](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/Math-tutor-bot) - Create an assistant to solve mathematical problems with step-by-step solutions and interactive guidance.
1. [Math tutor bot](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/math-tutor-bot) - Create an assistant to solve mathematical problems with step-by-step solutions and interactive guidance.

2. [Weather assistant](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/Weather-assistant) - Develop an assistant to provide weather information by leveraging function calls for temperature and rain probability.
2. [Weather assistant](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/weather-assistant) - Develop an assistant to provide weather information by leveraging function calls for temperature and rain probability.


## Build from the source
Expand Down
23 changes: 9 additions & 14 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,27 @@

[OpenAI](https://openai.com/), an AI research organization focused on creating friendly AI for humanity, offers the [OpenAI API](https://platform.openai.com/docs/api-reference/introduction) to access its powerful AI models for tasks like natural language processing and image generation.

The `ballarinax/openai.Assistants` connector allows developers to seamlessly integrate OpenAI's advanced language models into their applications by interacting with [OpenAI REST API v1](https://platform.openai.com/docs/api-reference/assistants). This connector provides tools to build powerful [OpenAI Assistants](https://platform.openai.com/docs/assistants/overview) capable of performing a wide range of tasks, such as generating human-like text, managing conversations with persistent threads, and utilizing multiple tools in parallel. OpenAI has recently announced a variety of new features and improvements to the Assistants API, moving their Beta to a [new API version](https://platform.openai.com/docs/assistants/whats-new), `OpenAI-Beta: assistants=v2`. The users can interact with both the API v1 and v2 by [passing the respective API version header with the request.](https://platform.openai.com/docs/assistants/migration/changing-beta-versions)
The `ballarinax/openai.assistants` connector allows developers to seamlessly integrate OpenAI's advanced language models into their applications by interacting with [OpenAI REST API v1](https://platform.openai.com/docs/api-reference/assistants). This connector provides tools to build powerful [OpenAI Assistants](https://platform.openai.com/docs/assistants/overview) capable of performing a wide range of tasks, such as generating human-like text, managing conversations with persistent threads, and utilizing multiple tools in parallel. OpenAI has recently announced a variety of new features and improvements to the Assistants API, moving their Beta to a [new API version](https://platform.openai.com/docs/assistants/whats-new), `OpenAI-Beta: assistants=v2`. The users can interact with both the API v1 and v2 by [passing the respective API version header with the request.](https://platform.openai.com/docs/assistants/migration/changing-beta-versions)


## Setup guide

To use the OpenAI Connector, you must have access to the OpenAI API through a [OpenAI Platform account](https://platform.openai.com) and a project under it. If you do not have a OpenAI Platform account, you can sign up for one [here](https://platform.openai.com/signup).

#### Create a OpenAI API Key

1. Open the [OpenAI Platform Dashboard](https://platform.openai.com).


2. Navigate to Dashboard -> API keys
<img src=https://github.com/user-attachments/assets/b2e09c6d-c15f-4cfa-a596-6328b1383162 alt="OpenAI Platform" style="width: 70%;">

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-openai.assistants/main/docs/setup/resources/navigate-api-key-dashboard.png alt="OpenAI Platform" style="width: 70%;">

3. Click on the "Create new secret key" button
<img src=https://github.com/user-attachments/assets/bf1adab4-5e3f-4094-9a56-5b4c3cc3c19e alt="OpenAI Platform" style="width: 70%;">

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-openai.assistants/main/docs/setup/resources/api-key-dashboard.png alt="OpenAI Platform" style="width: 70%;">

4. Fill the details and click on Create secret key
<img src=https://github.com/user-attachments/assets/1c565923-e968-4d5f-9864-7ed2022b8079 alt="OpenAI Platform" style="width: 70%;">

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-openai.assistants/main/docs/setup/resources/create-new-secret-key.png alt="OpenAI Platform" style="width: 70%;">

5. Store the API key securely to use in your application
<img src=https://github.com/user-attachments/assets/bbbf8f38-d551-40ee-9664-f4cf2bd98997 alt="OpenAI Platform" style="width: 70%;">
<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-openai.assistants/main/docs/setup/resources/saved-key.png alt="OpenAI Platform" style="width: 70%;">


## Quickstart

Expand Down Expand Up @@ -99,8 +94,8 @@ bal run

## Examples

The `OpenAI Assistants` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/module-ballerinax-openai-assistants/tree/main/examples/), covering the following use cases:
The `OpenAI Assistants` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples), covering the following use cases:

1. [Math tutor bot](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/Math-tutor-bot) - Create an assistant to solve mathematical problems with step-by-step solutions and interactive guidance.
1. [Math tutor bot](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/math-tutor-bot) - Create an assistant to solve mathematical problems with step-by-step solutions and interactive guidance.

2. [Weather assistant](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/Weather-assistant) - Develop an assistant to provide weather information by leveraging function calls for temperature and rain probability.
2. [Weather assistant](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/weather-assistant) - Develop an assistant to provide weather information by leveraging function calls for temperature and rain probability.
22 changes: 9 additions & 13 deletions ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,26 @@

[OpenAI](https://openai.com/), an AI research organization focused on creating friendly AI for humanity, offers the [OpenAI API](https://platform.openai.com/docs/api-reference/introduction) to access its powerful AI models for tasks like natural language processing and image generation.

The `ballarinax/openai.Assistants` connector allows developers to seamlessly integrate OpenAI's advanced language models into their applications by interacting with [OpenAI REST API v1](https://platform.openai.com/docs/api-reference/assistants). This connector provides tools to build powerful [OpenAI Assistants](https://platform.openai.com/docs/assistants/overview) capable of performing a wide range of tasks, such as generating human-like text, managing conversations with persistent threads, and utilizing multiple tools in parallel. OpenAI has recently announced a variety of new features and improvements to the Assistants API, moving their Beta to a [new API version](https://platform.openai.com/docs/assistants/whats-new), `OpenAI-Beta: assistants=v2`. The users can interact with both the API v1 and v2 by [passing the respective API version header with the request.](https://platform.openai.com/docs/assistants/migration/changing-beta-versions)
The `ballarinax/openai.assistants` connector allows developers to seamlessly integrate OpenAI's advanced language models into their applications by interacting with [OpenAI REST API v1](https://platform.openai.com/docs/api-reference/assistants). This connector provides tools to build powerful [OpenAI Assistants](https://platform.openai.com/docs/assistants/overview) capable of performing a wide range of tasks, such as generating human-like text, managing conversations with persistent threads, and utilizing multiple tools in parallel. OpenAI has recently announced a variety of new features and improvements to the Assistants API, moving their Beta to a [new API version](https://platform.openai.com/docs/assistants/whats-new), `OpenAI-Beta: assistants=v2`. The users can interact with both the API v1 and v2 by [passing the respective API version header with the request.](https://platform.openai.com/docs/assistants/migration/changing-beta-versions)

## Setup guide

To use the OpenAI Connector, you must have access to the OpenAI API through a [OpenAI Platform account](https://platform.openai.com) and a project under it. If you do not have a OpenAI Platform account, you can sign up for one [here](https://platform.openai.com/signup).

#### Create a OpenAI API Key

1. Open the [OpenAI Platform Dashboard](https://platform.openai.com).

2. Navigate to Dashboard -> API keys
<img src=https://github.com/user-attachments/assets/b2e09c6d-c15f-4cfa-a596-6328b1383162 alt="OpenAI Platform" style="width: 70%;">

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-openai.assistants/main/docs/setup/resources/navigate-api-key-dashboard.png alt="OpenAI Platform" style="width: 70%;">

3. Click on the "Create new secret key" button
<img src=https://github.com/user-attachments/assets/bf1adab4-5e3f-4094-9a56-5b4c3cc3c19e alt="OpenAI Platform" style="width: 70%;">

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-openai.assistants/main/docs/setup/resources/api-key-dashboard.png alt="OpenAI Platform" style="width: 70%;">

4. Fill the details and click on Create secret key
<img src=https://github.com/user-attachments/assets/1c565923-e968-4d5f-9864-7ed2022b8079 alt="OpenAI Platform" style="width: 70%;">

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-openai.assistants/main/docs/setup/resources/create-new-secret-key.png alt="OpenAI Platform" style="width: 70%;">

5. Store the API key securely to use in your application
<img src=https://github.com/user-attachments/assets/bbbf8f38-d551-40ee-9664-f4cf2bd98997 alt="OpenAI Platform" style="width: 70%;">
<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-openai.assistants/main/docs/setup/resources/saved-key.png alt="OpenAI Platform" style="width: 70%;">


## Quickstart

Expand Down Expand Up @@ -97,8 +93,8 @@ bal run

## Examples

The `OpenAI Assistants` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/module-ballerinax-openai-assistants/tree/main/examples/), covering the following use cases:
The `OpenAI Assistants` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples), covering the following use cases:

1. [Math tutor bot](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/Math-tutor-bot) - Create an assistant to solve mathematical problems with step-by-step solutions and interactive guidance.
1. [Math tutor bot](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/math-tutor-bot) - Create an assistant to solve mathematical problems with step-by-step solutions and interactive guidance.

2. [Weather assistant](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/Weather-assistant) - Develop an assistant to provide weather information by leveraging function calls for temperature and rain probability.
2. [Weather assistant](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/weather-assistant) - Develop an assistant to provide weather information by leveraging function calls for temperature and rain probability.
Binary file added docs/setup/resources/api-key-dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/setup/resources/create-new-secret-key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/setup/resources/saved-key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/spec/sanitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This document records the sanitation done on top of the official OpenAPI specifi
- **Updated**:
- Removed the `default` parameter

- **Reason**: This change is done as a workaround for ballerina openapi tool not allowing to generate the client.
- **Reason**: This change is done as a temporary workaround until the Ballerina OpenAPI tool supports OpenAPI Specification version v3.1.x(Currently supported upto version 3.0.0)

2. **Removed the `status`, `incomplete_objects`, `completed_at`, `attachments` and `incomplete_at` attributes from the required fields of `MessageObject` schema**:

Expand Down
1 change: 0 additions & 1 deletion examples/Math-tutor-bot/.github/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

The `ballerinax/openai.assistants` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples), covering use cases like cache management, session management, and rate limiting.

1. [Math Tutor Bot](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/Math-tutor-bot) - Create an assistant to solve mathematical problems with step-by-step solutions and interactive guidance.
1. [Math Tutor Bot](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/math-tutor-bot) - Create an assistant to solve mathematical problems with step-by-step solutions and interactive guidance.

2. [Weather Assistant](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/Weather-assistant) - Develop an assistant to provide weather information by leveraging function calls for temperature and rain probability.
2. [Weather Assistant](https://github.com/ballerina-platform/module-ballerinax-openai.assistants/tree/main/examples/weather-assistant) - Develop an assistant to provide weather information by leveraging function calls for temperature and rain probability.

## Prerequisites

Expand Down
1 change: 0 additions & 1 deletion examples/Weather-assistant/.github/README.md

This file was deleted.

24 changes: 24 additions & 0 deletions examples/math-tutor-bot/.github/README.md
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 8f49367

Please sign in to comment.