Skip to content

Instantly share code, notes, and snippets.

@onlyoneaman
Created February 12, 2024 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onlyoneaman/00f1051b2ae36bb3e819ce6007eac5be to your computer and use it in GitHub Desktop.
Save onlyoneaman/00f1051b2ae36bb3e819ce6007eac5be to your computer and use it in GitHub Desktop.
LLM App Worker Code
import { Ai } from './vendor/@cloudflare/ai.js';
export default {
async fetch(request, env) {
const body = await request.json();
const ai = new Ai(env.AI);
const response = await ai.run("@hf/thebloke/llama-2-13b-chat-awq", body);
return new Response(JSON.stringify(response));
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment