docs(samples): backfill READMEs for anthropic + cohere + mistral provider samples#160
Closed
mmercuri wants to merge 3 commits into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backfills missing
README.mdfor three provider samples onfeat/instrument-llm-providers(PR #94). Per the sample audit atA:/tmp/adapter-samples-audit.md,anthropic,cohere, andmistralall had working
main.pyfiles but no README.openai(CLEAN peraudit) is the canonical reference shape that the new READMEs match.
azure_openaiandollamaare not present undersamples/instrument/on this branch (they live on
feat/instrument-providers-azure-openaiand
feat/instrument-providers-ollamarespectively, pergh pr list),so this PR does not touch them.
Per-provider features demonstrated (source-traced)
All claims trace to
main.pyfor each sample and the correspondingadapter at
src/layerlens/instrument/adapters/providers/<name>_adapter.py.anthropic
client.messages.createandclient.messages.streamviamethod substitution in
AnthropicAdapter.connect_client.client.messages.createagainstclaude-haiku-4-5-20251001.model.invoke,cost.record, and (when tool_use blocks arepresent)
tool.call. Anthropic'ssystemkwarg is captured inrequest parameters;
response.contentis iterated as typed blocks.cohere
client.chat(v1),client.v2.chat(v2), andclient.embedvia method substitution in
CohereAdapter.connect_client.client.chat(...)) againstcommand-r-plus.response.meta.billed_units; pricingfalls back to
pricing_unavailable: Truefor unknown models.mistral
client.chat.complete,client.chat.stream, andclient.embeddings.createvia method substitution inMistralAdapter.connect_client.client.chat.completeagainstmistral-small-latestusing the nativemistralai.Mistralclient (not the OpenAI-compatible REST shim).
random_seed,response_format,safe_prompt,tool_choice.PR #154 note
Each README carries a NOTE that the sample predates PR #154's
typed-events migration. Verified by reading
src/layerlens/instrument/adapters/providers/_base/provider.pyon thisbranch —
_emit_model_invokestill callsself.emit_dict_event(...),so dict-shaped events are still the current contract on
feat/instrument-llm-providers. PR #154 is open (not merged) and isbased off a different parent branch.
Test plan
main.pyand the adapter sourceanthropic,cohere,mistraleachhave
main.py+__init__.pyand no priorREADME.mdon thisbranch via
git ls-tree -r origin/feat/instrument-llm-providersvs v2, Mistral native vs OpenAI-compatible, Claude version pin)
Out of scope
rebase of this branch)
azure_openai/ollama(those samples don'texist on this branch)