Skip to content

feat: rai_whoami #488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 157 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package-mode = false
python = "^3.10, <3.13"

rai = {path = "src/rai_core", develop = true}
rai_whoami = {path = "src/rai_whoami", develop = true}
pre-commit = "^3.7.0"
tabulate = "^0.9.0"
pytest = "^8.2.0"
Expand Down
1 change: 1 addition & 0 deletions src/rai_core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ pydub = "^0.25.1"
scipy = "^1.14.0"
sounddevice = "^0.4.7"
streamlit = "^1.37.1"
pymongo = "^4.11.3"
61 changes: 61 additions & 0 deletions src/rai_whoami/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# RAI Whoami Configuration Examples

This directory contains examples demonstrating how to use the RAI Whoami configuration loading system.

## Files

- `config.json`: Example configuration file containing robot identity, constitution, and vector database settings
- `load_config.py`: Example script showing how to load configurations from different sources

## Prerequisites

1. Install the required dependencies:

```bash
pip install -r requirements.txt
```

2. For MongoDB example (optional):
- Install and start MongoDB
- Set environment variables (optional):
```bash
export MONGODB_USERNAME=your_username
export MONGODB_PASSWORD=your_password
```

## Usage

1. Run the example script:

```bash
python load_config.py
```

This will demonstrate loading configuration from a JSON file. The MongoDB example is commented out by default as it requires a running MongoDB instance.

## Configuration Structure

The example configuration includes:

1. **Robot Identity**

- Basic information (name, model, serial number)
- Capabilities list
- Physical parameters

2. **Robot Constitution**

- Ethical principles
- Operational constraints
- Safety protocols
- Interaction rules
- Learning guidelines

3. **Vector Database**
- Type and connection parameters
- Collection settings
- Embedding model configuration

## Customization

You can modify the `config.json` file to match your specific robot's requirements. The configuration validation will ensure all required fields are present and properly formatted.
24 changes: 24 additions & 0 deletions src/rai_whoami/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[tool.poetry]
name = "rai-whoami"
version = "0.0.1"
description = "Package for processing robot's documentation into identity, capabilities, constraints and vector database"
authors = ["Maciej Majek <[email protected]>"]
readme = "README.md"
classifiers = [
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"License :: OSI Approved :: Apache Software License",
]
packages = [
{ include = "rai_whoami", from = "." },
]

[tool.poetry.dependencies]
python = "^3.10, <3.13"
pymongo = "^4.11.3"
docx2txt = "^0.9"
pypdf = "^5.4.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
31 changes: 31 additions & 0 deletions src/rai_whoami/rai_whoami/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (C) 2025 Robotec.AI
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""RAI Whoami package."""

from .docs_processors.config_generator import ConfigGenerator
from .docs_processors.generate_configs import generate_configs_from_docs
from .loader.file_loader import FileConfigLoader
from .loader.mongo_loader import MongoConfigLoader
from .loader.schema import RobotConfig, RobotConstitution, RobotIdentity

__all__ = [
"ConfigGenerator",
"FileConfigLoader",
"MongoConfigLoader",
"RobotConfig",
"RobotConstitution",
"RobotIdentity",
"generate_configs_from_docs",
]
Loading