https://discord.gg/botpress logo
Create bot that uses Claude API
# 🤝help
p
I have spent a full work day trying to do this, and I'm flabbergasted by it, and that there's ZERO documentation for what I assumed to be a pretty common task. I have used Claude and Botpress AI to help me develop the code, and nothing connects to Claude API. This is what Botpress Ai said to put in an execute code card: const CLAUDE_API_KEY = env.CLAUDE_API_KEY // Get the API key from the environment // Connect to Claude API const response = await axios.post( 'https://api.claude.ai/v1/chat/completions', { messages: messages }, { headers: { Authorization:
Bearer ${CLAUDE_API_KEY}
// Use the API key for authorization } } )
p
Can you explain why you want to make an api call to claude instead of using it as an llm model in ai Tasks/Autonomous Nodes? You might want to ensure the api endpoint you are trying to use is valid: https://docs.anthropic.com/en/api/overview
p
Sure, I want to use a cached prompt. Rather than working out a RAG situation, I want to include a document in the prompt that the chatbot uses to ask questions to. It's a single 7 page document.
I have spent more than 2 work days trying to get BotPress working with the Claude API. Does BotPress not support this? Does your team not know how to do it?
p
Via an execute code card you should be able to call any api that does not require extra imports. Please specify where it is going wrong for you. Can you share any error messages or logs you receive?
p
Never mind. I deleted my Botpress account. The fact that Claude, ChatGPT, and Botpress support can't solve this problem tells me Botpress isn't the place for calling and using a LLM API.
2 Views