Prompt
Use names that accurately reflect meaning, scope (internal vs external), and responsibility—and keep them consistent with existing/base APIs.
Apply these rules: 1) Internal fields vs user-visible concepts: If a property is implicit/internal, name it consistently with an underscore prefix and ensure all relevant types expose it.
- Example: store internal vectors on the graph vertex as
_embedding(notembedding) and ensureParagraphChunkprovides_embedding.
2) Match the data type/role to the identifier: Don’t call vectors “keywords” or “text” if the value is embeddings.
- Rename patterns:
keywords: List[List[float]]→subsorembeddings.
3) Responsibility-revealing function names: The function name must describe what it actually does.
- Example: if the function constructs and persists a document graph, prefer something like
def _load_doc_graph(self, chunks: List[Chunk]):over_parse_chunks.
4) Avoid duplicate/conflicting base names: Don’t introduce new variants of fields already defined by base classes.
- Example: remove redundant
_metadataifKnowledgealready owns the metadata concept.
5) Avoid ambiguous configuration parameter names: Prefer names that won’t be mistaken for other common concepts.
- Example: use
model_aliasinstead ofversionwhen the field is an alias used for registration.
6) Use pythonic module/file naming: Ensure filenames follow standard Python conventions (lowercase with underscores, no camel-case file names).
If you’re unsure, ask: “Can another developer infer the value’s meaning and the function’s side effects from the name alone?” If not, rename it.