Skip to content

Commit

Permalink
Updated README.md and nlux name casing
Browse files Browse the repository at this point in the history
  • Loading branch information
salmenus committed Feb 14, 2024
1 parent 5a93524 commit 1db2d50
Show file tree
Hide file tree
Showing 51 changed files with 199 additions and 191 deletions.
40 changes: 19 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# [NLUX](https://nlux.ai) 🌲✨💬
# [nlux](https://nlux.ai) 🌲✨💬

![Free And Open Source](https://img.shields.io/badge/Free%20%26%20Open%20Source-1ccb61)
[![npm version](https://img.shields.io/badge/NPM-@nlux/react-1ccb61)](https://www.npmjs.com/package/@nlux/react)
[![Docs NLUX.ai](https://img.shields.io/badge/Docs_Website-NLUX.dev-fa896b)](https://nlux.dev)
[![Docs nlux.ai](https://img.shields.io/badge/Docs_Website-nlux.dev-fa896b)](https://nlux.dev)

## The JS / React Library For Building Conversational AI Interfaces ✨💬

NLUX _(for Natural Language User Experience)_ is an open-source Javascript library that makes it super simple to
[![nlux UI For Any LLM](https://nlux.ai/images/github/nlux-ui-for-llms-banner.gif)](https://nlux.dev)

`nlux` (for Natural Language User Experience) is an open-source Javascript library that makes it super simple to
integrate powerful large language models (LLMs) like ChatGPT into your web app or website. With just a few lines
of code, you can add conversational AI capabilities and interact with your favourite LLM.

Expand All @@ -24,12 +26,12 @@ of code, you can add conversational AI capabilities and interact with your favou

## Repo Content 📦

This GitHub repository contains the source code for the NLUX library.<br />
This GitHub repository contains the source code for the `nlux` library.<br />
It is a monorepo that contains the following NPM packages:

**React JS Packages:**

* [`@nlux/react`](https://www.npmjs.com/package/@nlux/react) ― React JS components for NLUX.
* [`@nlux/react`](https://www.npmjs.com/package/@nlux/react) ― React JS components for `nlux`.
* [`@nlux/langchain-react`](https://www.npmjs.com/package/@nlux/langchain-react) ― React hooks and adapter for APIs
created using LangChain's LangServe library.
* [`@nlux/openai-react`](https://www.npmjs.com/package/@nlux/openai-react) ― React hooks for the OpenAI API.
Expand All @@ -56,25 +58,25 @@ Please visit each package's NPM page for information on how to use it.

## Docs & Examples 🤩

* For developer documentation, examples, and API reference ― please visit: **[NLUX.dev](https://nlux.dev/)**
* For developer documentation, examples, and API reference ― please visit: **[nlux.dev](https://nlux.dev/)**

## Design Principles ⚜️

The following design principles guide the development of NLUX:
The following design principles guide the development of `nlux`:

* **Intuitive** ― Interactions enabled by NLUX should be intuitive.
* **Intuitive** ― Interactions enabled by `nlux` should be intuitive.
Usage should unfold naturally without obstacles or friction. No teaching or thinking
should be required to use UI built with NLUX.
should be required to use UI built with `nlux`.

* **Performance**NLUX should be as fast as possible. Fast to load, fast to render
* **Performance**`nlux` should be as fast as possible. Fast to load, fast to render
and update, fast to respond to user input. To achieve that, we should avoid unnecessary
work, optimize for performance, minimize bundle size, and not depend on external libraries.

* **Accessibility** ― UI built with NLUX should be accessible to everyone. It should be usable
* **Accessibility** ― UI built with `nlux` should be accessible to everyone. It should be usable
by people with disabilities, on various devices, in various environments, and using various
input methods (keyboard, touch, voice).

* **DX**NLUX recognizes developers as first-class citizens. The library should enable an
* **DX**`nlux` recognizes developers as first-class citizens. The library should enable an
optimal DX (developer experience). It should be effortless to use, easy to understand, and
simple to extend. Stellar documentation should be provided. The feature roadmap should evolve
aligning to developer needs voiced.
Expand All @@ -86,25 +88,21 @@ cross platforms, with a focus on performance and usability.

## Community & Support 🙏

---

* **Star The Repo** 🌟 ― If you like NLUX, please star the repo to show your support.

---

* **Star The Repo** 🌟 ― If you like `nlux`, please star the repo to show your support.
Your support is what keeps this open-source project going ! 🧡
* **[GitHub Discussions](https://github.com/nluxai/nlux/discussions)** ― Ask questions, report issues, and share your
ideas with the community.
* **[Discord Community](https://discord.gg/VY4TDaf4)** ― Join our Discord server to chat with the community and get
support.
* **[NLUX.dev](https://nlux.dev/)** Developers Website ― Examples, learning resources, and API reference.
* **[nlux.dev](https://nlux.dev/)** Developer Website ― Examples, learning resources, and API reference.

## License 📃

NLUX is licensed under the terms of the Mozilla Public License 2.0.<br />
`nlux` is licensed under the terms of the Mozilla Public License 2.0.<br />
Wondering what that means? Learn more on [MPL 2.0 FAQ](https://www.mozilla.org/en-US/MPL/2.0/FAQ/).

## About The Developer 👨‍💻

NLUX is a new open-source project that's being led by [Salmen Hichri](https://github.com/salmenus), a senior front-end
`nlux` is a new open-source project that's being led by [Salmen Hichri](https://github.com/salmenus), a senior front-end
engineer with over a decade of experience building user interfaces and developer
tools at companies like Amazon and Goldman Sachs, and contributions to open-source projects.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nlux/monorepo",
"version": "latest",
"description": "NLUX is a JavaScript and React JS library for building conversational AI experiences.",
"description": "nlux is a JavaScript and React JS library for building conversational AI experiences.",
"author": "Salmen Hichri",
"license": "MPL-2.0",
"homepage": "https://nlux.ai",
Expand All @@ -27,7 +27,7 @@
"devDependencies": {
"symlink-dir": "^5.2.1",
"jsdom": "^22.1.0",
"typescript": "5.2.2",
"typescript": "^5.3.3",
"vite": "^5.1.0"
},
"bugs": "https://github.com/nluxai/nlux/issues",
Expand Down
34 changes: 17 additions & 17 deletions packages/js/core/src/core/aiChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class AiChat implements IAiChat {
if (!this.controller) {
throw new NluxRenderingError({
source: this.constructor.name,
message: 'Unable to hide. NLUX is not mounted.',
message: 'Unable to hide. nlux is not mounted.',
});
}

Expand All @@ -49,7 +49,7 @@ export class AiChat implements IAiChat {
if (this.mounted) {
throw new NluxUsageError({
source: this.constructor.name,
message: 'Unable to create NLUX instance. NLUX is already mounted. '
message: 'Unable to create nlux instance. nlux is already mounted. '
+ 'Make sure to call `unmount()` before mounting again.',
});
}
Expand All @@ -63,8 +63,8 @@ export class AiChat implements IAiChat {
if (!adapterToUser) {
throw new NluxValidationError({
source: this.constructor.name,
message: 'Unable to create NLUX instance. Adapter is not properly set. '
+ 'You should call `withAdapter(adapter)` method before mounting NLUX.',
message: 'Unable to create nlux instance. Adapter is not properly set. '
+ 'You should call `withAdapter(adapter)` method before mounting nlux.',
});
}

Expand Down Expand Up @@ -144,18 +144,18 @@ export class AiChat implements IAiChat {
if (!this.controller) {
throw new NluxRenderingError({
source: this.constructor.name,
message: 'Unable to show. NLUX is not mounted.',
message: 'Unable to show. nlux is not mounted.',
});
}

this.controller.show();
}

public unmount() {
debug('Unmounting NLUX.');
debug('Unmounting nlux.');

if (!this.controller) {
debug('Invalid call to aiChat.unmount() on an already unmounted NLUX instance!');
debug('Invalid call to aiChat.unmount() on an already unmounted nlux instance!');
return;
}

Expand All @@ -175,7 +175,7 @@ export class AiChat implements IAiChat {
if (!this.controller) {
throw new NluxRenderingError({
source: this.constructor.name,
message: 'Unable to update props. NLUX is not mounted.',
message: 'Unable to update props. nlux is not mounted.',
});
}

Expand All @@ -186,7 +186,7 @@ export class AiChat implements IAiChat {
if (this.mounted) {
throw new NluxUsageError({
source: this.constructor.name,
message: 'Unable to set adapter. NLUX is already mounted.',
message: 'Unable to set adapter. nlux is already mounted.',
});
}

Expand Down Expand Up @@ -234,7 +234,7 @@ export class AiChat implements IAiChat {
if (this.mounted) {
throw new NluxUsageError({
source: this.constructor.name,
message: 'Unable to set class name. NLUX is already mounted.',
message: 'Unable to set class name. nlux is already mounted.',
});
}

Expand All @@ -253,7 +253,7 @@ export class AiChat implements IAiChat {
if (this.mounted) {
throw new NluxUsageError({
source: this.constructor.name,
message: 'Unable to set conversation options. NLUX is already mounted.',
message: 'Unable to set conversation options. nlux is already mounted.',
});
}

Expand All @@ -272,7 +272,7 @@ export class AiChat implements IAiChat {
if (this.mounted) {
throw new NluxUsageError({
source: this.constructor.name,
message: 'Unable to set conversation history. NLUX is already mounted.',
message: 'Unable to set conversation history. nlux is already mounted.',
});
}

Expand All @@ -291,7 +291,7 @@ export class AiChat implements IAiChat {
if (this.mounted) {
throw new NluxUsageError({
source: this.constructor.name,
message: 'Unable to set layout options. NLUX is already mounted.',
message: 'Unable to set layout options. nlux is already mounted.',
});
}

Expand All @@ -311,7 +311,7 @@ export class AiChat implements IAiChat {
if (this.mounted) {
throw new NluxUsageError({
source: this.constructor.name,
message: 'Unable to set personaOptions. NLUX is already mounted.',
message: 'Unable to set personaOptions. nlux is already mounted.',
});
}

Expand All @@ -330,7 +330,7 @@ export class AiChat implements IAiChat {
if (this.mounted) {
throw new NluxUsageError({
source: this.constructor.name,
message: 'Unable to set prompt box options. NLUX is already mounted.',
message: 'Unable to set prompt box options. nlux is already mounted.',
});
}

Expand All @@ -349,7 +349,7 @@ export class AiChat implements IAiChat {
if (this.mounted) {
throw new NluxUsageError({
source: this.constructor.name,
message: 'Unable to set code highlighter. NLUX is already mounted.',
message: 'Unable to set code highlighter. nlux is already mounted.',
});
}

Expand All @@ -368,7 +368,7 @@ export class AiChat implements IAiChat {
if (this.mounted) {
throw new NluxUsageError({
source: this.constructor.name,
message: 'Unable to set theme. NLUX is already mounted.',
message: 'Unable to set theme. nlux is already mounted.',
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/js/core/src/types/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface Adapter {
fetchText?: (message: string, extras: AdapterExtras) => Promise<string>;

/**
* This method should be implemented by any adapter to be used with NLUX.
* This method should be implemented by any adapter to be used with nlux.
* Either this method or `fetchText` (or both) should be implemented by any adapter.
*
* @param {string} message
Expand Down
16 changes: 12 additions & 4 deletions packages/js/hf/src/hf/builder/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import {HfOutputPreProcessor} from '../types/outputPreProcessor';
export interface HfAdapterBuilder extends AdapterBuilder<any, any> {
/**
* Create a new Hugging Face Inference API adapter.
* Adapter users don't need to call this method directly. It will be called by NLUX when the adapter is expected
* Adapter users don't need to call this method directly. It will be called by nlux when the adapter is expected
* to be created.
*
* @returns {StandardAdapter}
*/
create(): StandardAdapter<any, any>;

/**
* The authorization token to use for Hugging Face Inference API.
* This will be passed to the `Authorization` header of the HTTP request.
Expand All @@ -24,9 +25,10 @@ export interface HfAdapterBuilder extends AdapterBuilder<any, any> {
* @returns {AdapterBuilder}
*/
withAuthToken(authToken: string): HfAdapterBuilder;

/**
* Instruct the adapter to connect to API and load data either in streaming mode or in fetch mode.
* The `stream` mode would use protocols such as websockets or server-side events, and NLUX will display data as
* The `stream` mode would use protocols such as websockets or server-side events, and nlux will display data as
* it's being generated by the server. The `fetch` mode would use a single request to fetch data, and the response
* would only be displayed once the entire message is loaded.
*
Expand All @@ -35,17 +37,19 @@ export interface HfAdapterBuilder extends AdapterBuilder<any, any> {
* @returns {AdapterBuilder}
*/
withDataTransferMode(mode: DataTransferMode): HfAdapterBuilder;

/**
* The endpoint to use for Hugging Face Inference API.
* You should provide either a model or an endpoint, but not both.
* For more information, please refer to the
* [NLUX Hugging Face documentation](https://docs.nlux.ai/category/nlux-with-hugging-face).
* [nlux Hugging Face documentation](https://docs.nlux.ai/category/nlux-with-hugging-face).
*
* @optional
* @param {string} endpoint
* @returns {AdapterBuilder}
*/
withEndpoint(endpoint: string): HfAdapterBuilder;

/**
* This function will be called before sending the input to the Hugging Face Inference API.
* It receives the input that the user has typed in the UI, and it should return the input that will be sent to the
Expand All @@ -56,6 +60,7 @@ export interface HfAdapterBuilder extends AdapterBuilder<any, any> {
* @returns {HfAdapterBuilder}
*/
withInputPreProcessor(inputPreProcessor: HfInputPreProcessor): HfAdapterBuilder;

/**
* The maximum number of new tokens that can be generated by the Hugging Face Inference API.
* This is useful if you want to limit the number of tokens that can be generated by the API.
Expand All @@ -66,16 +71,18 @@ export interface HfAdapterBuilder extends AdapterBuilder<any, any> {
* @returns {HfAdapterBuilder}
*/
withMaxNewTokens(maxNewTokens: number): HfAdapterBuilder;

/**
* The model or the endpoint to use for Hugging Face Inference API.
* You should provide either a model or an endpoint, but not both.
* For more information, please refer to the
* [NLUX Hugging Face documentation](https://docs.nlux.ai/category/nlux-with-hugging-face).
* [nlux Hugging Face documentation](https://docs.nlux.ai/category/nlux-with-hugging-face).
*
* @param {string} model
* @returns {AdapterBuilder}
*/
withModel(model: string): HfAdapterBuilder;

/**
* This function will be called after receiving the output from the Hugging Face Inference API, and before
* displaying it to the user. It can be used to preprocess the output before displaying it to the user.
Expand All @@ -86,6 +93,7 @@ export interface HfAdapterBuilder extends AdapterBuilder<any, any> {
* @returns {HfAdapterBuilder}
*/
withOutputPreProcessor(outputPreProcessor: HfOutputPreProcessor): HfAdapterBuilder;

/**
* The initial system to send to the Hugging Face Inference API.
* This will be used during the pre-processing step to construct the payload that will be sent to the API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type LangServeAdapterOptions = {
* at the end of the URL. Example: https://api.example.com/v1/my_runnable/stream
*
* For more information about the LangServe runnable endpoints and how to use them
* with NLUX, please visit https://docs.nlux.ai/learn/adapters/langserve
* with nlux, please visit https://docs.nlux.ai/learn/adapters/langserve
*
*/
url: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/js/openai/src/createAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {OpenAiAdapterBuilderImpl} from './openai/gpt/builders/builderImpl';
export const createUnsafeAdapter = (): OpenAiAdapterBuilder => {
warnOnce('You just have created an OpenAI adapter that connects to the API directly from the browser. '
+ 'This is not recommended for production use. We recommend that you implement a server-side proxy and configure '
+ 'a customized adapter for it. To learn more about how to create custom adapters for NLUX, visit:\n'
+ 'a customized adapter for it. To learn more about how to create custom adapters for nlux, visit:\n'
+ 'https://nlux.dev/learn/adapters/custom-adapters');

return new OpenAiAdapterBuilderImpl();
Expand All @@ -14,7 +14,7 @@ export const createUnsafeAdapter = (): OpenAiAdapterBuilder => {
export const createAdapter = (): OpenAiAdapterBuilder => {
warnOnce('@nlux/openai-react -> createAdapter() is deprecated. You can either use createUnsafeAdapter() or '
+ 'create a custom adapter by implementing the Adapter interface. To learn more about how to create '
+ 'custom adapters for NLUX, visit:\n'
+ 'custom adapters for nlux, visit:\n'
+ 'https://nlux.dev/learn/adapters/custom-adapters');

return createUnsafeAdapter();
Expand Down
Loading

0 comments on commit 1db2d50

Please sign in to comment.