openaivec
AGENTS.md25 starsChanged 9 days agoMITView on GitHub
- Reads credentials
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository3 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- openaivec-skillSkill
The file
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 0 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 21
Use PreparedTask for reusable instruction/schema pairs.
- Very specific: line 25
Run focused suites for touched subsystems when possible (for example uv run pytest tests/_cache tests/_schema).
- Very specific: line 27
Use uv pip install -e . only when external tooling requires an editable install.
- Very specific: line 32
Keep sync/async APIs behaviorally aligned (.ai.* vs .aio.*, Batch* vs AsyncBatch*), dataframe accessors descriptive (responses, extract, …
- Very specific: line 36
Use markers consistently: @pytest.mark.requires_api, @pytest.mark.slow, @pytest.mark.spark, @pytest.mark.integration, @pytest.mark.asyncio.
- Very specific: line 37
Add regression tests before fixes, assert on structure/length/order rather than verbatim text, and prefer shared fixtures over heavy …
- Very specific: line 47
Keep local secrets under artifacts/, never commit credentials, and rely on CI-managed secrets when extending automation.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Repository Guidelines
Project Layout
src/openaivec/: core batched wrappers (_responses.py,_embeddings.py), batching/caching internals (_cache/proxy.py,_cache/optimize.py,_cache/_backend.py), provider/DI setup (_provider.py,_di.py), schema inference (_schema/), and integrations (pandas_ext/,spark_ext.py,duckdb_ext/).src/openaivec/task/: function-style task factories by domain (nlp/,customer_support/,table/) plus registry plumbing in_registry.py.tests/: mirrors the source layout, including focused suites intests/_cache/,tests/_schema/, andtests/duckdb_ext/.docs/holds MkDocs sources,site/generated pages, andartifacts/scratch assets kept out of releases.
Core Components & Contracts
- Remote batched execution goes through
BatchCache/AsyncBatchCacheinopenaivec._cache; proxies dedupe inputs in-order, require same-length outputs, and release in-flight waiters on failure. The cache layer is pluggable viaCacheBackend(default: in-memoryOrderedDict);DuckDBCacheBackendprovides persistent cross-session caching. batch_sizebehavior is shared across sync/async proxies:NoneenablesBatchSizeSuggesterauto-tuning (target ~30-60s per batch), positive values force fixed chunks, and<= 0processes all items in one call.- Progress bars appear only when
show_progress=Trueand the runtime is notebook-like. _responses.py/_embeddings.pyare batched OpenAI wrappers with one transport retry owner:retry_policy=Nonepreserves SDK retries; explicitRetryPolicydisables SDK retries on a configuration copy and applies bounded attempts, capped jitter, and an optional shared batch deadline. Structured outputs use Pydanticresponse_format; validation corrections have a separatemax_validation_retriescount and share that deadline. Do not restore an outer retry decorator or close caller-owned clients.parsehelpers infer schema whenresponse_format=None; pass explicit models when deterministic output shape is required.- Reuse caches from
*_with_cachehelpers (or Spark UDF-local caches) per operation and clear them (clear/aclose) when finished to avoid unbounded cache growth. duckdb_ext/groups DuckDB UDF registration (responses_udf,embeddings_udf,task_udf,parse_udf,count_tokens_udf), schema inference,similarity_search, and Pydantic-to-DDL conversion.DuckDBCacheBackendremains in core_cacheand can be used as thecachefield ofBatchCachefor persistent cross-session caching. DuckDB is a core dependency.
Task & Schema Conventions
- Export tasks as factory functions (for example
nlp.sentiment_analysis()), not constant task instances. - Each task module should define a
TASK_SPECentry fortask._registry, and task response models should reject unknown fields (ConfigDict(extra="forbid")). - Use
PreparedTaskfor reusable instruction/schema pairs; it is immutable and intentionally does not store default API kwargs.
Development Workflow
uv sync --all-extras --devprepares extras and tooling; iterate withuv run pytest -m "not slow and not requires_api"before a fulluv run pytest.- Run focused suites for touched subsystems when possible (for example
uv run pytest tests/_cache tests/_schema). uv run ruff check . --fixenforces style,uv run pyrightguards API changes, anduv buildvalidates the distribution.- Use
uv pip install -e .only when external tooling requires an editable install.
Coding Standards
- Target Python 3.11+, rely on absolute imports, and keep helpers private with leading underscores; expose symbols via explicit
__all__(internal modules can keep__all__ = []unless specific exports are required). - Apply Google-style docstrings with
(type)Args, Returns/Raises sections, double-backtick literals, and doctest-styleExample:blocks (>>>) when useful. - Keep sync/async APIs behaviorally aligned (
.ai.*vs.aio.*,Batch*vsAsyncBatch*), dataframe accessors descriptive (responses,extract,fillna), and raise narrow exceptions (ValueError,TypeError).
Testing Guidelines
- Pytest discovers
tests/test_*.py; parametrize to cover pandas vectorization, Spark UDFs, and async pathways. - Use markers consistently:
@pytest.mark.requires_api,@pytest.mark.slow,@pytest.mark.spark,@pytest.mark.integration,@pytest.mark.asyncio; skip gracefully when credentials or optional deps are missing. - Add regression tests before fixes, assert on structure/length/order rather than verbatim text, and prefer shared fixtures over heavy mocking.
Collaboration
- Commits follow
type(scope): summary(e.g.,fix(pandas): guard empty batch) and avoid merge commits within feature branches. - Pull requests explain motivation, outline the solution, link issues, list doc updates, and include the latest
uv run pytestanduv run ruff check . --fixoutput; attach screenshots for doc or tutorial changes.
Environment & Secrets
- Auth precedence is
OPENAI_API_KEYfirst, then Azure (AZURE_OPENAI_BASE_URLwith optionalAZURE_OPENAI_API_KEYfor API-key auth; otherwise Entra ID viaDefaultAzureCredential). - Azure endpoints should end with
/openai/v1/(legacy paths work but emit warnings). - For Spark, call
setup/setup_azurebefore registering UDFs so local and executor environments stay in sync. - Keep local secrets under
artifacts/, never commit credentials, and rely on CI-managed secrets when extending automation.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

