Cohere: Update embeddings to v2 #2962

9db761cea42dede55747beb4f9edabbc2bbb2c41

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +4 -3Ignore whitespace
src/vectors/cohere-vectors.js+4 -3
@@ -17,7 +17,7 @@ async function getCohereBatchVector(texts, isQuery, directories, model) {
1717 throw new Error('No API key found');
1818 }
1919
2020 const response = await fetch('https://api.cohere.ai/v1v2/embed', {
2121 method: 'POST',
2222 headers: {
2323 'Content-Type': 'application/json',
@@ -26,6 +26,7 @@ async function getCohereBatchVector(texts, isQuery, directories, model) {
2626 body: JSON.stringify({
2727 texts: texts,
2828 model: model,
29+ embedding_types: ['float'],
2930 input_type: isQuery ? 'search_query' : 'search_document',
3031 truncate: 'END',
3132 }),
@@ -38,12 +39,12 @@ async function getCohereBatchVector(texts, isQuery, directories, model) {
3839 }
3940
4041 const data = await response.json();
4142 if (!Array.isArray(data?.embeddings?.float)) {
4243 console.log('API response was not an array');
4344 throw new Error('API response was not an array');
4445 }
4546
4647 return data.embeddings.float;
4748}
4849
4950/**