Skip to content

Commit

Permalink
feat: ci pipeline (#1)
Browse files Browse the repository at this point in the history
* fix CI

* fix ci

* contents read permission

* chore(azure): update env variable name

* chore: move demo to apps/

* chore: fix dotenv

* chore(ci): add provider secrets

* add prettier

* fix(format): entire repo

* chore(ci): add prettier format check

* chore(ci): add lint step

* fix(ci): lint job

* chore: fix build

* fix: build

* fix: format script

* chore(ci): add build step

* bump version

* chore: build adjustment for ejs/cjs

* feat: convert to class

* chore: fix tests

* fix formatting

* fix tests

* chore: edit footer text

* fix formatting

* chore(eslint): ignore dist

* temporarily remove lint from demo
  • Loading branch information
arielweinberger authored Oct 16, 2023
1 parent 3d0ba4d commit 1c7ef95
Show file tree
Hide file tree
Showing 82 changed files with 2,108 additions and 1,677 deletions.
32 changes: 20 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ on:
pull_request:
branches:
- "*"
paths-ignore:
- "**/*.md"
- "docs"
paths-ignore:
- "**/*.md"
- "docs"
push:
branches:
- "*"
paths-ignore:
- "**/*.md"
- "docs"

jobs:
ci:
name: Continuous Integration
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
Expand All @@ -40,16 +44,20 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

# - name: Check Formatting
# run: npx nx format:check --all --verbose
- name: Check Formatting
run: npx prettier . --check

# - name: Lint
# run: npx nx run-many --target=lint --all --parallel --maxParallel=3
- name: Lint
run: npx turbo run lint

- name: Test
run: npx turbo run test

# - name: Build
# run: |
# npx nx graphql:generate --skip-nx-cache
# npx nx run-many --target=build --all --parallel --maxParallel=3
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_DEPLOYMENT: ${{ secrets.AZURE_OPENAI_DEPLOYMENT }}

- name: Build
run: npx turbo run build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ coverage
.next/
out/
build
dist

# misc
.DS_Store
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Add files here to ignore them from prettier formatting
**/.next
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": false
}
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2023 Pezzo, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { OpenAIStream, StreamingTextResponse } from "ai";
import * as UniLLM from "uni-llm";
import { UniLLM } from "uni-llm";

export async function POST(req: Request) {
const { messages, llm } = await req.json();

const response = await UniLLM.createChatCompletion(llm, {
const uniLLM = new UniLLM();

const response = await uniLLM.createChatCompletion(llm, {
temperature: 0,
max_tokens: 500,
messages: [...messages],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import { LLMSelector } from "@/components/LLMSelector";
import { LLMs } from "@/utils/types";
import { Message } from "../../components/Message";
import {
ChatBubbleIcon,
PaperPlaneIcon,
} from "@radix-ui/react-icons";
import { ChatBubbleIcon, PaperPlaneIcon } from "@radix-ui/react-icons";
import { Heading, IconButton, TextField } from "@radix-ui/themes";
import { useChat } from "ai/react";
import { useEffect, useRef, useState } from "react";
Expand Down Expand Up @@ -37,9 +34,7 @@ export default function ChatPage() {
<main className="h-full overflow-hidden">
<div className="h-full flex-col rounded-lg shadow-lg flex bg-neutral-100 bg-opacity-10 ">
<div className="grid grid-flow-row-dense grid-cols-12 gap-4 h-14 items-center justify-center ">
<div className="col-span-2 pl-4 pt-1">

</div>
<div className="col-span-2 pl-4 pt-1"></div>
<div className="flex-1 text-center col-span-8">
<Heading size="3">
<LLMSelector value={llm} onChange={(value) => setLLM(value)} />
Expand Down
File renamed without changes.
File renamed without changes.
11 changes: 8 additions & 3 deletions packages/demo/app/layout.tsx → apps/demo/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ export default function RootLayout({
<LoadingProvider>
<div className="h-full max-h-screen flex flex-col p-12">
<div className="flex-grow overflow-y-auto">{children}</div>
<footer className="h-14 mt-6 text-center flex items-center justify-center text-stone-500">
Built with ❤️ by Ariel Weinberger - OpenAI Bootcamp For
JavaScript Developers
<footer className="h-14 mt-6 text-center flex items-center justify-center text-stone-400">
Uni-LLM 🦄 - One API to rule them all!{" "}
<a
className="ml-2 font-semibold text-emerald-400 underline"
href="https://github.com/pezzolabs/Uni-LLM"
>
Check us out on GitHub!
</a>
</footer>
</div>
</LoadingProvider>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const llms: {
},
{
name: "Azure OpenAI",
value: LLMs["azure:pezzogpt35turbo"],
value: LLMs["azure:gpt35turbo"],
},
];

Expand All @@ -31,10 +31,7 @@ type Props = {

export const LLMSelector = ({ onChange, value }: Props) => {
return (
<Select.Root
value={value}
onValueChange={(value) => onChange(value)}
>
<Select.Root value={value} onValueChange={(value) => onChange(value)}>
<Select.Trigger />
<Select.Content>
<Select.Group>
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions apps/demo/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};

module.exports = nextConfig;
5 changes: 2 additions & 3 deletions packages/demo/package.json → apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"dev": "dotenv -- next dev",
"start": "next start",
"lint": "next lint"
"format": "prettier --write ."
},
"dependencies": {
"@radix-ui/react-icons": "^1.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module.exports = {
tailwindcss: {},
autoprefixer: {},
},
}
};
File renamed without changes
File renamed without changes
20 changes: 20 additions & 0 deletions apps/demo/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Config } from "tailwindcss";

const config: Config = {
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
backgroundImage: {
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
"gradient-conic":
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
},
},
},
plugins: [],
};
export default config;
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/demo/utils/types.ts → apps/demo/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export const LLMs = {
"openai:gpt-3.5-turbo": "openai:gpt-3.5-turbo",
"openai:gpt-4": "openai:gpt-4",
"anthropic:claude-2": "anthropic:claude-2",
"azure:pezzogpt35turbo": "azure:pezzogpt35turbo",
}
"azure:gpt35turbo": "azure:gpt35turbo",
};
3 changes: 0 additions & 3 deletions apps/docs/.eslintrc.js

This file was deleted.

34 changes: 0 additions & 34 deletions apps/docs/.gitignore

This file was deleted.

28 changes: 0 additions & 28 deletions apps/docs/README.md

This file was deleted.

Binary file removed apps/docs/app/favicon.ico
Binary file not shown.
50 changes: 0 additions & 50 deletions apps/docs/app/globals.css

This file was deleted.

22 changes: 0 additions & 22 deletions apps/docs/app/layout.tsx

This file was deleted.

Loading

0 comments on commit 1c7ef95

Please sign in to comment.