Interacting with the Assets
Using code to access the assets
// 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));
# Basic example of using the Andromeda Labs Chat API with Python
# you should run the command below first before using requests
# pip install requests
import requests
import json
endpoint = 'https://meda-pd1c26oq.b4a.run/chat/7a0068f3-87bf-4766-a424-66a2124504f0/'
request_data = {
"history": [
{"role": "assistant", "content": "how can i help you today"}
],
"query": "What is Science",
"asset": "79083119-db53-4e5e-b0c4-914c7e42064c"
}
response = requests.post(
endpoint,
headers={'Content-Type': 'application/json'},
data=json.dumps(request_data)
)
print('Response:', response.json())
Once you’ve tested the API , its now okay to go ahead and integrate it into your project as you wish.
Currently only inference API's are catered for , more is going to be added in a while to come
Last updated