A Node.js client application for interacting with LM Studio's large language models locally. This project provides a simple interface to communicate with locally hosted language models through the LM Studio server.
Before you begin, ensure you have the following installed:
- Node.js (v14 or higher)
- LM Studio desktop application
- A compatible language model downloaded through LM Studio
- Clone the repository:
git clone https://github.com/yourusername/lms-project.git
cd lms-project
- Install dependencies:
npm install
- Copy
.env.example
to.env
:
cp .env.example .env
- Configure your environment variables:
SUPABASE_URL=your_supabase_project_url
SUPABASE_ANON_KEY=your_supabase_anon_key
- Sign up for a Supabase account at https://supabase.com
- Create a new project
- Copy your project URL and anon key to your
.env
file - Initialize the Supabase client in your application
- Start the LM Studio server:
lms server start
- In LM Studio desktop app:
- Load your preferred language model
- Ensure the server is running (default port: 1234)
- Note the model path for configuration
- Run the application:
npm start
- Example code for interacting with the model:
import { LMStudioClient } from '@lmstudio/sdk';
const client = new LMStudioClient();
async function generateResponse(prompt) {
const response = await client.complete({
prompt,
temperature: 0.7,
maxTokens: 500
});
return response;
}
- Command-line interaction:
> Enter your prompt: What is artificial intelligence?
> AI: Artificial intelligence refers to the simulation of human intelligence...
The application is deployed on Cloudflare Pages:
- Production URL: https://supabase.oneseco.com
- Automatic deployments from the main branch
- Environment variables are configured in the Cloudflare dashboard
For detailed deployment instructions, see DEPLOY.md.
The source code resides in the src/
directory. For development purposes:
- Make changes to the source files
- Run the project using
npm start
- Test your changes with different prompts and models
This project is licensed under the MIT License - see the LICENSE file for details.