Page cover

Accessing Created API Endpoints

Using code to access the API endpoints


// Basic example of using the Andromeda Labs Chat API
const endpoint = 'https://meda-pd1c26oq.b4a.run/chat/7a0068f3-87bf-4766-a424-66a2124504f0/';

// For Inference Endpoints
const requestData = {
  "history": [
    {"role": "assistant", "content": "how can i help you today"}
  ],
  "query": "What is Science",
  // This must be the id of the asset
  "asset": "79083119-db53-4e5e-b0c4-914c7e42064c"
};

// sending a request
fetch(endpoint, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(requestData)
})
.then(response => response.json())
.then(data => console.log('Response:', data));

Once you’ve tested the API , its now okay to go ahead and integrate it into your project as you wish

Last updated