vtk-prompt


Namevtk-prompt JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA project combining VTK visualization with LLM APIs (Anthropic, OpenAI, NVIDIA NIM)
upload_time2025-10-24 21:19:12
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords vtk visualization llm ai anthropic openai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # VTK Prompt

[![CI](https://github.com/vicentebolea/vtk-prompt/actions/workflows/ci.yml/badge.svg)](https://github.com/vicentebolea/vtk-prompt/actions/workflows/ci.yml)
[![Build and Publish](https://github.com/vicentebolea/vtk-prompt/actions/workflows/publish.yml/badge.svg)](https://github.com/vicentebolea/vtk-prompt/actions/workflows/publish.yml)
[![PyPI version](https://badge.fury.io/py/vtk-prompt.svg)](https://badge.fury.io/py/vtk-prompt)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)

A command-line interface and web-based UI for generating VTK visualization code
using Large Language Models (Anthropic Claude, OpenAI GPT, NVIDIA NIM, and local
models).

![Screenshot from 2025-06-11 19-02-00](https://github.com/user-attachments/assets/2e1e85c3-4efd-43e4-810c-185b851d609d)

## Features

- Multiple LLM providers: Anthropic Claude, OpenAI GPT, NVIDIA NIM, and local
  models
- Interactive web UI with live VTK rendering
- Retrieval-Augmented Generation (RAG) with VTK examples database
- Real-time visualization of generated code
- Token usage tracking and cost monitoring
- CLI and Python API for integration

## Installation

### From PyPI (Stable)

```bash
pip install vtk-prompt
```

### From TestPyPI (Latest Development)

```bash
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ vtk-prompt
```

### From Source

```bash
git clone https://github.com/vicentebolea/vtk-prompt.git
cd vtk-prompt
pip install -e .
```

## Quick Start

### 1. Set up API keys

```bash
export ANTHROPIC_API_KEY="your-anthropic-key"
export OPENAI_API_KEY="your-openai-key"  # Optional
```

### 2. Launch Web UI (Recommended)

```bash
vtk-prompt-ui
```

Access the UI at `http://localhost:8080`

### 3. Or use CLI

```bash
# Generate VTK code
vtk-prompt "Create a red sphere"

# With RAG enhancement
vtk-prompt "Create a sphere with custom resolution" --rag

# Different providers
vtk-prompt "Create a blue cube" --provider openai
vtk-prompt "Create a cone" --provider nim --token YOUR_NIM_TOKEN
```

## Usage

### Web UI Features

The web interface provides:

- Model selection: Choose between Claude models (Haiku, Sonnet 4) and other
  providers
- Token control: Adjust maximum tokens for responses
- Usage tracking: Real-time display of input/output tokens and costs
- RAG integration: Toggle retrieval-augmented generation for better results
- Live preview: See VTK visualizations rendered in real-time
- Code export: View, edit, and copy generated VTK code
- Local & cloud support: Both cloud APIs and local model endpoints

### Command Line Interface

```bash
# Basic usage
vtk-prompt "Create a red sphere"

# Advanced options
vtk-prompt "Create a textured cone with 32 resolution" \
  --provider anthropic \
  --model claude-opus-4-1-20250805 \
  --max-tokens 4000 \
  --rag \
  --verbose

# Using different providers
vtk-prompt "Create a blue cube" --provider openai --model gpt-5
vtk-prompt "Create a cylinder" --provider nim --model meta/llama3-70b-instruct
```

### RAG (Retrieval Augmented Generation)

Enhance code generation with relevant VTK examples:

1. **Build RAG database** (one-time setup):

```bash
vtk-build-rag
```

2. **Test RAG system** (optional):

```bash
vtk-test-rag "How to create a cube in VTK"
```

3. **Use RAG in queries**:

```bash
vtk-prompt "Create a vtkSphereSource with texture mapping" --rag
```

### Python API

```python
from vtk_prompt import VTKPromptClient

client = VTKPromptClient()
code = client.generate_code("Create a red sphere")
print(code)
```

## Configuration

### Environment Variables

- `ANTHROPIC_API_KEY` - Anthropic Claude API key
- `OPENAI_API_KEY` - OpenAI API key (also used for NVIDIA NIM)

### Supported Providers & Models

| Provider      | Default Model            | Base URL                            |
| ------------- | ------------------------ | ----------------------------------- |
| **anthropic** | claude-opus-4-1-20250805 | https://api.anthropic.com/v1        |
| **openai**    | gpt-5                    | https://api.openai.com/v1           |
| **nim**       | meta/llama3-70b-instruct | https://integrate.api.nvidia.com/v1 |
| **custom**    | User-defined             | User-defined (for local models)     |

### Custom/Local Models

You can use local models via OpenAI-compatible APIs:

```bash
# Using Ollama
vtk-prompt "Create a sphere" \
  --provider custom \
  --base-url http://localhost:11434/v1 \
  --model llama2

# Using LM Studio
vtk-prompt "Create a cube" \
  --provider custom \
  --base-url http://localhost:1234/v1 \
  --model local-model
```

## CLI Reference

```
usage: vtk-prompt [-h] [--provider {anthropic,openai,nim,custom}]
                  [-m MODEL] [-k MAX_TOKENS] [-t TOKEN] [--base-url BASE_URL]
                  [-r] [-v] [--collection COLLECTION] [--database DATABASE]
                  [--top-k TOP_K] input_string

Generate VTK visualization code using Large Language Models

positional arguments:
  input_string          Description of the VTK visualization to generate

options:
  -h, --help            Show this help message and exit
  -m MODEL, --model MODEL
                        Model name to use
  -k MAX_TOKENS, --max-tokens MAX_TOKENS
                        Maximum number of tokens to generate
  -t TOKEN, --token TOKEN
                        API token (defaults to environment variable)
  --base-url BASE_URL   Base URL for API (for custom/local models)
  -r, --rag             Use Retrieval Augmented Generation
  -v, --verbose         Show generated source code
  --provider {anthropic,openai,nim,custom}
                        LLM provider to use

RAG Options:
  --collection COLLECTION
                        Collection name for RAG (default: vtk-examples)
  --database DATABASE   Database path for RAG (default: ./db/codesage-codesage-large-v2)
  --top-k TOP_K         Number of examples to retrieve (default: 5)
```

## Available Commands

- `vtk-prompt` - Main CLI for code generation
- `vtk-prompt-ui` - Launch web interface
- `vtk-build-rag` - Build RAG database from VTK examples
- `vtk-test-rag` - Test RAG functionality
- `gen-vtk-file` - Generate VTK XML files
- `rag-chat` - Interactive RAG chat interface

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

For detailed development instructions, see [DEVELOPMENT.md](DEVELOPMENT.md)
which covers:

- Setting up the development environment
- Running tests and linting
- Developer mode for the web UI
- Code formatting and type checking
- Pre-commit hooks

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
for details.

## Architecture

- **Core**: Python package with CLI and API
- **UI**: Trame-based web interface with VTK rendering
- **RAG**: ChromaDB + Llama Index for code example retrieval
- **Providers**: Unified interface for multiple LLM APIs

## Links

- [PyPI Package](https://pypi.org/project/vtk-prompt/)
- [Documentation](https://github.com/vicentebolea/vtk-prompt)
- [Issues](https://github.com/vicentebolea/vtk-prompt/issues)
- [VTK Documentation](https://vtk.org/documentation/)

---

Made with care for the VTK and scientific visualization community.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "vtk-prompt",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "vtk, visualization, llm, ai, anthropic, openai",
    "author": null,
    "author_email": "Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>",
    "download_url": "https://files.pythonhosted.org/packages/2d/25/cc3bd422e412d1d9cb19a71f244d19e76d2c2656470dfb98238b2b5a0eab/vtk_prompt-0.1.0.tar.gz",
    "platform": null,
    "description": "# VTK Prompt\n\n[![CI](https://github.com/vicentebolea/vtk-prompt/actions/workflows/ci.yml/badge.svg)](https://github.com/vicentebolea/vtk-prompt/actions/workflows/ci.yml)\n[![Build and Publish](https://github.com/vicentebolea/vtk-prompt/actions/workflows/publish.yml/badge.svg)](https://github.com/vicentebolea/vtk-prompt/actions/workflows/publish.yml)\n[![PyPI version](https://badge.fury.io/py/vtk-prompt.svg)](https://badge.fury.io/py/vtk-prompt)\n[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)\n\nA command-line interface and web-based UI for generating VTK visualization code\nusing Large Language Models (Anthropic Claude, OpenAI GPT, NVIDIA NIM, and local\nmodels).\n\n![Screenshot from 2025-06-11 19-02-00](https://github.com/user-attachments/assets/2e1e85c3-4efd-43e4-810c-185b851d609d)\n\n## Features\n\n- Multiple LLM providers: Anthropic Claude, OpenAI GPT, NVIDIA NIM, and local\n  models\n- Interactive web UI with live VTK rendering\n- Retrieval-Augmented Generation (RAG) with VTK examples database\n- Real-time visualization of generated code\n- Token usage tracking and cost monitoring\n- CLI and Python API for integration\n\n## Installation\n\n### From PyPI (Stable)\n\n```bash\npip install vtk-prompt\n```\n\n### From TestPyPI (Latest Development)\n\n```bash\npip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ vtk-prompt\n```\n\n### From Source\n\n```bash\ngit clone https://github.com/vicentebolea/vtk-prompt.git\ncd vtk-prompt\npip install -e .\n```\n\n## Quick Start\n\n### 1. Set up API keys\n\n```bash\nexport ANTHROPIC_API_KEY=\"your-anthropic-key\"\nexport OPENAI_API_KEY=\"your-openai-key\"  # Optional\n```\n\n### 2. Launch Web UI (Recommended)\n\n```bash\nvtk-prompt-ui\n```\n\nAccess the UI at `http://localhost:8080`\n\n### 3. Or use CLI\n\n```bash\n# Generate VTK code\nvtk-prompt \"Create a red sphere\"\n\n# With RAG enhancement\nvtk-prompt \"Create a sphere with custom resolution\" --rag\n\n# Different providers\nvtk-prompt \"Create a blue cube\" --provider openai\nvtk-prompt \"Create a cone\" --provider nim --token YOUR_NIM_TOKEN\n```\n\n## Usage\n\n### Web UI Features\n\nThe web interface provides:\n\n- Model selection: Choose between Claude models (Haiku, Sonnet 4) and other\n  providers\n- Token control: Adjust maximum tokens for responses\n- Usage tracking: Real-time display of input/output tokens and costs\n- RAG integration: Toggle retrieval-augmented generation for better results\n- Live preview: See VTK visualizations rendered in real-time\n- Code export: View, edit, and copy generated VTK code\n- Local & cloud support: Both cloud APIs and local model endpoints\n\n### Command Line Interface\n\n```bash\n# Basic usage\nvtk-prompt \"Create a red sphere\"\n\n# Advanced options\nvtk-prompt \"Create a textured cone with 32 resolution\" \\\n  --provider anthropic \\\n  --model claude-opus-4-1-20250805 \\\n  --max-tokens 4000 \\\n  --rag \\\n  --verbose\n\n# Using different providers\nvtk-prompt \"Create a blue cube\" --provider openai --model gpt-5\nvtk-prompt \"Create a cylinder\" --provider nim --model meta/llama3-70b-instruct\n```\n\n### RAG (Retrieval Augmented Generation)\n\nEnhance code generation with relevant VTK examples:\n\n1. **Build RAG database** (one-time setup):\n\n```bash\nvtk-build-rag\n```\n\n2. **Test RAG system** (optional):\n\n```bash\nvtk-test-rag \"How to create a cube in VTK\"\n```\n\n3. **Use RAG in queries**:\n\n```bash\nvtk-prompt \"Create a vtkSphereSource with texture mapping\" --rag\n```\n\n### Python API\n\n```python\nfrom vtk_prompt import VTKPromptClient\n\nclient = VTKPromptClient()\ncode = client.generate_code(\"Create a red sphere\")\nprint(code)\n```\n\n## Configuration\n\n### Environment Variables\n\n- `ANTHROPIC_API_KEY` - Anthropic Claude API key\n- `OPENAI_API_KEY` - OpenAI API key (also used for NVIDIA NIM)\n\n### Supported Providers & Models\n\n| Provider      | Default Model            | Base URL                            |\n| ------------- | ------------------------ | ----------------------------------- |\n| **anthropic** | claude-opus-4-1-20250805 | https://api.anthropic.com/v1        |\n| **openai**    | gpt-5                    | https://api.openai.com/v1           |\n| **nim**       | meta/llama3-70b-instruct | https://integrate.api.nvidia.com/v1 |\n| **custom**    | User-defined             | User-defined (for local models)     |\n\n### Custom/Local Models\n\nYou can use local models via OpenAI-compatible APIs:\n\n```bash\n# Using Ollama\nvtk-prompt \"Create a sphere\" \\\n  --provider custom \\\n  --base-url http://localhost:11434/v1 \\\n  --model llama2\n\n# Using LM Studio\nvtk-prompt \"Create a cube\" \\\n  --provider custom \\\n  --base-url http://localhost:1234/v1 \\\n  --model local-model\n```\n\n## CLI Reference\n\n```\nusage: vtk-prompt [-h] [--provider {anthropic,openai,nim,custom}]\n                  [-m MODEL] [-k MAX_TOKENS] [-t TOKEN] [--base-url BASE_URL]\n                  [-r] [-v] [--collection COLLECTION] [--database DATABASE]\n                  [--top-k TOP_K] input_string\n\nGenerate VTK visualization code using Large Language Models\n\npositional arguments:\n  input_string          Description of the VTK visualization to generate\n\noptions:\n  -h, --help            Show this help message and exit\n  -m MODEL, --model MODEL\n                        Model name to use\n  -k MAX_TOKENS, --max-tokens MAX_TOKENS\n                        Maximum number of tokens to generate\n  -t TOKEN, --token TOKEN\n                        API token (defaults to environment variable)\n  --base-url BASE_URL   Base URL for API (for custom/local models)\n  -r, --rag             Use Retrieval Augmented Generation\n  -v, --verbose         Show generated source code\n  --provider {anthropic,openai,nim,custom}\n                        LLM provider to use\n\nRAG Options:\n  --collection COLLECTION\n                        Collection name for RAG (default: vtk-examples)\n  --database DATABASE   Database path for RAG (default: ./db/codesage-codesage-large-v2)\n  --top-k TOP_K         Number of examples to retrieve (default: 5)\n```\n\n## Available Commands\n\n- `vtk-prompt` - Main CLI for code generation\n- `vtk-prompt-ui` - Launch web interface\n- `vtk-build-rag` - Build RAG database from VTK examples\n- `vtk-test-rag` - Test RAG functionality\n- `gen-vtk-file` - Generate VTK XML files\n- `rag-chat` - Interactive RAG chat interface\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\nFor detailed development instructions, see [DEVELOPMENT.md](DEVELOPMENT.md)\nwhich covers:\n\n- Setting up the development environment\n- Running tests and linting\n- Developer mode for the web UI\n- Code formatting and type checking\n- Pre-commit hooks\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file\nfor details.\n\n## Architecture\n\n- **Core**: Python package with CLI and API\n- **UI**: Trame-based web interface with VTK rendering\n- **RAG**: ChromaDB + Llama Index for code example retrieval\n- **Providers**: Unified interface for multiple LLM APIs\n\n## Links\n\n- [PyPI Package](https://pypi.org/project/vtk-prompt/)\n- [Documentation](https://github.com/vicentebolea/vtk-prompt)\n- [Issues](https://github.com/vicentebolea/vtk-prompt/issues)\n- [VTK Documentation](https://vtk.org/documentation/)\n\n---\n\nMade with care for the VTK and scientific visualization community.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A project combining VTK visualization with LLM APIs (Anthropic, OpenAI, NVIDIA NIM)",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/vicentebolea/vtk-prompt",
        "Issues": "https://github.com/vicentebolea/vtk-prompt/issues",
        "Repository": "https://github.com/vicentebolea/vtk-prompt"
    },
    "split_keywords": [
        "vtk",
        " visualization",
        " llm",
        " ai",
        " anthropic",
        " openai"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a1da44ead723596eb9d4d5d79ac94dd5666f986b9af56678ef9aee83a7419c91",
                "md5": "09c8816d7199d54d26a69cf4fe4f38ad",
                "sha256": "120ea07a603d85fdf2c6fb85b55cd993a9293fef4f44396164efb6b6ac5c361e"
            },
            "downloads": -1,
            "filename": "vtk_prompt-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "09c8816d7199d54d26a69cf4fe4f38ad",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 37838,
            "upload_time": "2025-10-24T21:19:11",
            "upload_time_iso_8601": "2025-10-24T21:19:11.329378Z",
            "url": "https://files.pythonhosted.org/packages/a1/da/44ead723596eb9d4d5d79ac94dd5666f986b9af56678ef9aee83a7419c91/vtk_prompt-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2d25cc3bd422e412d1d9cb19a71f244d19e76d2c2656470dfb98238b2b5a0eab",
                "md5": "44ff95cd7d393b3a9211f8b012f83d86",
                "sha256": "a33164ba6aa22845fc230e7453c2c4d783adaa710a7e805d14759fae06901581"
            },
            "downloads": -1,
            "filename": "vtk_prompt-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "44ff95cd7d393b3a9211f8b012f83d86",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 791652,
            "upload_time": "2025-10-24T21:19:12",
            "upload_time_iso_8601": "2025-10-24T21:19:12.963039Z",
            "url": "https://files.pythonhosted.org/packages/2d/25/cc3bd422e412d1d9cb19a71f244d19e76d2c2656470dfb98238b2b5a0eab/vtk_prompt-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-24 21:19:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "vicentebolea",
    "github_project": "vtk-prompt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "vtk-prompt"
}
        
Elapsed time: 1.77094s