instructor_ex icon indicating copy to clipboard operation
instructor_ex copied to clipboard

support claude

Open TwistingTwists opened this issue 1 year ago • 17 comments

Hey,

I've been thinking about supporting Claude. I'll raise a PR once I am done. @thmsmlr If you have suggestions around this, please let me know.

TwistingTwists avatar Mar 09 '24 12:03 TwistingTwists

i just read about claude being better at summarization, which is the task i'm playing with. Exciting to see if it performs better

knewter avatar Mar 10 '24 01:03 knewter

Yep +1 from me. If there's anything I can do to help, e.g. try out the PR, let me know.

cigrainger avatar Mar 14 '24 12:03 cigrainger

Yes, i'm in support. I don't think it should be too difficult, just a new adapter.

I have heard Claude really like XML style prompting. And while instructor_ex doesn't have much of an opinion on prompting style since it's mostly in control of the user, there are still a few prompts the instructor_ex does create and are hard coded.

As you play with it, let me know if this is a big issue. If so, we can create a separate PR to make internal prompt templating user configurable (like in the validation/re-asking code paths)

thmsmlr avatar Mar 16 '24 15:03 thmsmlr

I am in middle of some experiments with claude. Will revert back later this week to gather review and more opinions.

Warning: you may see some bad code. Please bear with me. :)

TwistingTwists avatar Mar 17 '24 04:03 TwistingTwists

@TwistingTwists paraphrasing Jacob Collier on musical creativity:

There is no such thing as "good code" or "bad code", it's just the code that feels right for you

Your contribution will be very appreciated no matter what (I will definitely enjoy using Claude), and someone can always improve it right after :smile:

thbar avatar Mar 17 '24 13:03 thbar

i'd happily put some "bad code" through its paces :D

i'm rather excited to play with claude

knewter avatar Mar 18 '24 03:03 knewter

@TwistingTwists if you feel comfortable with that, I would love to see where you are on this (either with a draft PR or a fork of yours?).

Claude was in theory blocked in my country, but not if you go through their console/API mode, so happy to test things out!

(no pressure of course, but happy to try things out & report stuff)

thbar avatar Mar 23 '24 15:03 thbar

I'd push a branch out hopefully before next week starts. :) Got distracted a little this week :)

TwistingTwists avatar Mar 23 '24 16:03 TwistingTwists

No problem really! Thanks!

thbar avatar Mar 23 '24 18:03 thbar

https://github.com/PrefectHQ/marvin/pull/865/files

This PR feels nice for injecting prompts etc stuff

TwistingTwists avatar Mar 24 '24 04:03 TwistingTwists

https://github.com/thmsmlr/instructor_ex/pull/38 is wip.

@thbar : need a little help on json parsing in this PR.

TwistingTwists avatar Mar 25 '24 04:03 TwistingTwists

Would be nice to also be able to pass in the adapter with each call, since you might want to use the instructor across adapters in your code base, instead of being stuck with one. I could try to create a PR for that, if that's ok?

noozo avatar Apr 04 '24 18:04 noozo

Nevermind, just realized that you can pass it inside config (naming was a bit misleading for me).

noozo avatar Apr 04 '24 18:04 noozo

https://twitter.com/AnthropicAI/status/1775979799644934281

Anthropic going to support tool calling soon.

Do you still need to parse XML stuff ?

We can just rely on tool calls. :)

TwistingTwists avatar Apr 05 '24 02:04 TwistingTwists

tool calls - turns out that might not be the best at the moment. see: https://twitter.com/jxnlco/status/1777350940502249532 for some practical experience on this.

TwistingTwists avatar Apr 08 '24 15:04 TwistingTwists

Hey! This is looking great -- anything I can do to help get it over the line? I'd love to use it.

cigrainger avatar Jun 21 '24 15:06 cigrainger

Will push it over this weekend. Will ping ya.

TwistingTwists avatar Jun 23 '24 03:06 TwistingTwists

Solved in the latest release, {:instructor, "~> 0.1.0"}

thmsmlr avatar Feb 09 '25 20:02 thmsmlr