@truto/truto-jsonata 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1819,6 +1819,43 @@ URL {
|
|
|
1819
1819
|
|
|
1820
1820
|
---
|
|
1821
1821
|
|
|
1822
|
+
### AI Stuff
|
|
1823
|
+
|
|
1824
|
+
<details>
|
|
1825
|
+
<summary>generateEmbeddingsCohere(body, api_key)</summary>
|
|
1826
|
+
|
|
1827
|
+
Generate embeddings through Cohere /embed API.
|
|
1828
|
+
|
|
1829
|
+
**Parameters:**
|
|
1830
|
+
|
|
1831
|
+
- **body**: The object similar to what [Cohere's /embed API](https://docs.cohere.com/reference/embed) expects.
|
|
1832
|
+
- **api_key**: Cohere's API Key
|
|
1833
|
+
|
|
1834
|
+
**Example Usage:**
|
|
1835
|
+
|
|
1836
|
+
```javascript
|
|
1837
|
+
import trutoJsonata from '@truto/truto-jsonata';
|
|
1838
|
+
|
|
1839
|
+
const body = {
|
|
1840
|
+
"model": "embed-multilingual-v3.0",
|
|
1841
|
+
"texts": [
|
|
1842
|
+
"hello",
|
|
1843
|
+
"goodbye"
|
|
1844
|
+
],
|
|
1845
|
+
"input_type": "classification",
|
|
1846
|
+
"embedding_types": [
|
|
1847
|
+
"float"
|
|
1848
|
+
]
|
|
1849
|
+
};
|
|
1850
|
+
const api_key = "c7fdd028-d967-456a-9765-be47a7959f7e";
|
|
1851
|
+
const expression = trutoJsonata("$generateEmbeddingsCohere(body, api_key)");
|
|
1852
|
+
expression.evaluate({ body, api_key }).then(result => { console.log(result); });
|
|
1853
|
+
// Output: {"id": "c7fdd028-d967-456a-9765-be47a7959f7e", .....}
|
|
1854
|
+
```
|
|
1855
|
+
|
|
1856
|
+
</details>
|
|
1857
|
+
|
|
1858
|
+
|
|
1822
1859
|
### Miscellaneous
|
|
1823
1860
|
|
|
1824
1861
|
<details>
|