📖 To learn more, take a look at our complete API
📤 Example Request
Generate an api key below👇
Install node-fetch & add the GOOEY_API_KEY to your environment variables.
Never store the api key in your code and don't use direcly in the browser.
$ npm install node-fetch
$ export GOOEY_API_KEY=sk-xxxx
- Use this sample code to call the API.
If you encounter any issues, write to us at [email protected] and make sure to include the full code snippet and the error message.
import fetch from 'node-fetch';
const payload = {
"texts": [
"query: how much protein should a female eat",
"passage: 1.\u6e05\u7092\u5357\u74dc\u4e1d \u539f\u6599:\u5ae9\u5357\u74dc\u534a\u4e2a \u8c03\u6599:\u8471\u3001\u76d0\u3001\u767d\u7cd6\u3001\u9e21\u7cbe \u505a\u6cd5: 1\u3001\u5357\u74dc\u7528\u5200\u8584\u8584\u7684\u524a\u53bb\u8868\u9762\u4e00\u5c42\u76ae,\u7528\u52fa\u5b50\u522e\u53bb\u74e4 2\u3001\u64e6\u6210\u7ec6\u4e1d(\u6ca1\u6709\u64e6\u83dc\u677f\u5c31\u7528\u5200\u6162\u6162\u5207\u6210\u7ec6\u4e1d) 3\u3001\u9505\u70e7\u70ed\u653e\u6cb9,\u5165\u8471\u82b1\u7178\u51fa\u9999\u5473 4\u3001\u5165\u5357\u74dc\u4e1d\u5feb\u901f\u7ffb\u7092\u4e00\u5206\u949f\u5de6\u53f3,\u653e\u76d0\u3001\u4e00\u70b9\u767d\u7cd6\u548c\u9e21\u7cbe\u8c03\u5473\u51fa\u9505 2.\u9999\u8471\u7092\u5357\u74dc \u539f\u6599:\u5357\u74dc1\u53ea \u8c03\u6599:\u9999\u8471\u3001\u849c\u672b\u3001\u6a44\u6984\u6cb9\u3001\u76d0 \u505a\u6cd5: 1\u3001\u5c06\u5357\u74dc\u53bb\u76ae,\u5207\u6210\u7247 2\u3001\u6cb9\u95058\u6210\u70ed\u540e,\u5c06\u849c\u672b\u653e\u5165\u7206\u9999 3\u3001\u7206\u9999\u540e,\u5c06\u5357\u74dc\u7247\u653e\u5165,\u7ffb\u7092 4\u3001\u5728\u7ffb\u7092\u7684\u540c\u65f6,\u53ef\u4ee5\u4e0d\u65f6\u5730\u5f80\u9505\u91cc\u52a0\u6c34,\u4f46\u4e0d\u8981\u592a\u591a 5\u3001\u653e\u5165\u76d0,\u7092\u5300 6\u3001\u5357\u74dc\u5dee\u4e0d\u591a\u8f6f\u548c\u7ef5\u4e86\u4e4b\u540e,\u5c31\u53ef\u4ee5\u5173\u706b 7\u3001\u6492\u5165\u9999\u8471,\u5373\u53ef\u51fa\u9505"
]
};
async function gooeyAPI() {
const response = await fetch("https://test.api.gooey.ai/v2/embeddings", {
method: "POST",
headers: {
"Authorization": "bearer " + process.env["GOOEY_API_KEY"],
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
if (!response.ok) {
throw new Error(response.status);
}
const result = await response.json();
console.log(response.status, result);
}
gooeyAPI();
Generate an api key below👇
Install requests & add the GOOEY_API_KEY to your environment variables.
Never store the api key in your code.
$ python3 -m pip install requests
$ export GOOEY_API_KEY=sk-xxxx
- Use this sample code to call the API.
If you encounter any issues, write to us at [email protected] and make sure to include the full code snippet and the error message.
import os
import requests
payload = {
"texts": [
"query: how much protein should a female eat",
"passage: 1.清炒南瓜丝 原料:嫩南瓜半个 调料:葱、盐、白糖、鸡精 做法: 1、南瓜用刀薄薄的削去表面一层皮,用勺子刮去瓤 2、擦成细丝(没有擦菜板就用刀慢慢切成细丝) 3、锅烧热放油,入葱花煸出香味 4、入南瓜丝快速翻炒一分钟左右,放盐、一点白糖和鸡精调味出锅 2.香葱炒南瓜 原料:南瓜1只 调料:香葱、蒜末、橄榄油、盐 做法: 1、将南瓜去皮,切成片 2、油锅8成热后,将蒜末放入爆香 3、爆香后,将南瓜片放入,翻炒 4、在翻炒的同时,可以不时地往锅里加水,但不要太多 5、放入盐,炒匀 6、南瓜差不多软和绵了之后,就可以关火 7、撒入香葱,即可出锅",
]
}
response = requests.post(
"https://test.api.gooey.ai/v2/embeddings",
headers={
"Authorization": "bearer " + os.environ["GOOEY_API_KEY"],
},
json=payload,
)
assert response.ok, response.content
result = response.json()
print(response.status_code, result)
Generate an api key below👇
Install curl & add the GOOEY_API_KEY to your environment variables.
Never store the api key in your code.
export GOOEY_API_KEY=sk-xxxx
- Run the following
curl command in your terminal.
If you encounter any issues, write to us at [email protected] and make sure to include the full curl command and the error message.
curl https://test.api.gooey.ai/v2/embeddings \
-H "Authorization: bearer $GOOEY_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"texts": [
"query: how much protein should a female eat",
"passage: 1.\u6e05\u7092\u5357\u74dc\u4e1d \u539f\u6599:\u5ae9\u5357\u74dc\u534a\u4e2a \u8c03\u6599:\u8471\u3001\u76d0\u3001\u767d\u7cd6\u3001\u9e21\u7cbe \u505a\u6cd5: 1\u3001\u5357\u74dc\u7528\u5200\u8584\u8584\u7684\u524a\u53bb\u8868\u9762\u4e00\u5c42\u76ae,\u7528\u52fa\u5b50\u522e\u53bb\u74e4 2\u3001\u64e6\u6210\u7ec6\u4e1d(\u6ca1\u6709\u64e6\u83dc\u677f\u5c31\u7528\u5200\u6162\u6162\u5207\u6210\u7ec6\u4e1d) 3\u3001\u9505\u70e7\u70ed\u653e\u6cb9,\u5165\u8471\u82b1\u7178\u51fa\u9999\u5473 4\u3001\u5165\u5357\u74dc\u4e1d\u5feb\u901f\u7ffb\u7092\u4e00\u5206\u949f\u5de6\u53f3,\u653e\u76d0\u3001\u4e00\u70b9\u767d\u7cd6\u548c\u9e21\u7cbe\u8c03\u5473\u51fa\u9505 2.\u9999\u8471\u7092\u5357\u74dc \u539f\u6599:\u5357\u74dc1\u53ea \u8c03\u6599:\u9999\u8471\u3001\u849c\u672b\u3001\u6a44\u6984\u6cb9\u3001\u76d0 \u505a\u6cd5: 1\u3001\u5c06\u5357\u74dc\u53bb\u76ae,\u5207\u6210\u7247 2\u3001\u6cb9\u95058\u6210\u70ed\u540e,\u5c06\u849c\u672b\u653e\u5165\u7206\u9999 3\u3001\u7206\u9999\u540e,\u5c06\u5357\u74dc\u7247\u653e\u5165,\u7ffb\u7092 4\u3001\u5728\u7ffb\u7092\u7684\u540c\u65f6,\u53ef\u4ee5\u4e0d\u65f6\u5730\u5f80\u9505\u91cc\u52a0\u6c34,\u4f46\u4e0d\u8981\u592a\u591a 5\u3001\u653e\u5165\u76d0,\u7092\u5300 6\u3001\u5357\u74dc\u5dee\u4e0d\u591a\u8f6f\u548c\u7ef5\u4e86\u4e4b\u540e,\u5c31\u53ef\u4ee5\u5173\u706b 7\u3001\u6492\u5165\u9999\u8471,\u5373\u53ef\u51fa\u9505"
]
}'
🎁 Example Response
{4 Items"url":
string
"https://test.gooey.ai/text-embedings/"
"created_at":
string
"2023-06-30T11:33:38.988441+00:00"
} Please Login to generate the $GOOEY_API_KEY