Sign inSign up
docportal-ai logo

gramax/docportal-ai

By gramax

•Updated 3 months ago

Image
0

925

gramax/docportal-ai repository overview

⁠Server for AI Features in the Gramax docportal
⁠Docker-compose
version: "3.8"
services:
  db: 
    image: qdrant/qdrant
    environment:
    - QDRANT__SERVICE__MAX_REQUEST_SIZE_MB=512
    ports:
      - 3006:6333
    volumes:
        - server-ai-qdrant-storage:/qdrant/storage
  docportal-ai:
    image: docportal-ai
    environment:
      - VECTORDB__TYPE=qdrant
      - VECTORDB__HOST=http://db:6333

      - EMBEDDING__TYPE=openai
      - EMBEDDING__MODEL=text-embedding-3-small
      - EMBEDDING__DIMENSIONS=1536
      - EMBEDDING__APIKEY=<your key>

      - CHAT__TYPE=openai
      - CHAT__MODEL=gpt-4o
      - CHAT__APIKEY=<your key>

      - AUTH__ADMIN__TOKEN=<key for Gramax>
    ports:
      - 3005:3005
    volumes:
      - server-ai-api-storage:/app/storage
      - ./config.yaml:/app/config/config.yaml
    depends_on:
    - db

volumes:
  server-ai-qdrant-storage:
    external: false
  server-ai-api-storage:
    external: false
⁠Configuration

The configuration file must be located at /app/config/config.yaml inside the container.

Configuration can be set via environment variables using __ as a section delimiter. Examples:

  • VECTORDB__TYPE=qdrant
  • VECTORDB__HOST=http://db-host:6333
  • LOGGING__TARGETS__0__TYPE=file
  • LOGGING__TARGETS__0__OPTIONS__DESTINATION=/app/logs/server.log
  • LOGGING__TARGETS__1__TYPE=seq

The configuration file is optional - all settings can be specified via environment variables. The configuration file is loaded first, and then environment variables are loaded, which can override properties from the file.

⁠Minimal Configuration

config.yaml:

vectordb:
  type: qdrant
  host: http://your-qdrant-host:port
embedding:
  type: openai
  model: text-embedding-3-small
  dimensions: 1536
  apiKey: <your key>
chat:
  type: openai
  model: gpt-4o
  apiKey: <your key>
auth:
  admin:
    token: <key for Gramax>

Equivalent in environment variables:

VECTORDB__TYPE=qdrant
VECTORDB__HOST=http://your-qdrant-host:port

EMBEDDING__TYPE=openai
EMBEDDING__MODEL=text-embedding-3-small
EMBEDDING__DIMENSIONS=1536
EMBEDDING__APIKEY=<your key>

CHAT__TYPE=openai
CHAT__MODEL=gpt-4o
CHAT__APIKEY=<your key>

AUTH__ADMIN__TOKEN=<key for Gramax>
⁠Description of All Configuration Properties
# Vector DB connection settings
vectordb:
  # Type of vector DB
  # Values: qdrant
  # Required
  type: qdrant
  # DB address
  # Required
  host: http://qdrant-host:port

# Embedding settings
embedding:
  # Provider type
  # Type openai supports any provider compatible with OpenAI API
  # Values: openai, ollama
  # Required
  type: openai
  # Embedding model to use
  # The model must support Embeddings
  # For example, OpenAI offers models like text-embedding-3-large and text-embedding-3-small
  # Required
  model: modelName
  # Vector size
  # Check the model documentation for the correct dimensions
  # Required
  dimensions: 1536
  # Provider endpoint
  # Optional if using OpenAI directly
  # Examples:
  #   DeepSeek: https://api.deepseek.com/v1
  #   OpenRouter: https://openrouter.ai/api/v1
  # Optional
  host: https://openai-compatible-provider
  # API key for provider
  # Some providers may require an API key even if not used
  # You can use any random string if not required
  # Optional
  apiKey: token
  # Proxy URL
  # Requests to the provider will be routed through this proxy
  # Optional
  socksProxyUrl: https://some-proxy-url
  # Search instruction template
  # Check model docs for recommended instruction
  # %1 will be replaced with the actual query
  # Default: "%1"
  # Optional
  searchInstruction: |
    Instruct: Given a web search query, retrieve relevant passages that answer the query
    Query: \%1

  # ollama provider type
  # Properties same as above
  type: ollama
  model: ollamaModelName
  dimensions: 1536
  host: http://ollama-host:port
  searchInstruction: "%1"

# LLM settings for generating responses
chat:
  # Provider type
  # Values: openai
  # Required
  type: openai
  # Model to use
  # The model must support Chat Completions
  # Required
  model: gpt-4o
  # Same as embedding
  host: https://openrouter.ai/api/v1
  # Same as embedding
  apiKey: token
  # Same as embedding
  socksProxyUrl: https://some-proxy-url

# Server authentication settings
# At least one user must be specified to access the server
# Required
auth:
  # User ID
  # Only used in logs
  myNewUser:
    # Token required to access via Gramax
    # Required
    token: token
    # List of allowed endpoints for this user
    # Examples:
    #   - * - all endpoints allowed
    #   - /endpoint1/*
    #   - /end/*/point2
    # Use quotes around "*" because * has special meaning in YAML
    # Default: ["*"]
    # Optional
    allowed:
    - "*"

# CORS configuration
# Optional
cors:
  # List of allowed origins
  # If omitted or empty, all origins will be allowed (reflected dynamically)
  # Optional
  allowed:
    - "http://example.com"
    - "https://my-site.io"

# Logging settings
# Optional
logging:
  # Enable console logging
  # true = log to console
  # Values: true, false
  # Default: true
  # Optional
  console: false
  # Log targets configuration
  # As a list
  targets:
      # Target type
      # Values: file, seq, elasticsearch
      # Required
    - type: file
      # Minimum log level
      # Only logs at this level or higher will be sent
      # silent = disable logs for this target
      # Values: silent, trace, debug, info, warn, error, fatal
      # Default: trace
      # Optional
      level: trace
      # Target-specific options
      # Required
      options:
        # Path to the file
        # Required
        destination: app/logs/log1.log
      
      # Seq target type
    - type: seq
      options:
        # Seq server URL
        # Required
        serverUrl: http://localhost:5341
        apiKey: token

      # Elasticsearch target type
    - type: elasticsearch
      options:
        # Elasticsearch node address
        # Required
        node: http://localhost:9200
        # Index name in Elasticsearch
        # Required
        index: my-precious-logs
        # You can specify either username + password or just apiKey
        auth:
          username: elastic
          password: Password1
          apiKey: token

Tag summary

Content type

Image

Digest

sha256:93215e0bc…

Size

112.9 MB

Last updated

3 months ago

docker pull gramax/docportal-ai