Cloudflare Developers

CD

Cloudflare Developers

Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news

Join

Howdy y'all, I'm trying your API for the

Howdy y'all, I'm trying your API for the Worker AI stuff by following the example but keep getting errors: ```bash curl -X POST \ https://api.cloudflare.com/client/v4/accounts/MYACCTID/ai/run/@cf/meta/llama-2-7b-chat-int8 \ -H "Authorization: Bearer MYTOKEN" \ -d '{"messages":[{"role":"system","content":"You are a friendly assistant that helps write stories"},{"role":"user","content":"Write a short story about a llama that goes on a journey to find an orange cloud "}]}'...

```

``` curl --location 'https://api.cloudflare.com/client/v4/accounts/{my-account}/ai/run/@cf/mistral/mistral-7b-instruct-v0.1' \ --header 'Authorization: Bearer {mytoken}' \ --header 'Content-Type: application/json' \ --data '{ ...

I increased the detail:

I increased the detail:
"Convert the users next message content into a duration in seconds. Provide the user only 1 number, with no other words, units or formatting. For example, if the user says '5 minutes', you should return '300'. If the user says 'the time it takes for the average person to run 100m', you should return '20'."
But even ChatGPT 3.5 turbo isn't very good at this. Running it a few times: 31536000s 30000000s...

From my understanding you should be able

From my understanding you should be able to stream the response body returned by ai.run?

Hi I m trying out the LLM worker and I m

Hi! I'm trying out the LLM worker and I'm wondering if it's possible to return the response as a stream? similar to https://developers.cloudflare.com/workers/examples/openai-sdk-streaming/ ?

So when running BGE models for

So when running BGE models for embeddings you must prepend your docs with Represent this sentence for searching relevant passages:. From what I can see this is uncessesary in the WorkersAI API right? So the API does that for me automatically? In both batch and single inputs?

Full code straight from the tutorial

Full code, straight from the tutorial: ``` import { Ai } from '@cloudflare/ai' export default {...