flexigpt / vscode-extension

FlexiGPT plugin for VSCode. Interact with AI models as a power user
https://flexigpt.site
MIT License
29 stars 5 forks source link

Support Anthropic messages API #8

Closed Swicegood closed 3 months ago

Swicegood commented 4 months ago

Want to run claude-3-opus, but I can't find any VSCode Plugin that currently supports it

ppipada commented 4 months ago

Hi,

Have some bandwidth issue since quite some time, but given that this would be a easy improvement, I will try and look into it in a few days. Thanks for your patience.

ppipada commented 3 months ago

@Swicegood I have pushed a update to FlexiGPT today. 1.14.0

Hope this solves your requirement.

Swicegood commented 3 months ago

Thank you for your effort, however I'm still getting: `[ERROR] AxiosError: { "type": "error", "error": { "type": "not_found_error", "message": "Not Found" } } 404 { "date": "Wed, 20 Mar 2024 20:15:43 GMT", "content-type": "application/json", "transfer-encoding": "chunked", "connection": "close", "x-should-retry": "false", "request-id": "req_01UKsAjdMWoworvxAHfSyBMq", "x-cloud-trace-context": "aafb1ebd010e813743d008068795f4ef", "via": "1.1 google", "cf-cache-status": "DYNAMIC", "server": "cloudflare", "cf-ray": "8678603add5505df-IAD" }

Request failed with status code 404

`

ppipada commented 3 months ago

Can you please paste your settings: default provider, anthropicDefaultChatCompletionModel and anthropicDefaultCompletion model.

Also if possible, please also paste the FullRequest (please delete any visible secrets), this should be available in a dropdown below where you see the request. Same with response.

I myself have tested with Haiku model, but will try to reproduce with Opus based on your info.

Swicegood commented 3 months ago

Default provider: anthropic Default Chat Completion Model: claude-3-opus-20240229 Default Completion Model: claude-3-opus-20240229 https://api.anthropic.com { "model": "claude-3-opus-20240229", "prompt": null, "messages": [ { "role": "user", "content": "hello" } ], "temperature": 0.1, "maxTokens": 2048, "limitContextLength": 2048, "stream": false }

Screenshot 2024-03-20 at 10 57 12 PM
ppipada commented 3 months ago

I tried opus too from my end:

Settings: image

Conversation request: image

Conversation response: image

Reasons for your 404 (i.e page not found) for your api request I can guess for rechecking:

One more thing to check: Do you see any errors or suspicious in output window > FlexiGPT in VSCode

Swicegood commented 3 months ago

Strange. It works with curl and I'm in the US so country should'nt be an issue: `curl https://api.anthropic.com/v1/messages \ --header "x-api-key: $ANTHROPIC_API_KEY" \ --header "anthropic-version: 2023-06-01" \ --header "content-type: application/json" \ --data \ '{ "model": "claude-3-opus-20240229", "max_tokens": 1024, "messages": [ {"role": "user", "content": "Hello, Claude"} ] }'

RESPONSE

{"id":"msg_01NnxrmGTfuyVUW8qe9ycU3C","type":"message","role":"assistant","content":[{"type":"text","text":"Hello! It's nice to meet you. How can I assist you today?"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":10,"output_tokens":19}}% `

UPDATE: This from output appears to be the problem:

"url": "https://api.anthropic.com/v1/messages/v1/messages", "method": "post",

Swicegood commented 3 months ago

Ok I changed that (didn't realize it was set one way in user and one way in workspace) and now it's working. Thank you for your great work on this project!