logfire icon indicating copy to clipboard operation
logfire copied to clipboard

Support of instrumenting Anthropic models

Open samuelcolvin opened this issue 1 year ago • 8 comments

Originally posted by @salahaz as a discussion #88

Is there going to be in the near future support of instrumenting other AI models such Anthropic?

samuelcolvin avatar May 03 '24 15:05 samuelcolvin

Related to https://github.com/pydantic/logfire/issues/109 since they already support Anthropic.

alexmojaki avatar May 03 '24 15:05 alexmojaki

@salahaz #98 shows how you can already do this with Mirascope in the meantime while we patiently wait for this feature

@samuelcolvin I'd love to take this feature request on if you'd like :)

We've already implemented the majority of it in our library following how you instrument openai, so shouldn't be too difficult to port over (and we can use the llm tag so it shows up pretty in the UI with no additional changes)

willbakst avatar May 03 '24 16:05 willbakst

@samuelcolvin I'd love to take this feature request on if you'd like :)

@willbakst I think that'd be very appreciated

alexmojaki avatar May 06 '24 11:05 alexmojaki

@alexmojaki Do you have a contribution guide I can follow?

willbakst avatar May 06 '24 18:05 willbakst

https://github.com/pydantic/logfire/blob/main/CONTRIBUTING.md

alexmojaki avatar May 06 '24 18:05 alexmojaki

@alexmojaki I just ran through the guide:

  1. There are 7 skipped tests and 2 xfailed tests. Is this expected?
  2. Running make docs aborts with 9 warning in strict mode. Is this expected? (I can turn strict mode to false locally to get it to work).

willbakst avatar May 08 '24 20:05 willbakst

Yes and yes. Our docs use a closed source version of mkdocs with special features for sponsors/insiders, so external contributors can't actually build them fully. The contribution guide should really reflect this.

alexmojaki avatar May 08 '24 20:05 alexmojaki

Update: I have a locally working version with tests, but a lot of the code is duplicated given the similarity with OpenAI. Going to spend some time refactoring to reduce code/test duplication and hopefully make it easier to instrument additional providers in the future (assuming they use the same SDK generation provider).

This will take a little longer to get done, but I believe well worth it.

willbakst avatar May 09 '24 19:05 willbakst