Skip to content

Commit

Permalink
Changed library name to @boldare/openai-assistant (#43)
Browse files Browse the repository at this point in the history
* refactor: renamed package name ai-assistant -> openai-assistant
  • Loading branch information
sebastianmusial authored Mar 15, 2024
1 parent 73196c9 commit 51efa7a
Show file tree
Hide file tree
Showing 86 changed files with 59 additions and 51 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<p align="center">
<a href="https://assistant.ai.boldare.dev/chat" target="_blank">demo</a> 🔹
<a href="https://assistant.ai.boldare.dev/api/docs" target="_blank">api docs</a> 🔹
<a href="https://www.npmjs.com/package/@boldare/ai-assistant" target="_blank">npm</a> 🔹
<a href="https://github.com/boldare/ai-assistant" target="_blank">github</a>
<a href="https://www.npmjs.com/package/@boldare/openai-assistant" target="_blank">npm</a> 🔹
<a href="https://github.com/boldare/openai-assistant" target="_blank">github</a>
</p>

# 🤖 AI Assistant
Expand Down Expand Up @@ -50,7 +50,7 @@ nest new project-name
Install the library using npm:

```bash
npm i @boldare/ai-assistant --save
npm i @boldare/openai-assistant --save
```

### Step 2: Env variables
Expand Down Expand Up @@ -111,7 +111,7 @@ Import the AI Assistant module with your configuration into the module file wher
export class ChatbotModule {}
```

Automatically, the library will add WebSockets ([chat.gateway.ts](libs/ai-assistant/src/lib/chat/chat.gateway.ts)) and a [REST API](https://assistant.ai.boldare.dev/api/docs) for the assistant. The WebSocket server will be available at the `/` endpoint, and the [REST API](https://assistant.ai.boldare.dev/api/docs) will be available at the `/api` endpoint (depending on the API prefix).
Automatically, the library will add WebSockets ([chat.gateway.ts](libs/openai-assistant/src/lib/chat/chat.gateway.ts)) and a [REST API](https://assistant.ai.boldare.dev/api/docs) for the assistant. The WebSocket server will be available at the `/` endpoint, and the [REST API](https://assistant.ai.boldare.dev/api/docs) will be available at the `/api` endpoint (depending on the API prefix).

#### Websockets events

Expand Down Expand Up @@ -170,7 +170,7 @@ Import the service into the module file where you intend to use it:

```js
import { Module } from '@nestjs/common';
import { AgentModule } from '@boldare/ai-assistant';
import { AgentModule } from '@boldare/openai-assistant';
import { GetNicknameAgent } from './get-nickname.agent';

@Module({
Expand All @@ -195,12 +195,12 @@ export class ChatModule {}

The repository includes a library with an AI assistant as well as other useful parts:

| Name | Description | More |
|-------------------------|---------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| `@boldare/ai-assistant` | A NestJS library based on the OpenAI Assistant for building efficient, scalable, and quick solutions for AI assistants/chatbots | [Documentation](https://github.com/boldare/ai-assistant/wiki/%F0%9F%A4%96-AI-Assistant) |
| `@boldare/ai-embedded` | The code enables embedding the chatbot on various websites through JavaScript scripts. | [Documentation](https://github.com/boldare/ai-assistant/wiki/%F0%9F%96%87-Integrating-Chatbot-into-Your-Website) |
| `api` | Example usage of the `@boldare/ai-assistant` library. | [Documentation](https://github.com/boldare/ai-assistant/wiki/%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-Repository) |
| `spa` | Example client application (SPA) with a chatbot. | [Documenation](https://github.com/boldare/ai-assistant/wiki/%F0%9F%92%AC-Chatbot-%E2%80%90-Client-application) |
| Name | Description | More |
|-------------------------|---------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|
| `@boldare/openai-assistant` | A NestJS library based on the OpenAI Assistant for building efficient, scalable, and quick solutions for AI assistants/chatbots | [Documentation](https://github.com/boldare/openai-assistant/wiki/%F0%9F%A4%96-AI-Assistant) |
| `@boldare/ai-embedded` | The code enables embedding the chatbot on various websites through JavaScript scripts. | [Documentation](https://github.com/boldare/openai-assistant/wiki/%F0%9F%96%87-Integrating-Chatbot-into-Your-Website) |
| `api` | Example usage of the `@boldare/openai-assistant` library. | [Documentation](https://github.com/boldare/openai-assistant/wiki/%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-Repository) |
| `spa` | Example client application (SPA) with a chatbot. | [Documenation](https://github.com/boldare/openai-assistant/wiki/%F0%9F%92%AC-Chatbot-%E2%80%90-Client-application) |

## Getting started

Expand Down Expand Up @@ -244,4 +244,4 @@ Now you can open your browser and navigate to:

# License

`@boldare/ai-assistant` is MIT licensed
`@boldare/openai-assistant` is MIT licensed
2 changes: 1 addition & 1 deletion apps/api/src/app/chat/agents/agents.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Module } from '@nestjs/common';
import { GetAnimalAgent } from './get-animal.agent';
import { AgentModule } from '@boldare/ai-assistant';
import { AgentModule } from '@boldare/openai-assistant';

@Module({
imports: [AgentModule],
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/app/chat/agents/get-animal.agent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common';
import { AssistantCreateParams } from 'openai/resources/beta';
import { AgentBase, AgentData, AgentService } from '@boldare/ai-assistant';
import { AgentBase, AgentData, AgentService } from '@boldare/openai-assistant';

@Injectable()
export class GetAnimalAgent extends AgentBase {
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/app/chat/chat.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AssistantCreateParams } from 'openai/resources/beta';
import { AssistantConfigParams } from '@boldare/ai-assistant';
import { AssistantConfigParams } from '@boldare/openai-assistant';
import 'dotenv/config';

export const assistantParams: AssistantCreateParams = {
name: '@boldare/ai-assistant',
name: '@boldare/openai-assistant',
instructions: `You are a chatbot assistant. Use the general knowledge to answer questions. Speak briefly and clearly.`,
tools: [{ type: 'code_interpreter' }, { type: 'retrieval' }],
model: 'gpt-4-1106-preview',
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/app/chat/chat.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Module } from '@nestjs/common';
import { AssistantModule } from '@boldare/ai-assistant';
import { AssistantModule } from '@boldare/openai-assistant';
import { assistantConfig } from './chat.config';
import { AgentsModule } from './agents/agents.module';

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ async function bootstrap() {
const app = await NestFactory.create(AppModule);
const globalPrefix = 'api';
const config = new DocumentBuilder()
.setTitle('@boldare/ai-assistant')
.setTitle('@boldare/openai-assistant')
.setVersion('0.1.0')
.build();
const document = SwaggerModule.createDocument(app, config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Message, SpeechVoice } from '../../../modules/+chat/shared/chat.model';
import { environment } from '../../../../environments/environment';
import { MatIconModule } from '@angular/material/icon';
import { delay } from 'rxjs';
import { ChatAudioResponse, PostSpeechDto } from '@boldare/ai-assistant';
import { ChatAudioResponse, PostSpeechDto } from '@boldare/openai-assistant';
import { NgClass } from '@angular/common';

@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<img [src]="'/assets/boldare.svg'" alt="Boldare" class="chat__logo" routerLink="/" />
<img
[src]="'/assets/boldare.svg'"
alt="Boldare"
class="chat__logo"
routerLink="/" />

<div class="chat__nav">
<a
href="https://github.com/boldare/ai-assistant/wiki"
href="https://github.com/boldare/openai-assistant/wiki"
target="_blank"
class="chat__link">
Documentation
Expand All @@ -16,14 +20,14 @@
</a>
🔹
<a
href="https://github.com/boldare/ai-assistant"
href="https://github.com/boldare/openai-assistant"
target="_blank"
class="chat__link">
GitHub
</a>
🔹
<a
href="https://www.npmjs.com/package/@boldare/ai-assistant"
href="https://www.npmjs.com/package/@boldare/openai-assistant"
target="_blank"
class="chat__link">
NPM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
PostSpeechDto,
UploadFilesPayload,
UploadFilesResponseDto,
} from '@boldare/ai-assistant';
} from '@boldare/openai-assistant';

@Injectable({ providedIn: 'root' })
export class ChatClientService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { FilesService } from '../../../components/controls';
import { ChatClientService } from './chat-client.service';
import { OpenAiFile } from '@boldare/ai-assistant';
import { OpenAiFile } from '@boldare/openai-assistant';

@Injectable({ providedIn: 'root' })
export class ChatFilesService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { ChatEvents } from './chat.model';
import io from 'socket.io-client';
import { ChatCallDto } from '@boldare/ai-assistant';
import { ChatCallDto } from '@boldare/openai-assistant';
import { Observable } from 'rxjs';
import { environment } from '../../../../environments/environment';

Expand Down
2 changes: 1 addition & 1 deletion apps/spa/src/app/modules/+chat/shared/chat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ChatClientService } from './chat-client.service';
import { ThreadService } from './thread.service';
import { ChatFilesService } from './chat-files.service';
import { environment } from '../../../../environments/environment';
import { OpenAiFile, GetThreadResponseDto } from '@boldare/ai-assistant';
import { OpenAiFile, GetThreadResponseDto } from '@boldare/openai-assistant';
import { Threads } from 'openai/resources/beta';
import MessageContentText = Threads.MessageContentText;
import { ThreadMessage } from 'openai/resources/beta/threads';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { CreateThreadDto, GetThreadResponseDto } from '@boldare/ai-assistant';
import {
CreateThreadDto,
GetThreadResponseDto,
} from '@boldare/openai-assistant';
import { Observable } from 'rxjs';
import { environment } from '../../../../environments/environment';

Expand Down
2 changes: 1 addition & 1 deletion apps/spa/src/app/modules/+chat/shared/thread.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BehaviorSubject, Observable, Subject, take, tap } from 'rxjs';
import { environment } from '../../../../environments/environment';
import { ThreadClientService } from './thread-client.service';
import { ConfigurationFormService } from '../../+configuration/shared/configuration-form.service';
import { GetThreadResponseDto } from '@boldare/ai-assistant';
import { GetThreadResponseDto } from '@boldare/openai-assistant';

@Injectable({ providedIn: 'root' })
export class ThreadService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { CreateThreadDto } from '@boldare/ai-assistant';
import { CreateThreadDto } from '@boldare/openai-assistant';
import { ConfigurationForm } from './configuration.model';
import { MessageStatus, SpeechVoice } from '../../+chat/shared/chat.model';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export default {
displayName: 'ai-assistant',
displayName: 'openai-assistant',
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/libs/ai-assistant',
coverageDirectory: '../../coverage/libs/openai-assistant',
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@boldare/ai-assistant",
"version": "0.0.2-dev.6",
"name": "@boldare/openai-assistant",
"description": "NestJS library for building chatbot solutions based on the OpenAI Assistant API",
"version": "0.0.1-dev.1",
"private": false,
"dependencies": {
"tslib": "^2.3.0",
Expand All @@ -18,7 +19,7 @@
"type": "commonjs",
"main": "./src/index.js",
"typings": "./src/index.d.ts",
"homepage": "https://github.com/boldare/ai-assistant",
"homepage": "https://github.com/boldare/openai-assistant",
"keywords": [
"ai",
"assistant",
Expand All @@ -38,6 +39,6 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/boldare/ai-assistant.git"
"url": "git+https://github.com/boldare/openai-assistant.git"
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "ai-assistant",
"name": "openai-assistant",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/ai-assistant/src",
"sourceRoot": "libs/openai-assistant/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/ai-assistant",
"tsConfig": "libs/ai-assistant/tsconfig.lib.json",
"packageJson": "libs/ai-assistant/package.json",
"main": "libs/ai-assistant/src/index.ts",
"assets": ["libs/ai-assistant/*.md"]
"outputPath": "dist/libs/openai-assistant",
"tsConfig": "libs/openai-assistant/tsconfig.lib.json",
"packageJson": "libs/openai-assistant/package.json",
"main": "libs/openai-assistant/src/index.ts",
"assets": ["libs/openai-assistant/*.md"]
}
},
"publish": {
Expand All @@ -27,7 +27,7 @@
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/ai-assistant/jest.config.ts"
"jestConfig": "libs/openai-assistant/jest.config.ts"
}
}
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class PostSpeechResponseDto {
}

export class PostTranscriptionDto {
@ApiProperty({type: 'string', format: 'binary'})
@ApiProperty({ type: 'string', format: 'binary' })
file!: File;
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"build": "npm run build:ai-embedded && npm run build:spa && npm run build:api",
"build:spa": "nx build --prod --skip-nx-cache spa",
"build:api": "nx build --prod api",
"build:ai-assistant": "nx build --prod ai-assistant",
"build:openai-assistant": "nx build --prod openai-assistant",
"build:ai-embedded": "nx build --prod ai-embedded --no-cache && npm run cp:ai-embedded",
"publish": "npm run build:ai-assistant && npm run cp:readme && cd dist/libs/ai-assistant/ && npm publish --access=public && cd ../../..",
"publish": "npm run build:openai-assistant && npm run cp:readme && cd dist/libs/openai-assistant/ && npm publish --access=public && cd ../../..",
"cp:ai-embedded": "cp ./dist/libs/ai-embedded/main.js ./apps/spa/src/assets/js/ai-embedded.js",
"cp:readme": "cp ./README.md ./dist/libs/ai-assistant/README.md",
"cp:readme": "cp ./README.md ./dist/libs/openai-assistant/README.md",
"lint": "nx run-many --parallel --target=lint --all",
"test:ai-assistant": "nx test ai-assistant",
"test:openai-assistant": "nx test openai-assistant",
"test:spa": "nx test spa",
"test": "nx run-many --parallel --target=test --all",
"format": "nx format:write",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {
"@boldare/ai-assistant": ["libs/ai-assistant/src/index.ts"],
"@boldare/ai-embedded": ["libs/ai-embedded/src/index.ts"]
"@boldare/ai-embedded": ["libs/ai-embedded/src/index.ts"],
"@boldare/openai-assistant": ["libs/openai-assistant/src/index.ts"]
}
},
"exclude": ["node_modules", "tmp"]
Expand Down

0 comments on commit 51efa7a

Please sign in to comment.