๐ปGenAI Stack API Server
You can simply run a CLI Command to setup GenAI Server, that will generate the script and default configuration files for the server. after that you can update the configuration files with your requirements
genai-stack setup-server --path /path/to/directoryor you can manually setup by following below steps
Create a directory where you intend to set up your GenAI Server. Within this directory, add the following files:
main.py: This Python script serves as the entry point for your GenAI Server.server.conf: This configuration file contains settings related to your database.stack_config.json: This JSON configuration file defines the components and their configurations for your server stack.
your_directory_name/
|-- server.conf
|-- stack_config.json
|-- main.pyConfiguration Files
server.conf
server.confEdit the server.conf file to specify database-related settings.
[database]
database_name = db
database_driver = sqlitedatabase_name: Set this to your preferred database name.database_driver: Specify the database driver to sqlite. Currently, we only support sqlite.
stack_config.json
stack_config.jsonCustomize the stack_config.json file to define the components for your GenAI Server stack.
Customize the components as needed.
Running the Server
main.py:
main.py:In
main.py, you import two functions (read_configurationsandget_current_stack) from thegenai_serverpackage to initialize your GenAI Server.Provide the path to the current folder where your configuration files reside.
read_configurations(path)reads configurations fromserver.confandstack_config.jsonat the specified path and returns two sets of configurations:server_configurations: Specific to your GenAI Server.stack_configurations: Default stack configurations fromstack_config.json, defining the configurations required for the components to work together.
Pass
stack_configurationstoget_current_stack(config=stack_configurations). This function initializes your GenAI Server's stack based on these configurations. The stack is like a toolkit of components, each with its own settings, ready to serve your AI applications.
To start your GenAI Server, use the main.py script. Open a terminal and navigate to the directory where main.py is located. Then, execute the following command:
Your GenAI Server is now up and running, ready to serve AI-based applications and services!
Last updated