Jump to content

Request for Claude.ai workflow


Recommended Posts

Hi all, new here, but long-time user.

The new GPT workflow is awesome on the latest update. However, there's a new kid in town, and that's Claude.ai 3, which many (myself included) find superior.

 

Is anyone working on a Claude integration? I have no idea how to make workflows that complex, so just throwing it out there, that I would be a happy user if this happened!

 

Happy easter everyone!

Link to comment

@vitor's ChatGPT workflow would "almost" work for Claude. The Claude API looks like:

 

https://docs.anthropic.com/claude/reference/messages-streaming

 

 

curl https://api.anthropic.com/v1/messages \
     --header "content-type: application/json" \
     --header "x-api-key: $ANTHROPIC_API_KEY" \
     --data \
'{
  "model": "claude-3-opus-20240229",
  "messages": [{"role": "user", "content": "Hello"}],
  "max_tokens": 256,
  "stream": true
}'

 

And the responses look like:

 

event: message_start
data: {"type": "message_start", "message": {"id": "msg_1nZdL29xx5MUA1yADyHTEsnR8uuvGzszyY", "type": "message", "role": "assistant", "content": [], "model": "claude-3-opus-20240229", "stop_reason": null, "stop_sequence": null, "usage": {"input_tokens": 25, "output_tokens": 1}}}

event: content_block_start
data: {"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}}

 

It is similar to OpenAI API, but there are enough differences that even with some of the advanced env variables that the current test release has it won't work. You could use something like OpenRouter, which "wraps" Claude's API with the OpenAI one. But the current workflow doesn't work with the stream end markers and so can be buggy.

 

https://openrouter.ai

 

 

Edited by iandol
Link to comment
  • 2 weeks later...

I made Kiki, a workflow that works not only with Open AI but also with OpenRouter models (which includes Claude). I have actually already incorporated access to Anthropic's API but haven't gotten around uploading this latest version (I need to update the documentation since I also incorporated Whisper). The update should be up sometime this coming week. It's not as pretty as Alfred's new Chat GPT workflow (still haven't figured out how to use incorporate the new text view or if I should incorporate it at all) but it's super versatile.

Link to comment

Wow, kiki has a great feature set (and well documented), thanks @gloogloo — I expect local LLM tool LMStudio will also work with Kiki without any changes (it is great to have a free LLM running without need for internet or accounts etc.) Do you use stream=true in your code? You should add this to the gallery if it isn't already there.

Edited by iandol
Link to comment
On 4/6/2024 at 10:40 PM, iandol said:

Wow, kiki has a great feature set (and well documented), thanks @gloogloo — I expect local LLM tool LMStudio will also work with Kiki without any changes (it is great to have a free LLM running without need for internet or accounts etc.) Do you use stream=true in your code? You should add this to the gallery if it isn't already there.

Hey @iandol, thanks for trying Kiki out! I saw the feature request for local LLMs. I haven't really looked into it, but have added it to my to-do list to check this out and see if I can consider it in the future. Adding custom API endpoints may not be too complicated but I'm an absolute beginner at this so even "simple" things do end up eating a lot of time.

 

Oh, and Kiki doesn't stream replies yet. It's one of those things that I'll try to do if I can incorporate it with the new text view. For the most part I've built this on the go, adding the features I personally needed, and just trying to adapt them in a way that is also useful to others. Seems like I still have a long way to go.

 

Even though I know very little coding and about building Alfred workflows, I think this workflow has ended up being a bit too complicated for the average user. I mean, it "can" be if the user wants it to, or they can give it a very basic use, but the length of the documentation alone is probably enough to scare some away. Still, I think Kiki offers some flexibility and features I haven't seen in any other LLM workflows. Would love to be able to submit to the Alfred's gallery, especially for the ease of offering updates, but it seems like submissions are closed.

 

Thanks for checking this out!

Edited by gloogloo
Link to comment

@gloogloo — I think you've done an amazing job, I think the workflow is not too complex for the user at least and you've provided nice documentation (given this is something you did mostly for yourself). The feature set makes this workflow useful in its own right. Supporting OpenRouter for example means many more Alfred users who either dislike OpenAI as a company (that's me), don't have a credit card, or can't afford or want to pay rolling fees, can use the open source models easily. 

 

I can add a pull request for custom API endpoint if you want, as i understand from a quick look the main request is made using a bash script and curl right? I'm fine with bash, though I never learnt javascript so i am more wary to tweak that code... it would maybe help if you made the bash script a file rather than embedded in the workflow, as I think that makes it easier to contribute to via github etc.

 

Perhaps a thread on these forums for your workflow would raise visibility and maybe garner some help for future feature updates. I personally don't mind your use of dialogs for UI personally, but I'm sure some questions to @vitor would help in implementing the super cool new views that Alfred 5 enables.

Link to comment

@iandol I've just released a small update making the main request script a separate file. Feel free to add what you need. Man, I'm actually very close to being code illiterate and most of what you see in there both in bash or Javascript came from GPT 4 itself, so any help is welcome and it's great if you can contribute adding something that helps you or others.

Link to comment
22 hours ago, gloogloo said:

@iandol I've just released a small update making the main request script a separate file. Feel free to add what you need. Man, I'm actually very close to being code illiterate and most of what you see in there both in bash or Javascript came from GPT 4 itself, so any help is welcome and it's great if you can contribute adding something that helps you or others.

 

Well what a good advert for the utility of LLMs then! I made a pull request to your github...

Link to comment
On 3/24/2024 at 12:34 PM, pewu said:

However, there's a new kid in town, and that's Claude.ai 3, which many (myself included) find superior.

 

I got curious when I saw that all models have a 200k context window and that Claude 3 Haiku beats GPT-3-Turbo in some benchmarks at half the price. I hijacked the ChatGPT workflow to use Anthropic's API instead of OpenAI's and it now works just like the original. However, it feels kind of dirty to just throw a hijacked workflow out there.

 

@vitorDo you plan to include Claude in the workflow? Granted, it makes little sense since the workflow is called "ChatGPT / DALL-E", but if you do, I'll be happy to share my modifications to save you some headaches.

Link to comment

I at least got the notion that @vitor wanted to keep that workflow "streamlined". It certainly would be possible to magically switch to claude based on the model name (claude model names begin with `claude`, that is how Kiki from @gloogloo does this), thus could be done without any new UI, but would require more complex code on the backend. You could make a pull request on github, then @vitor could evaluate if he is willing to make this change?

 

offtopic: your µBib looks awesome!

Edited by iandol
Link to comment
8 hours ago, iandol said:

You could make a pull request on github, then @vitor could evaluate if he is willing to make this change?

 

The integration is not so seamless as to not break the existing code, though. However, I forked the repo, pushed all changes and applied some cosmetics.

The code and standalone workflow are now up for grabs and can be integrated or not : https://github.com/zeitlings/alfred-anthropic

 

9 hours ago, iandol said:

offtopic: your µBib looks awesome!

 

Thanks!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...