Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ezralazuardy committed Jun 4, 2024
1 parent b91a144 commit 29c1848
Show file tree
Hide file tree
Showing 13 changed files with 1,936 additions and 147 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ jobs:
run: npm ci --legacy-peer-deps
- name: "🔍 Performing Lint"
run: npm run lint
- name: "🧪 Running Tests"
run: npm run test
- name: "🔨 Building Package"
run: npm run build
8 changes: 8 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"loader": "ts-node/esm",
"require": ["ts-node/register", "chai/register-expect.js"],
"extensions": ["ts", "tsx"],
"spec": ["tests/**/*.test.*"],
"watch-files": ["src"],
"allowImportingTsExtensions": true
}
81 changes: 27 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,95 +1,68 @@
<div>
<img alt="Build" src="https://github.com/ezralazuardy/gem/actions/workflows/build.yml/badge.svg" />
<img alt="CodeQL Analysis" src="https://github.com/ezralazuardy/gem/actions/workflows/github-code-scanning/codeql/badge.svg" />
<img alt="NPM License" src="https://img.shields.io/npm/l/%40ezralazuardy%2Fgem" />
<img alt="NPM Unpacked Size" src="https://img.shields.io/npm/v/%40ezralazuardy%2Fgem" />
<img alt="NPM Unpacked Size" src="https://img.shields.io/npm/unpacked-size/%40ezralazuardy%2Fgem" />
<img alt="NPM Type Definitions" src="https://img.shields.io/npm/types/%40ezralazuardy%2Fgem" />
<img alt="Build" src="https://github.com/ezralazuardy/aksara/actions/workflows/build.yml/badge.svg" />
<img alt="CodeQL Analysis" src="https://github.com/ezralazuardy/aksara/actions/workflows/github-code-scanning/codeql/badge.svg" />
<img alt="NPM License" src="https://img.shields.io/npm/l/%40ezralazuardy%2Faksara" />
<img alt="NPM Unpacked Size" src="https://img.shields.io/npm/v/%40ezralazuardy%2Faksara" />
<img alt="NPM Unpacked Size" src="https://img.shields.io/npm/unpacked-size/%40ezralazuardy%2Faksara" />
<img alt="NPM Type Definitions" src="https://img.shields.io/npm/types/%40ezralazuardy%2Faksara" />
</div>

## 💎 gem
## ꦲ aksara

A more fun way to interact with Gemini.
Translate a text into Javanese Script in one line of code.

```typescript
await ask("am i deserve better?");
translate("aksara jawa"); // ꦲꦏ꧀ꦱꦫ​ꦗꦮ
```

Gem is a simple package that allows you to interact with the Gemini API in a more human-friendly way.
Aksara is a simple package that helps you to translate your text into Javanese Script or also known as _Aksara Jawa_, which is one of the most beautiful scripts in the world.

It's like talking to a friend, but in a more professional way. It's simplify the process of sending requests to the Gemini API, so you can focus more on the conversation itself. It's even more simpler than other API wrappers.
The translated text will be formatted as [Unicode](https://home.unicode.org) string of Javanese Script characters that can be used in any text editor or web browser, without any specific font requirement.

> 🚧 This package is still under heavy development. Beware of breaking changes.
It's also typescript compatible, so you can use it in any javascript or typescript project.

> Reference: [Wikipedia](https://en.wikipedia.org/wiki/Javanese_script)
<br/>

### 🚀 Getting Started

It's only require 3 simple steps to get started.
It's only require 2 simple steps to get started.

Install the package

```bash
npm install @ezralazuardy/gem
```

Set the environment variables

```bash
GEMINI_API_KEY="<YOUR_GEMINI_API_KEY>"
npm install @ezralazuardy/aksara
```

Ask the Gemini.
And use it!

```typescript
import { ask } from "@ezralazuardy/gem";
import { translate } from "@ezralazuardy/aksara";

const response = await ask("what is the weather today?");

console.log(response);
console.log(translate("aksara jawa")); // ꦲꦏ꧀ꦱꦫ​ꦗꦮ
```

Yup, just like that! Simple, right?

For advanced usage, please read the [documentation](#-documentation) below.

<br/>

### ⚙️ Using Specific Model

By default, the model used is `gemini-pro`. You can change it by setting the `GEMINI_MODEL_ID` environment variable.

```bash
GEMINI_MODEL_ID="gemini-pro"
```

Please beware of the pricing and capabilities of each model.

As of `v0.0.1`, the following models are available:

- `gemini-pro` (default)
- `gemini-1.5-pro-latest`
### 🔄 Revert Translation

> Plase refer to these references:
> [Gemini API Models](https://ai.google.dev/gemini-api/docs/models/gemini), [Gemini API Pricing](https://ai.google.dev/gemini-api/pricing).
If you want to revert the translation, you can just use the `translate` function again.

<br/>

### 🚥 Roadmap
```typescript
import { translate } from "@ezralazuardy/aksara";

The following features are planned to be implemented in the future.
console.log(translate("ꦲꦏ꧀ꦱꦫ​ꦗꦮ")); // aksara jawa
```

| Supported | Method | Version | Usage |
| --------- | ---------------- | --------- | -------------------------------------------------------- |
| 🟢 | `ask` | `v0.0.1+` | Generates text for a given prompt. |
| 🔴 | `askByStream` | `-` | Streams a text generations. |
| 🔴 | `object` | `-` | Generates a typed, structured object for a given prompt. |
| 🔴 | `objectByStream` | `-` | Streams a typed, structured object for a given prompt. |
No need to use other function. Simple, right?

<br/>

### 📖 Documentation

A proper documentation is still in progress 🥲

> Written in [Typescript](https://www.typescriptlang.org). Heavily inspired by [Vercel AI](https://sdk.vercel.ai) and [Gemini](https://gemini.google.com).
> Written in [Typescript](https://www.typescriptlang.org). Heavily inspired by [@bennylin](https://github.com/bennylin).
Binary file added bun.lockb
Binary file not shown.
15 changes: 3 additions & 12 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js";
import { fixupConfigRules } from "@eslint/compat";


export default [
{
languageOptions: { globals: globals.node },
settings: {
react: {
version: "detect",
},
},
},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
...fixupConfigRules(pluginReactConfig),
];
];
45 changes: 20 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
{
"name": "@ezralazuardy/gem",
"version": "0.0.8",
"description": "💎 A more fun way to interact with Gemini.",
"name": "@ezralazuardy/aksara",
"version": "0.0.1",
"description": "ꦲ Headless javanese script translator.",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"/dist"
],
"scripts": {
"build": "tsc",
"lint": "eslint src/ --cache",
"prepare": "npm run build && npm run lint"
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ezralazuardy/gem.git"
"url": "git+https://github.com/ezralazuardy/aksara.git"
},
"keywords": [
"gem",
"gemini",
"google",
"ai",
"aksara",
"javanese",
"jawa",
"translate",
"npm",
"pnpm",
"yarn",
Expand All @@ -31,36 +30,32 @@
"author": "Ezra Lazuardy <ezralazuardy@icloud.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/ezralazuardy/gem/issues"
"url": "https://github.com/ezralazuardy/aksara/issues"
},
"homepage": "https://github.com/ezralazuardy/gem#readme",
"homepage": "https://github.com/ezralazuardy/aksara#readme",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@ai-sdk/google": "^0.0.14",
"ai": "^3.1.12",
"dotenv": "^16.4.5",
"openai": "^4.47.1",
"react": "^18.3.1",
"typescript": "^5.4.5",
"zod": "^3.23.8"
"typescript": "^5.4.5"
},
"devDependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@eslint/compat": "^1.0.1",
"@eslint/js": "^9.3.0",
"@types/json-schema": "^7.0.15",
"@eslint/js": "^9.4.0",
"@types/chai": "^4.3.16",
"@types/mocha": "^10.0.6",
"@types/node": "^20.12.12",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"@typescript-eslint/type-utils": "^7.10.0",
"@typescript-eslint/utils": "^7.10.0",
"eslint": "^8.56.0",
"chai": "^4.4.1",
"eslint": "9.x",
"eslint-plugin-react": "^7.34.1",
"globals": "^15.3.0",
"typescript-eslint": "^7.10.0"
"mocha": "^10.4.0",
"ts-node": "^10.9.2",
"typescript-eslint": "^7.12.0"
}
}
Loading

0 comments on commit 29c1848

Please sign in to comment.