neatlogs.* attributes for TOOL, RETRIEVER, RERANKER, GUARDRAIL, and VECTOR_STORE spans.
When building custom logic, set neatlogs.* attributes on your spans so the dashboard can render the right visualizations. These are the same attributes automatically populated by supported libraries. Setting them manually on custom implementations gives you identical dashboard views.
The @span(kind="TOOL", tool_name="...", description="...") decorator sets these automatically. Use the context manager when you need finer control:
import neatlogs
with neatlogs.trace( "search_web" , kind = "TOOL" ) as span:
span.set_attribute( "neatlogs.tool.name" , "search_web" )
span.set_attribute( "neatlogs.tool.description" , "Search the web for information" )
result = my_search_api(query)
Attribute Type Description neatlogs.tool.namestrTool identifier neatlogs.tool.descriptionstrWhat the tool does neatlogs.tool.parametersstr (JSON)Parameter schema
import json
import neatlogs
with neatlogs.trace( "retrieve_docs" , kind = "RETRIEVER" ) as span:
span.set_attribute( "neatlogs.retrieval.query" , query)
span.set_attribute( "neatlogs.retrieval.top_k" , top_k)
docs = my_custom_retriever.search(query, k = top_k)
span.set_attribute( "neatlogs.retrieval.documents" , json.dumps(docs))
Attribute Type Description neatlogs.retrieval.querystrSearch query neatlogs.retrieval.top_kintNumber of results requested neatlogs.retrieval.documentsstr (JSON)Retrieved documents as a JSON array
import json
import neatlogs
with neatlogs.trace( "rerank" , kind = "RERANKER" ) as span:
span.set_attribute( "neatlogs.reranker.query" , query)
span.set_attribute( "neatlogs.reranker.top_k" , top_n)
span.set_attribute( "neatlogs.reranker.model_name" , "cohere-rerank-v3" )
span.set_attribute( "neatlogs.reranker.input_documents" , json.dumps(docs))
reranked = my_reranker.rerank(query, docs, top_n = top_n)
span.set_attribute( "neatlogs.reranker.output_documents" , json.dumps(reranked))
Attribute Type Description neatlogs.reranker.querystrOriginal search query neatlogs.reranker.top_kintNumber of results to keep neatlogs.reranker.model_namestrReranker model name (optional) neatlogs.reranker.input_documentsstr (JSON)Documents before reranking neatlogs.reranker.output_documentsstr (JSON)Documents after reranking
import neatlogs
with neatlogs.trace( "safety_check" , kind = "GUARDRAIL" ) as span:
span.set_attribute( "neatlogs.guardrail.input" , content_to_check)
passed, message = run_safety_check(content_to_check)
span.set_attribute( "neatlogs.guardrail.passed" , passed)
span.set_attribute( "neatlogs.guardrail.output" , message)
Attribute Type Description neatlogs.guardrail.inputstrContent being checked neatlogs.guardrail.passedboolWhether the check passed neatlogs.guardrail.outputstrValidation result or failure reason
import neatlogs
with neatlogs.trace( "index_documents" , kind = "VECTOR_STORE" ) as span:
span.set_attribute( "neatlogs.vectordb.index_name" , "support_kb" )
span.set_attribute( "neatlogs.vectordb.embedding_model" , "text-embedding-3-small" )
span.set_attribute( "neatlogs.vectordb.vector_dimension" , 1536 )
my_custom_store.upsert(docs)
Attribute Type Description neatlogs.vectordb.index_namestrCollection or index name neatlogs.vectordb.embedding_modelstrEmbedding model used neatlogs.vectordb.vector_dimensionintDimension of stored vectors neatlogs.vectordb.similarity_algorithmstrDistance metric (e.g., cosine)