mfcli 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mfcli-0.2.0/BUILD.md +93 -0
- mfcli-0.2.0/CONFIGURATION.md +549 -0
- mfcli-0.2.0/INSTALL.md +396 -0
- mfcli-0.2.0/LICENSE +21 -0
- mfcli-0.2.0/MANIFEST.in +38 -0
- mfcli-0.2.0/MCP_SETUP.md +422 -0
- mfcli-0.2.0/PKG-INFO +841 -0
- mfcli-0.2.0/README.md +783 -0
- mfcli-0.2.0/install.ps1 +176 -0
- mfcli-0.2.0/install.sh +182 -0
- mfcli-0.2.0/mfcli/.env.example +72 -0
- mfcli-0.2.0/mfcli/__init__.py +0 -0
- mfcli-0.2.0/mfcli/agents/__init__.py +0 -0
- mfcli-0.2.0/mfcli/agents/controller/__init__.py +0 -0
- mfcli-0.2.0/mfcli/agents/controller/agent.py +19 -0
- mfcli-0.2.0/mfcli/agents/controller/config.yaml +27 -0
- mfcli-0.2.0/mfcli/agents/controller/tools.py +42 -0
- mfcli-0.2.0/mfcli/agents/tools/general.py +118 -0
- mfcli-0.2.0/mfcli/alembic/env.py +61 -0
- mfcli-0.2.0/mfcli/alembic/script.py.mako +28 -0
- mfcli-0.2.0/mfcli/alembic/versions/6ccc0c7c397c_added_fields_to_pdf_parts_model.py +39 -0
- mfcli-0.2.0/mfcli/alembic/versions/769019ef4870_added_gemini_file_path_to_pdf_part_model.py +33 -0
- mfcli-0.2.0/mfcli/alembic/versions/7a2e3a779fdc_added_functional_block_and_component_.py +54 -0
- mfcli-0.2.0/mfcli/alembic/versions/7d5adb2a47a7_added_pdf_parts_model.py +41 -0
- mfcli-0.2.0/mfcli/alembic/versions/7fcb7d6a5836_init.py +167 -0
- mfcli-0.2.0/mfcli/alembic/versions/e0f2b5765c72_added_cascade_delete_for_models_that_.py +32 -0
- mfcli-0.2.0/mfcli/alembic.ini +147 -0
- mfcli-0.2.0/mfcli/cli/__init__.py +0 -0
- mfcli-0.2.0/mfcli/cli/dependencies.py +59 -0
- mfcli-0.2.0/mfcli/cli/main.py +192 -0
- mfcli-0.2.0/mfcli/client/__init__.py +0 -0
- mfcli-0.2.0/mfcli/client/chroma_db.py +184 -0
- mfcli-0.2.0/mfcli/client/docling.py +44 -0
- mfcli-0.2.0/mfcli/client/gemini.py +252 -0
- mfcli-0.2.0/mfcli/client/llama_parse.py +38 -0
- mfcli-0.2.0/mfcli/client/vector_db.py +93 -0
- mfcli-0.2.0/mfcli/constants/__init__.py +0 -0
- mfcli-0.2.0/mfcli/constants/base_enum.py +18 -0
- mfcli-0.2.0/mfcli/constants/directory_names.py +1 -0
- mfcli-0.2.0/mfcli/constants/file_types.py +189 -0
- mfcli-0.2.0/mfcli/constants/gemini.py +1 -0
- mfcli-0.2.0/mfcli/constants/openai.py +6 -0
- mfcli-0.2.0/mfcli/constants/pipeline_run_status.py +3 -0
- mfcli-0.2.0/mfcli/crud/__init__.py +0 -0
- mfcli-0.2.0/mfcli/crud/file.py +42 -0
- mfcli-0.2.0/mfcli/crud/functional_blocks.py +26 -0
- mfcli-0.2.0/mfcli/crud/netlist.py +18 -0
- mfcli-0.2.0/mfcli/crud/pipeline_run.py +17 -0
- mfcli-0.2.0/mfcli/crud/project.py +99 -0
- mfcli-0.2.0/mfcli/digikey/__init__.py +0 -0
- mfcli-0.2.0/mfcli/digikey/digikey.py +105 -0
- mfcli-0.2.0/mfcli/main.py +5 -0
- mfcli-0.2.0/mfcli/mcp/__init__.py +0 -0
- mfcli-0.2.0/mfcli/mcp/configs/cline_mcp_settings.json +11 -0
- mfcli-0.2.0/mfcli/mcp/configs/mfcli.mcp.json +7 -0
- mfcli-0.2.0/mfcli/mcp/mcp_instance.py +6 -0
- mfcli-0.2.0/mfcli/mcp/server.py +37 -0
- mfcli-0.2.0/mfcli/mcp/state_manager.py +51 -0
- mfcli-0.2.0/mfcli/mcp/tools/__init__.py +0 -0
- mfcli-0.2.0/mfcli/mcp/tools/query_knowledgebase.py +108 -0
- mfcli-0.2.0/mfcli/models/__init__.py +10 -0
- mfcli-0.2.0/mfcli/models/base.py +10 -0
- mfcli-0.2.0/mfcli/models/bom.py +71 -0
- mfcli-0.2.0/mfcli/models/datasheet.py +10 -0
- mfcli-0.2.0/mfcli/models/debug_setup.py +64 -0
- mfcli-0.2.0/mfcli/models/file.py +43 -0
- mfcli-0.2.0/mfcli/models/file_docket.py +94 -0
- mfcli-0.2.0/mfcli/models/file_metadata.py +19 -0
- mfcli-0.2.0/mfcli/models/functional_blocks.py +94 -0
- mfcli-0.2.0/mfcli/models/llm_response.py +5 -0
- mfcli-0.2.0/mfcli/models/mcu.py +97 -0
- mfcli-0.2.0/mfcli/models/mcu_errata.py +26 -0
- mfcli-0.2.0/mfcli/models/netlist.py +59 -0
- mfcli-0.2.0/mfcli/models/pdf_parts.py +25 -0
- mfcli-0.2.0/mfcli/models/pipeline_run.py +34 -0
- mfcli-0.2.0/mfcli/models/project.py +27 -0
- mfcli-0.2.0/mfcli/models/project_metadata.py +15 -0
- mfcli-0.2.0/mfcli/pipeline/__init__.py +0 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/__init__.py +0 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/bom_netlist_mapper.py +28 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/__init__.py +0 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/bom/__init__.py +0 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/bom/bom.py +74 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/debug_setup/__init__.py +0 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/debug_setup/debug_setup.py +71 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/debug_setup/instructions.py +150 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/functional_blocks/__init__.py +0 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/functional_blocks/functional_blocks.py +93 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/functional_blocks/instructions.py +34 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/functional_blocks/validator.py +94 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/generator.py +258 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/generator_base.py +18 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/mcu/__init__.py +0 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/mcu/instructions.py +156 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/mcu/mcu.py +84 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/mcu_errata/__init__.py +1 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/mcu_errata/instructions.py +77 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/mcu_errata/mcu_errata.py +95 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/summary/__init__.py +0 -0
- mfcli-0.2.0/mfcli/pipeline/analysis/generators/summary/summary.py +47 -0
- mfcli-0.2.0/mfcli/pipeline/classifier.py +93 -0
- mfcli-0.2.0/mfcli/pipeline/data_enricher.py +15 -0
- mfcli-0.2.0/mfcli/pipeline/extractor.py +34 -0
- mfcli-0.2.0/mfcli/pipeline/extractors/__init__.py +0 -0
- mfcli-0.2.0/mfcli/pipeline/extractors/pdf.py +12 -0
- mfcli-0.2.0/mfcli/pipeline/parser.py +120 -0
- mfcli-0.2.0/mfcli/pipeline/parsers/__init__.py +0 -0
- mfcli-0.2.0/mfcli/pipeline/parsers/netlist/__init__.py +0 -0
- mfcli-0.2.0/mfcli/pipeline/parsers/netlist/edif.py +93 -0
- mfcli-0.2.0/mfcli/pipeline/parsers/netlist/kicad_legacy_net.py +326 -0
- mfcli-0.2.0/mfcli/pipeline/parsers/netlist/kicad_spice.py +135 -0
- mfcli-0.2.0/mfcli/pipeline/parsers/netlist/pads.py +185 -0
- mfcli-0.2.0/mfcli/pipeline/parsers/netlist/protel.py +166 -0
- mfcli-0.2.0/mfcli/pipeline/parsers/netlist/protel_detector.py +29 -0
- mfcli-0.2.0/mfcli/pipeline/pipeline.py +419 -0
- mfcli-0.2.0/mfcli/pipeline/preprocessors/__init__.py +0 -0
- mfcli-0.2.0/mfcli/pipeline/preprocessors/user_guide.py +127 -0
- mfcli-0.2.0/mfcli/pipeline/run_context.py +32 -0
- mfcli-0.2.0/mfcli/pipeline/schema_mapper.py +89 -0
- mfcli-0.2.0/mfcli/pipeline/sub_classifier.py +115 -0
- mfcli-0.2.0/mfcli/utils/__init__.py +0 -0
- mfcli-0.2.0/mfcli/utils/config.py +33 -0
- mfcli-0.2.0/mfcli/utils/configurator.py +324 -0
- mfcli-0.2.0/mfcli/utils/data_cleaner.py +82 -0
- mfcli-0.2.0/mfcli/utils/datasheet_vectorizer.py +281 -0
- mfcli-0.2.0/mfcli/utils/directory_manager.py +96 -0
- mfcli-0.2.0/mfcli/utils/file_upload.py +298 -0
- mfcli-0.2.0/mfcli/utils/files.py +16 -0
- mfcli-0.2.0/mfcli/utils/http_requests.py +54 -0
- mfcli-0.2.0/mfcli/utils/kb_lister.py +89 -0
- mfcli-0.2.0/mfcli/utils/kb_remover.py +173 -0
- mfcli-0.2.0/mfcli/utils/logger.py +28 -0
- mfcli-0.2.0/mfcli/utils/mcp_configurator.py +311 -0
- mfcli-0.2.0/mfcli/utils/migrations.py +18 -0
- mfcli-0.2.0/mfcli/utils/orm.py +43 -0
- mfcli-0.2.0/mfcli/utils/pdf_splitter.py +63 -0
- mfcli-0.2.0/mfcli/utils/query_service.py +22 -0
- mfcli-0.2.0/mfcli/utils/system_check.py +306 -0
- mfcli-0.2.0/mfcli/utils/tools.py +31 -0
- mfcli-0.2.0/mfcli/utils/vectorizer.py +28 -0
- mfcli-0.2.0/mfcli.egg-info/SOURCES.txt +140 -0
- mfcli-0.2.0/pyproject.toml +74 -0
- mfcli-0.2.0/setup.cfg +4 -0
mfcli-0.2.0/BUILD.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Building mfcli Standalone Executable
|
|
2
|
+
|
|
3
|
+
This document explains how to build a standalone executable for the mfcli CLI tool using PyInstaller.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Python 3.12
|
|
8
|
+
- All project dependencies installed (`pip install -e .[dev]`)
|
|
9
|
+
|
|
10
|
+
## Building on Windows
|
|
11
|
+
|
|
12
|
+
Run the PowerShell build script:
|
|
13
|
+
|
|
14
|
+
```powershell
|
|
15
|
+
.\build.ps1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The script will:
|
|
19
|
+
1. Check if PyInstaller is installed (and install it if needed)
|
|
20
|
+
2. Clean previous builds
|
|
21
|
+
3. Build the executable using PyInstaller
|
|
22
|
+
4. Display the executable location and size
|
|
23
|
+
|
|
24
|
+
**Output:** `dist\mfcli.exe`
|
|
25
|
+
|
|
26
|
+
## Building on Mac/Linux
|
|
27
|
+
|
|
28
|
+
First, make the build script executable:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
chmod +x build.sh
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Then run the build script:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
./build.sh
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The script will:
|
|
41
|
+
1. Check if PyInstaller is installed (and install it if needed)
|
|
42
|
+
2. Clean previous builds
|
|
43
|
+
3. Build the executable using PyInstaller
|
|
44
|
+
4. Make the executable runnable
|
|
45
|
+
5. Display the executable location and size
|
|
46
|
+
|
|
47
|
+
**Output:** `dist/mfcli`
|
|
48
|
+
|
|
49
|
+
## Manual Build
|
|
50
|
+
|
|
51
|
+
If you prefer to build manually, you can run PyInstaller directly:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pyinstaller mfcli.spec
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
The build is configured through `mfcli.spec`, which includes:
|
|
60
|
+
- All necessary hidden imports for dependencies
|
|
61
|
+
- Data files (YAML configs, INI files, templates)
|
|
62
|
+
- Single-file executable output
|
|
63
|
+
- Console application settings
|
|
64
|
+
|
|
65
|
+
## Platform-Specific Dependencies
|
|
66
|
+
|
|
67
|
+
The `pyproject.toml` automatically handles platform-specific magic library dependencies:
|
|
68
|
+
- Windows: `python-magic-bin`
|
|
69
|
+
- Mac/Linux: `python-magic`
|
|
70
|
+
|
|
71
|
+
## Troubleshooting
|
|
72
|
+
|
|
73
|
+
### Missing Dependencies
|
|
74
|
+
If the build fails due to missing dependencies, install the dev dependencies:
|
|
75
|
+
```bash
|
|
76
|
+
pip install -e .[dev]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Large Executable Size
|
|
80
|
+
The executable includes all Python dependencies. This is expected for bundled applications. Typical size is 100-200 MB.
|
|
81
|
+
|
|
82
|
+
### Runtime Errors
|
|
83
|
+
If the built executable fails at runtime, you may need to add additional hidden imports or data files to `mfcli.spec`.
|
|
84
|
+
|
|
85
|
+
## Distribution
|
|
86
|
+
|
|
87
|
+
After building, the executable in the `dist/` folder can be distributed as a standalone application. Users don't need Python installed to run it.
|
|
88
|
+
|
|
89
|
+
### Windows
|
|
90
|
+
Distribute `dist\mfcli.exe`
|
|
91
|
+
|
|
92
|
+
### Mac/Linux
|
|
93
|
+
Distribute `dist/mfcli` (ensure it has execute permissions)
|
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
# mfcli Configuration Guide
|
|
2
|
+
|
|
3
|
+
Complete guide to configuring mfcli for hardware document analysis.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Quick Start](#quick-start)
|
|
8
|
+
- [Configuration Methods](#configuration-methods)
|
|
9
|
+
- [Required API Keys](#required-api-keys)
|
|
10
|
+
- [Vector Database Settings](#vector-database-settings)
|
|
11
|
+
- [Optional Settings](#optional-settings)
|
|
12
|
+
- [Configuration File Location](#configuration-file-location)
|
|
13
|
+
- [Validation](#validation)
|
|
14
|
+
- [Troubleshooting](#troubleshooting)
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
The fastest way to configure mfcli:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
mfcli configure
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This interactive wizard will:
|
|
25
|
+
- Guide you through API key setup
|
|
26
|
+
- Provide direct links to get each key
|
|
27
|
+
- Validate keys automatically
|
|
28
|
+
- Set sensible defaults
|
|
29
|
+
- Save configuration to the correct location
|
|
30
|
+
|
|
31
|
+
## Configuration Methods
|
|
32
|
+
|
|
33
|
+
### Method 1: Interactive Wizard (Recommended)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Start configuration wizard
|
|
37
|
+
mfcli configure
|
|
38
|
+
|
|
39
|
+
# Check existing configuration
|
|
40
|
+
mfcli configure --check
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Advantages:**
|
|
44
|
+
- ✅ Step-by-step guidance
|
|
45
|
+
- ✅ Automatic validation
|
|
46
|
+
- ✅ Links to get API keys
|
|
47
|
+
- ✅ Smart defaults
|
|
48
|
+
- ✅ Error prevention
|
|
49
|
+
|
|
50
|
+
### Method 2: Manual Configuration
|
|
51
|
+
|
|
52
|
+
Create/edit the `.env` file directly:
|
|
53
|
+
|
|
54
|
+
**Location:**
|
|
55
|
+
- Windows: `C:\Users\<username>\Multifactor\.env`
|
|
56
|
+
- Linux/macOS: `~/Multifactor/.env`
|
|
57
|
+
|
|
58
|
+
**Content:**
|
|
59
|
+
```ini
|
|
60
|
+
# API Keys (Required)
|
|
61
|
+
google_api_key=your_google_api_key
|
|
62
|
+
openai_api_key=your_openai_api_key
|
|
63
|
+
llama_cloud_api_key=your_llamaparse_api_key
|
|
64
|
+
digikey_client_id=your_digikey_client_id
|
|
65
|
+
digikey_client_secret=your_digikey_client_secret
|
|
66
|
+
|
|
67
|
+
# Vector Database Configuration
|
|
68
|
+
chunk_size=1000
|
|
69
|
+
chunk_overlap=200
|
|
70
|
+
embedding_model=text-embedding-3-small
|
|
71
|
+
embedding_dimensions=1536
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Method 3: Environment Variables
|
|
75
|
+
|
|
76
|
+
For advanced users or CI/CD environments:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Set environment variables
|
|
80
|
+
export GOOGLE_API_KEY="your_key"
|
|
81
|
+
export OPENAI_API_KEY="your_key"
|
|
82
|
+
export LLAMA_CLOUD_API_KEY="your_key"
|
|
83
|
+
export DIGIKEY_CLIENT_ID="your_id"
|
|
84
|
+
export DIGIKEY_CLIENT_SECRET="your_secret"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Note:** `.env` file takes precedence over environment variables.
|
|
88
|
+
|
|
89
|
+
## Required API Keys
|
|
90
|
+
|
|
91
|
+
### 1. Google Gemini API Key
|
|
92
|
+
|
|
93
|
+
**Purpose:** AI-powered document analysis and processing
|
|
94
|
+
|
|
95
|
+
**Get Your Key:**
|
|
96
|
+
1. Visit [Google AI Studio](https://aistudio.google.com/app/apikey)
|
|
97
|
+
2. Sign in with your Google account
|
|
98
|
+
3. Click "Create API Key"
|
|
99
|
+
4. Copy the key
|
|
100
|
+
|
|
101
|
+
**Configuration:**
|
|
102
|
+
```ini
|
|
103
|
+
google_api_key=AIzaSy...
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Testing:**
|
|
107
|
+
```bash
|
|
108
|
+
# The configure wizard tests this automatically
|
|
109
|
+
# Or test manually in Python:
|
|
110
|
+
python -c "import google.generativeai as genai; genai.configure(api_key='YOUR_KEY'); print(list(genai.list_models())[:1])"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 2. OpenAI API Key
|
|
114
|
+
|
|
115
|
+
**Purpose:** Generating embeddings for semantic search (RAG)
|
|
116
|
+
|
|
117
|
+
**Get Your Key:**
|
|
118
|
+
1. Visit [OpenAI Platform](https://platform.openai.com/api-keys)
|
|
119
|
+
2. Sign in or create an account
|
|
120
|
+
3. Click "Create new secret key"
|
|
121
|
+
4. Copy the key immediately (shown only once)
|
|
122
|
+
|
|
123
|
+
**Requirements:**
|
|
124
|
+
- Billing must be enabled on your OpenAI account
|
|
125
|
+
- Sufficient credits for embedding operations
|
|
126
|
+
|
|
127
|
+
**Configuration:**
|
|
128
|
+
```ini
|
|
129
|
+
openai_api_key=sk-proj-...
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Cost Estimate:**
|
|
133
|
+
- Embeddings are inexpensive (~$0.10 per 1M tokens)
|
|
134
|
+
- Typical hardware project: $0.01-$0.50 total
|
|
135
|
+
|
|
136
|
+
**Testing:**
|
|
137
|
+
```bash
|
|
138
|
+
# Test with curl
|
|
139
|
+
curl https://api.openai.com/v1/models \
|
|
140
|
+
-H "Authorization: Bearer YOUR_KEY"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 3. LlamaParse API Key
|
|
144
|
+
|
|
145
|
+
**Purpose:** Advanced PDF parsing and text extraction
|
|
146
|
+
|
|
147
|
+
**Get Your Key:**
|
|
148
|
+
1. Visit [LlamaIndex Cloud](https://cloud.llamaindex.ai/)
|
|
149
|
+
2. Sign up for a free account
|
|
150
|
+
3. Navigate to API Keys section
|
|
151
|
+
4. Create a new API key
|
|
152
|
+
|
|
153
|
+
**Free Tier:**
|
|
154
|
+
- 7,000 pages per day
|
|
155
|
+
- Sufficient for most users
|
|
156
|
+
|
|
157
|
+
**Configuration:**
|
|
158
|
+
```ini
|
|
159
|
+
llama_cloud_api_key=llx-...
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### 4. DigiKey API Credentials
|
|
163
|
+
|
|
164
|
+
**Purpose:** Automatic component datasheet downloads
|
|
165
|
+
|
|
166
|
+
**Get Your Credentials:**
|
|
167
|
+
1. Visit [DigiKey Developer Portal](https://developer.digikey.com/)
|
|
168
|
+
2. Register for a developer account
|
|
169
|
+
3. Create a new application
|
|
170
|
+
4. Note your Client ID and Client Secret
|
|
171
|
+
|
|
172
|
+
**Configuration:**
|
|
173
|
+
```ini
|
|
174
|
+
digikey_client_id=your_client_id
|
|
175
|
+
digikey_client_secret=your_client_secret
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Note:** DigiKey API requires OAuth2 flow on first use.
|
|
179
|
+
|
|
180
|
+
## Vector Database Settings
|
|
181
|
+
|
|
182
|
+
These settings control how documents are split and embedded for semantic search.
|
|
183
|
+
|
|
184
|
+
### Chunk Size
|
|
185
|
+
|
|
186
|
+
**Purpose:** Number of characters per document chunk
|
|
187
|
+
|
|
188
|
+
**Default:** 1000
|
|
189
|
+
|
|
190
|
+
**Configuration:**
|
|
191
|
+
```ini
|
|
192
|
+
chunk_size=1000
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Tuning Guide:**
|
|
196
|
+
- **Smaller (500-800)**: More precise search, more chunks
|
|
197
|
+
- **Medium (1000-1500)**: Balanced (recommended)
|
|
198
|
+
- **Larger (2000-3000)**: More context, fewer chunks
|
|
199
|
+
|
|
200
|
+
**Trade-offs:**
|
|
201
|
+
- Larger chunks: More context but less precise matching
|
|
202
|
+
- Smaller chunks: More precise but may lose context
|
|
203
|
+
|
|
204
|
+
### Chunk Overlap
|
|
205
|
+
|
|
206
|
+
**Purpose:** Number of overlapping characters between chunks
|
|
207
|
+
|
|
208
|
+
**Default:** 200
|
|
209
|
+
|
|
210
|
+
**Configuration:**
|
|
211
|
+
```ini
|
|
212
|
+
chunk_overlap=200
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
**Tuning Guide:**
|
|
216
|
+
- **Small (50-100)**: Minimal overlap, more distinct chunks
|
|
217
|
+
- **Medium (200-300)**: Balanced (recommended)
|
|
218
|
+
- **Large (400-500)**: Maximum context preservation
|
|
219
|
+
|
|
220
|
+
**Rule of Thumb:** 15-25% of chunk_size
|
|
221
|
+
|
|
222
|
+
### Embedding Model
|
|
223
|
+
|
|
224
|
+
**Purpose:** OpenAI model used for generating embeddings
|
|
225
|
+
|
|
226
|
+
**Default:** text-embedding-3-small
|
|
227
|
+
|
|
228
|
+
**Options:**
|
|
229
|
+
- `text-embedding-3-small`: Fast, cost-effective (recommended)
|
|
230
|
+
- `text-embedding-3-large`: Higher quality, more expensive
|
|
231
|
+
- `text-embedding-ada-002`: Legacy model
|
|
232
|
+
|
|
233
|
+
**Configuration:**
|
|
234
|
+
```ini
|
|
235
|
+
embedding_model=text-embedding-3-small
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Comparison:**
|
|
239
|
+
|
|
240
|
+
| Model | Dimensions | Speed | Cost | Quality |
|
|
241
|
+
|-------|------------|-------|------|---------|
|
|
242
|
+
| 3-small | 1536 | Fast | Low | Good |
|
|
243
|
+
| 3-large | 3072 | Medium | Medium | Excellent |
|
|
244
|
+
| ada-002 | 1536 | Fast | Low | Good |
|
|
245
|
+
|
|
246
|
+
### Embedding Dimensions
|
|
247
|
+
|
|
248
|
+
**Purpose:** Vector dimensions for embeddings
|
|
249
|
+
|
|
250
|
+
**Default:** 1536 (for text-embedding-3-small)
|
|
251
|
+
|
|
252
|
+
**Configuration:**
|
|
253
|
+
```ini
|
|
254
|
+
embedding_dimensions=1536
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Important:** Must match your embedding_model:
|
|
258
|
+
- text-embedding-3-small: 1536
|
|
259
|
+
- text-embedding-3-large: 3072
|
|
260
|
+
- text-embedding-ada-002: 1536
|
|
261
|
+
|
|
262
|
+
## Optional Settings
|
|
263
|
+
|
|
264
|
+
### AWS Configuration (Optional)
|
|
265
|
+
|
|
266
|
+
For S3 storage integration:
|
|
267
|
+
|
|
268
|
+
```ini
|
|
269
|
+
# AWS credentials (optional)
|
|
270
|
+
aws_access_key_id=AKIA...
|
|
271
|
+
aws_secret_access_key=...
|
|
272
|
+
aws_region=us-east-1
|
|
273
|
+
s3_bucket_name=my-hardware-docs
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**When to use:**
|
|
277
|
+
- Large-scale document storage
|
|
278
|
+
- Team collaboration
|
|
279
|
+
- Cloud backup requirements
|
|
280
|
+
|
|
281
|
+
### Database Path (Optional)
|
|
282
|
+
|
|
283
|
+
Custom SQLite database location:
|
|
284
|
+
|
|
285
|
+
```ini
|
|
286
|
+
# Default: ./sessions.db
|
|
287
|
+
sqlite_db_path=/path/to/custom/database.db
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Configuration File Location
|
|
291
|
+
|
|
292
|
+
The configuration file is stored in a platform-specific location:
|
|
293
|
+
|
|
294
|
+
### Windows
|
|
295
|
+
```
|
|
296
|
+
C:\Users\<username>\Multifactor\.env
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Access:**
|
|
300
|
+
```powershell
|
|
301
|
+
# Open in notepad
|
|
302
|
+
notepad $env:USERPROFILE\Multifactor\.env
|
|
303
|
+
|
|
304
|
+
# View path
|
|
305
|
+
echo $env:USERPROFILE\Multifactor\.env
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Linux
|
|
309
|
+
```
|
|
310
|
+
/home/<username>/Multifactor/.env
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**Access:**
|
|
314
|
+
```bash
|
|
315
|
+
# Edit with nano
|
|
316
|
+
nano ~/Multifactor/.env
|
|
317
|
+
|
|
318
|
+
# View path
|
|
319
|
+
ls -la ~/Multifactor/.env
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### macOS
|
|
323
|
+
```
|
|
324
|
+
/Users/<username>/Multifactor/.env
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**Access:**
|
|
328
|
+
```bash
|
|
329
|
+
# Edit with default editor
|
|
330
|
+
open -t ~/Multifactor/.env
|
|
331
|
+
|
|
332
|
+
# View path
|
|
333
|
+
ls -la ~/Multifactor/.env
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## Validation
|
|
337
|
+
|
|
338
|
+
### Automatic Validation
|
|
339
|
+
|
|
340
|
+
The configuration wizard validates keys automatically:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
mfcli configure
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
During setup, each API key is tested with a simple request.
|
|
347
|
+
|
|
348
|
+
### Manual Validation
|
|
349
|
+
|
|
350
|
+
Check configuration status:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
# Check configuration
|
|
354
|
+
mfcli configure --check
|
|
355
|
+
|
|
356
|
+
# Comprehensive system check
|
|
357
|
+
mfcli doctor
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Validation Checklist
|
|
361
|
+
|
|
362
|
+
✅ **Google API Key**
|
|
363
|
+
- [ ] Key exists in config
|
|
364
|
+
- [ ] Key format is correct (starts with AIza)
|
|
365
|
+
- [ ] Key can list models
|
|
366
|
+
|
|
367
|
+
✅ **OpenAI API Key**
|
|
368
|
+
- [ ] Key exists in config
|
|
369
|
+
- [ ] Key format is correct (starts with sk-)
|
|
370
|
+
- [ ] Billing enabled on account
|
|
371
|
+
- [ ] Key has sufficient credits
|
|
372
|
+
|
|
373
|
+
✅ **LlamaParse API Key**
|
|
374
|
+
- [ ] Key exists in config
|
|
375
|
+
- [ ] Key format is correct (starts with llx-)
|
|
376
|
+
- [ ] Account has available quota
|
|
377
|
+
|
|
378
|
+
✅ **DigiKey Credentials**
|
|
379
|
+
- [ ] Client ID exists
|
|
380
|
+
- [ ] Client Secret exists
|
|
381
|
+
- [ ] Application is approved
|
|
382
|
+
|
|
383
|
+
## Troubleshooting
|
|
384
|
+
|
|
385
|
+
### Configuration File Not Found
|
|
386
|
+
|
|
387
|
+
**Symptom:** mfcli can't find configuration
|
|
388
|
+
|
|
389
|
+
**Solutions:**
|
|
390
|
+
|
|
391
|
+
1. **Run configuration wizard:**
|
|
392
|
+
```bash
|
|
393
|
+
mfcli configure
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
2. **Check file location:**
|
|
397
|
+
```bash
|
|
398
|
+
# Windows
|
|
399
|
+
dir %USERPROFILE%\Multifactor
|
|
400
|
+
|
|
401
|
+
# Linux/macOS
|
|
402
|
+
ls -la ~/Multifactor
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
3. **Create directory if missing:**
|
|
406
|
+
```bash
|
|
407
|
+
# Windows
|
|
408
|
+
mkdir %USERPROFILE%\Multifactor
|
|
409
|
+
|
|
410
|
+
# Linux/macOS
|
|
411
|
+
mkdir -p ~/Multifactor
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### API Key Invalid
|
|
415
|
+
|
|
416
|
+
**Symptom:** 401 Unauthorized or API key errors
|
|
417
|
+
|
|
418
|
+
**Solutions:**
|
|
419
|
+
|
|
420
|
+
1. **Verify key is correct:** Copy-paste carefully, no extra spaces
|
|
421
|
+
2. **Check key status:** Some keys expire or get revoked
|
|
422
|
+
3. **Billing enabled:** OpenAI requires billing
|
|
423
|
+
4. **Regenerate key:** Create a new one if needed
|
|
424
|
+
|
|
425
|
+
### Embedding Dimension Mismatch
|
|
426
|
+
|
|
427
|
+
**Symptom:** ChromaDB errors about dimension mismatch
|
|
428
|
+
|
|
429
|
+
**Solution:**
|
|
430
|
+
```bash
|
|
431
|
+
# Delete and rebuild ChromaDB
|
|
432
|
+
# Windows:
|
|
433
|
+
Remove-Item -Recurse -Force $env:LOCALAPPDATA\Multifactor\chromadb
|
|
434
|
+
|
|
435
|
+
# Linux/macOS:
|
|
436
|
+
rm -rf ~/.local/share/Multifactor/chromadb
|
|
437
|
+
|
|
438
|
+
# Then reprocess documents
|
|
439
|
+
mfcli run
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### Permission Denied
|
|
443
|
+
|
|
444
|
+
**Symptom:** Can't write to configuration file
|
|
445
|
+
|
|
446
|
+
**Solutions:**
|
|
447
|
+
|
|
448
|
+
- Check file permissions
|
|
449
|
+
- Ensure directory exists
|
|
450
|
+
- On Linux/macOS: `chmod 600 ~/Multifactor/.env`
|
|
451
|
+
- On Windows: Check user has write access
|
|
452
|
+
|
|
453
|
+
### Configuration Not Loaded
|
|
454
|
+
|
|
455
|
+
**Symptom:** mfcli doesn't see configuration changes
|
|
456
|
+
|
|
457
|
+
**Solutions:**
|
|
458
|
+
|
|
459
|
+
1. **Verify file location is correct**
|
|
460
|
+
2. **Check file syntax** - no typos in key names
|
|
461
|
+
3. **Restart mfcli** - some changes need restart
|
|
462
|
+
4. **Clear any cached configs** - rerun `mfcli doctor`
|
|
463
|
+
|
|
464
|
+
## Best Practices
|
|
465
|
+
|
|
466
|
+
### Security
|
|
467
|
+
|
|
468
|
+
- **Never commit `.env` files** to version control
|
|
469
|
+
- **Use strong API keys** - don't share them
|
|
470
|
+
- **Rotate keys periodically** - especially if exposed
|
|
471
|
+
- **Limit key permissions** - use minimum required scopes
|
|
472
|
+
|
|
473
|
+
### Organization
|
|
474
|
+
|
|
475
|
+
- **One configuration per machine** - stored in user directory
|
|
476
|
+
- **Document your settings** - note why you changed defaults
|
|
477
|
+
- **Backup your config** - especially for custom tuning
|
|
478
|
+
|
|
479
|
+
### Performance
|
|
480
|
+
|
|
481
|
+
- **Start with defaults** - they work well for most cases
|
|
482
|
+
- **Monitor costs** - track OpenAI API usage
|
|
483
|
+
- **Tune if needed** - only after testing defaults
|
|
484
|
+
- **Test changes** - verify improvements before keeping
|
|
485
|
+
|
|
486
|
+
## Configuration Examples
|
|
487
|
+
|
|
488
|
+
### Minimal Configuration
|
|
489
|
+
|
|
490
|
+
```ini
|
|
491
|
+
google_api_key=AIzaSy...
|
|
492
|
+
openai_api_key=sk-proj-...
|
|
493
|
+
llama_cloud_api_key=llx-...
|
|
494
|
+
digikey_client_id=your_id
|
|
495
|
+
digikey_client_secret=your_secret
|
|
496
|
+
chunk_size=1000
|
|
497
|
+
chunk_overlap=200
|
|
498
|
+
embedding_model=text-embedding-3-small
|
|
499
|
+
embedding_dimensions=1536
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
### High-Quality Configuration
|
|
503
|
+
|
|
504
|
+
For maximum search quality:
|
|
505
|
+
|
|
506
|
+
```ini
|
|
507
|
+
google_api_key=AIzaSy...
|
|
508
|
+
openai_api_key=sk-proj-...
|
|
509
|
+
llama_cloud_api_key=llx-...
|
|
510
|
+
digikey_client_id=your_id
|
|
511
|
+
digikey_client_secret=your_secret
|
|
512
|
+
chunk_size=1500
|
|
513
|
+
chunk_overlap=300
|
|
514
|
+
embedding_model=text-embedding-3-large
|
|
515
|
+
embedding_dimensions=3072
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### Cost-Optimized Configuration
|
|
519
|
+
|
|
520
|
+
For minimal costs:
|
|
521
|
+
|
|
522
|
+
```ini
|
|
523
|
+
google_api_key=AIzaSy...
|
|
524
|
+
openai_api_key=sk-proj-...
|
|
525
|
+
llama_cloud_api_key=llx-...
|
|
526
|
+
digikey_client_id=your_id
|
|
527
|
+
digikey_client_secret=your_secret
|
|
528
|
+
chunk_size=800
|
|
529
|
+
chunk_overlap=150
|
|
530
|
+
embedding_model=text-embedding-3-small
|
|
531
|
+
embedding_dimensions=1536
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
## Getting Help
|
|
535
|
+
|
|
536
|
+
- **Interactive Setup**: `mfcli configure`
|
|
537
|
+
- **System Check**: `mfcli doctor`
|
|
538
|
+
- **Check Config**: `mfcli configure --check`
|
|
539
|
+
- **Issues**: [GitHub Issues](https://github.com/MultifactorAI/multifactor-adk-backend/issues)
|
|
540
|
+
|
|
541
|
+
## Related Documentation
|
|
542
|
+
|
|
543
|
+
- [Installation Guide](INSTALL.md)
|
|
544
|
+
- [MCP Setup Guide](MCP_SETUP.md)
|
|
545
|
+
- [Main README](README.md)
|
|
546
|
+
|
|
547
|
+
---
|
|
548
|
+
|
|
549
|
+
**Tip:** Start with the interactive wizard (`mfcli configure`) for the smoothest experience!
|