Create Projects
Projects in C3 Generative AI refers to the mechanism to handle different vector stores with different sets of documents under an specific configuration. Each Genai.Project defined in the C3 Generative AI system will represent a configuration and a collection of documents to include as valid sources for the queries.
There are two types of Projects that can be defined:
- Genai.Project.Type#TUTORIAL: Read-only projects devised to onboard the user.
- Genai.Project.Type#PRODUCTION: Writable projects with production documents.
Predefined Projects
The system has a default Genai.Project to use with the Generative AI app from the start. The default Project is configured to use the default chunker configuration, and the Genai.Agent.QueryOrchestrator as query handler with the QueryOrchestration_dynamic_Agent configuration.
Default Configuration
- Name: default
- Query Orchestration Config Name: QueryOrchestration_dynamicAgent
- Chunker Config: default
- Handler Type Name: Genai.Agent.QueryOrchestrator
Project Settings
A Genai.Project.Settings is a single, pre-configured instance for the application. It comprises:
- A main default project
- An optional tutorial project
Configuring a Project
The Projects are identified by their name. Query the available Projects using:
Genai.Project.fetch().objs;Creation of a Tutorial Project
Create or update a tutorial Genai.Project with:
tutorial_project = Genai.Project.make({
name: 'custom-tutorial-project',
projectType: 'tutorial',
unstructuredQueryEngineConfigName: 'worldFacts',
chunkerConfig: 'default',
handlerTypeName: 'Genai.UnstructuredQuery.Engine',
}).upsert();Notice that the unstructured query engine config name worldFacts used in the example above is just one of many configurations available that can be assigned to a project definition.
Notice that a Project is defined by it’s type, the chunker configuration and the unstructured query engine configuration. In this case it's defined as a tutorial (read-only) project and the default chunker.
Also notice that the handler type is Genai.UnstructuredQuery.Engine which restricts the Tutorial Project to manage unstructured documents only.
To define a specific collection of document to handle in the project, define or select the specific unstructured query engine configuration with the corresponding chunker configuration used during indexing. Currently with the default configuration there are the following unstructured query engine configurations available:
- c3Documentationv6
- default
- alabamaBond
- worldFacts
Notice that to use projects, the configuration for Genai.ChatBot.Config must set the handler type name to Genai.Project.QueryRouter to allow chatbots to route query requests through them.
Genai.ChatBot.Config.setConfigValue('handlerTypeName', 'Genai.Project.QueryRouter');Creation of a default main Project
Create or update a main default Genai.Project with:
default_project = Genai.Project.make({
name: 'default-custom-alabamaBond',
projectType: 'production',
queryOrchestratorConfigName: 'QueryOrchestrator_default',
chunkerConfig: 'default',
handlerTypeName: 'Genai.Agent.QueryOrchestrator',
}).upsert();Notice that the main custom project has been defined using the Query Orchestrator which allows the use of structured and unstructured data at data retrieval.
Project and Application Binding
Update the global Project Settings, with the new default and tutorial projects.
Genai.Project.Settings.make({
id: 'default',
defaultProject: default_project,
tutorialProject: tutorial_project,
}).upsert();Set which of the two defined Genai.Project will be assigned for an specific user and set it active it for that specific user. In the example below is executed for the current user.
myuser = User.myUser();
Genai.App.UserSettings.make({
user: myuser,
activeProject: tutorial_project,
}).upsert();
Genai.App.UserSettings.forUser(myuser).setActiveProject('default-custom-alabamaBond');