Skip to content

Missing config for FastTopicDiscovery in deploy #64

@mdocekal

Description

@mdocekal

There is proposal for the config, needs to download the:

tagger_file_path: czech-morfflex2.0-pdtc1.0-220710.tagger.large_fixture

We already have one in LFS:
tests/test_utils/fixtures/czech-morfflex2.0-pdtc1.0-220710.tagger.large_fixture

We need to also handle the api key

config:


topicer:  # Variant of topicer to use
  cls: FastTopicDiscovery # name of class that is subclass of BaseTopicer
  config: # configuration for defined class
    n_topics: 10  # Number of topics to discover.
    tokenizer: # Tokenizer used to preprocess texts before topic discovery.
      cls: CzechLemmatizedTokenizer  # name of class that is subclass of Tokenizer
      config: # configuration for defined class
        stopwords: czech  # List of stopwords to remove from the text during tokenization or language (available languages https://github.com/Alir3z4/stop-words).
        keep_num: false # Whether to keep numeric tokens in the text.
        keep_alphanum: false # Whether to keep alphanumeric tokens in the text.
        strip_html: false # Whether to strip HTML tags from the text before tokenization.
        no_lower: false # Whether to skip lowercasing of the text before tokenization.
        min_length: 3 # Minimum length of tokens to keep.
        tagger_file_path: czech-morfflex2.0-pdtc1.0-220710.tagger.large_fixture # Path to the Morphodita tagger file.
    vocab_size: 5000 # Size of the vocabulary for topic modeling.
    verbose: false # Whether to print verbose output during topic discovery.
    topic_rep_size: 15 # Number of top words to represent each topic.
    topic_doc_rep_size: 3 # Number of top documents to represent each topic.
    topic_doc_search_time: 100 # Number of top documents to search for time phrases when generating topic descriptions.
    topic_time_doc_rep_size: 3 # Number of documents with time phrases to represent each topic when generating topic descriptions. These documents will be randomly selected.
    generate_topic_name_model: gpt-5-mini # Model to use for generating topic names.
    generate_description_model: gpt-5-mini # Model to use for generating topic names.
    generate_topic_name_system_prompt: |
      Pojmenuj skupiny slov na základě jejich společného tématu a pro kontext využij přiložené dokumenty.

      Příklad:
      Slova: jablko, banán, hrozen, slunečnice
      Dokumenty:
      Jablka se pěstují v mnoha částech světa a jsou bohatá na vitamíny.
      Banány jsou tropické ovoce, které je bohaté na draslík.
      Slunečnice jsou nádherné rostliny, které rostou vysoko a následují slunce.

      {
          "explanation": ""Jablko", "banán" a "hrozen" patří mezi ovoce. "Slunečnice" je rostlina. Dokument 1 je o jablkách. Dokument 2 je o banánech. Dokument 3 je o slunečnicích. Takže název tématu by mohl být:",
          "name": "Ovoce a rostliny"
      }

      Vrať názvy ve formátu JSON:

      {
          "explanation": "Vysvětlení",
          "name": "Název",
      }

      Důležité: Výstupem musí být pouze tento JSON, bez dalšího textu.
      Důležité: Snaž se téma popsat jedním výrazem (např. "ovoce" nebo "rostliny"). Nepoužívej spojku "a", pokud to není nezbytně nutné.
      Důležité: Ujisti se, že ve vysvětlení zmíníš každý dokument (očísluj je jako 1., 2., 3.!).
      Důležité: Nezapomeň nejprve rozebrat roli slov a až poté dokumenty.
    # System prompt for generating topic names.
    generate_topic_name_prompt: |
      Analyzuj následující:
      Slova: {{ topic_words | join(", ") }}
      Dokumenty:
      {% for doc in topic_docs %}
      {{doc.text}}
      {% endfor %}

      - Vysvětli, proč každé slovo a dokument zapadá do tématu (nebo nezapadá).
      - Navrhni název pro tuto skupinu.
    # Jinja2 template prompt for generating topic names.
    generate_description_system_prompt: |
      Vytvoř popis tématu na základě názvu tématu, dokumentů reprezentujících téma a dokumentů obsahujících časové výrazy.
      Ve svém popisu se zaměř na časové události a jejich význam v kontextu tématu.

      Příklad:

      Název tématu: Středověká Evropa

      Dokumenty reprezentující téma:
      Praha byla významným centrem během středověku.
      Proběhlo mnoho důležitých událostí v Evropě během středověku.

      Dokumenty s časovými výrazy:
      Dokument 1: Karel IV. se narodil ve 14. století.
      Dokument 2: Bitva u Hastings v roce 1066 byla klíčovou událostí.

      Popis tématu:
      Téma "Středověká Evropa" zahrnuje období od 5. do 15. století, které bylo svědkem významných historických událostí, jako je narození Karla IV. ve 14. století a Bitva u Hastings v roce 1066.

      Vrať pouze popis tématu bez dalších vysvětlení ve formátu JSON:
      {
          "description": "Popis tématu"
      }

      Důležité: Výstupem musí být pouze tento JSON, bez dalšího textu.
      Důležité: Cílit na časové události a jejich význam v kontextu tématu.
    # System prompt for generating topic descriptions based on time phrases.
    generate_description_prompt: |-
      Název tématu: {{ topic_name }}
      Dokumenty reprezentující téma:
      {% for doc in topic_docs %}
      {{doc.text}}
      {% endfor %}
      Dokumenty s časovými výrazy:
      {% for doc in time_docs %}
      {{doc.text}}
      {% endfor %}

      Popis tématu:
    # Jinja2 template prompt for generating topic descriptions based on time phrases.
    sparse_threshold: 0.2 # Threshold for sparsity in topic-document distributions. Can be combined with sparse_top_k.
    sparse_top_k: 3 # Number of top topics to keep per document in sparse representation. Can be combined with sparse_threshold.
    max_char_length: 1024 # Maximum character length of texts. Longer texts will be truncated from the end before processing.
    time_text_detector: # Detector for finding time expressions in text.
      cls: CzechTimeTextDetector  # name of class that is subclass of TimeTextDetector
      config: # configuration for defined class
    random_seed: 42 # Random seed used for selecting documents with time phrases when generating topic descriptions.
    use_db_embeddings: true # Whether to use precomputed embeddings from the database for topic discovery. If false, embeddings will be computed on-the-fly.
llm_service: # LLM service to use
  cls: OpenAsyncAPI # name of class that is subclass of BaseLLMService
  config: # configuration for defined class
    api_key:  # API key.
    base_url: # Base URL for API.
    pool_interval: 300 # Interval in seconds for checking status.
    process_requests_interval: 1 # Interval in seconds between sending requests when processed synchronously.
    concurrency: 10 # Maximum number of concurrent requests to the API. This is used with async processing.
    default_model: gpt-5-mini # Default model to use for requests.
db_connection: # Database connection to use
  cls: WeaviateService # name of class that is subclass of BaseDBConnection
  config: # configuration for defined class
    host: localhost  # Weaviate host
    rest_port: 8080 # Weaviate REST port
    grpc_port: 50051 # Weaviate gRPC port
    chunks_collection: Chunks_test # Collection/class name storing text chunks
    chunk_user_collection_ref: userCollection # Property on Chunks referencing the user collection
    chunk_text_prop: text # Property name of the text field within the chunks collection
    chunks_limit: 100000 # Max number of chunks to retrieve per request
    hybrid_search_alpha: 0.5 # Alpha parameter for hybrid search (0.0 = pure keyword search, 1.0 = pure vector search)
    max_vector_distance: 0.5 # Maximum vector distance for similarity searches
embedding_service: # Text embedding service to use
  cls: LocalEmbedder # name of class that is subclass of BaseEmbeddingService
  config: # configuration for defined class
    model: BAAI/bge-multilingual-gemma2  # Any model name from sentence-transformers library or compatible model from huggingface hub.
    cache_folder: # Path to cache directory for the model.
    prompt: |-
      <instruct>Represent this Czech historical document to find similar ones.
      <query>
    # Prompt for the embedding model, if supported.
    query_prompt: # Query prompt for the embedding model, used for query embedding methods.
    batch_size: 32 # Batch size for encoding documents.
    device: # Device(s) to use for computation. Can be: - A single device string (e.g., "cuda:0", "cpu") for single-process encoding - A list of device strings (e.g., ["cuda:0", "cuda:1"], ["cpu", "cpu", "cpu", "cpu"]) to distribute encoding across multiple processes - None to auto-detect available device for single-process encoding If a list is provided, multi-process encoding will be used. Defaults to None.
    return_fp32: true # Whether to return embeddings as FP32 numpy arrays. If False, the embeddings will be in the default dtype of the model.
    normalize_embeddings: true # Whether to normalize the embeddings using L2 normalization.
    show_progress_bar: false # Whether to show a progress bar during embedding.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions