Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(azure-openai): ask GPT action #3897

Merged
merged 5 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@angular/router": "16.2.6",
"@auth0/angular-jwt": "5.1.2",
"@aws-sdk/client-s3": "3.398.0",
"@azure/openai": "1.0.0-beta.11",
"@babel/runtime": "7.22.11",
"@bull-board/api": "5.9.1",
"@bull-board/fastify": "5.9.1",
Expand Down
33 changes: 33 additions & 0 deletions packages/pieces/community/azure-openai/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": [
"../../../../.eslintrc.json"
],
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions packages/pieces/community/azure-openai/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# pieces-azure-openai

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build pieces-azure-openai` to build the library.
4 changes: 4 additions & 0 deletions packages/pieces/community/azure-openai/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "@activepieces/piece-azure-openai",
"version": "0.0.1"
}
43 changes: 43 additions & 0 deletions packages/pieces/community/azure-openai/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "pieces-azure-openai",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/pieces/community/azure-openai/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": [
"{options.outputPath}"
],
"options": {
"outputPath": "dist/packages/pieces/community/azure-openai",
"tsConfig": "packages/pieces/community/azure-openai/tsconfig.lib.json",
"packageJson": "packages/pieces/community/azure-openai/package.json",
"main": "packages/pieces/community/azure-openai/src/index.ts",
"assets": [
"packages/pieces/community/azure-openai/*.md"
],
"buildableProjectDepsInPackageJsonType": "dependencies",
"updateBuildableProjectDepsInPackageJson": true
}
},
"publish": {
"command": "node tools/scripts/publish.mjs pieces-azure-openai {args.ver} {args.tag}",
"dependsOn": [
"build"
]
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": [
"{options.outputFile}"
],
"options": {
"lintFilePatterns": [
"packages/pieces/community/azure-openai/**/*.ts"
]
}
}
},
"tags": []
}
40 changes: 40 additions & 0 deletions packages/pieces/community/azure-openai/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {
createPiece,
PieceAuth,
Property,
} from '@activepieces/pieces-framework';
import { askGpt } from './lib/actions/ask-gpt';

export const azureOpenaiAuth = PieceAuth.CustomAuth({
props: {
endpoint: Property.ShortText({
displayName: 'Endpoint',
description: 'https://<resource name>.openai.azure.com/',
required: true
}),
apiKey: PieceAuth.SecretText({
displayName: 'API Key',
description: 'Use the Azure Portal to browse to your OpenAI resource and retrieve an API key',
required: true,
}),
},
required: true,
});

export type AzureOpenAIAuth = {
endpoint: string
apiKey: string
deploymentId: string
}

export const azureOpenai = createPiece({
displayName: 'Azure OpenAI',
auth: azureOpenaiAuth,
minimumSupportedRelease: '0.9.0',
logoUrl: 'https://cdn.activepieces.com/pieces/azure-openai.png',
authors: ['MoShizzle'],
actions: [
askGpt,
],
triggers: [],
});
Loading
Loading