Spaces:
Paused
Paused
Use TEI space in prod (#1051)
Browse files
.env.template
CHANGED
|
@@ -255,7 +255,7 @@ TEXT_EMBEDDING_MODELS = `[
|
|
| 255 |
"chunkCharLength": 512,
|
| 256 |
"endpoints": [
|
| 257 |
{ "type": "tei",
|
| 258 |
-
"url" :"https://
|
| 259 |
}
|
| 260 |
]
|
| 261 |
}
|
|
|
|
| 255 |
"chunkCharLength": 512,
|
| 256 |
"endpoints": [
|
| 257 |
{ "type": "tei",
|
| 258 |
+
"url" : "https://huggingchat-tei.hf.space/"
|
| 259 |
}
|
| 260 |
]
|
| 261 |
}
|
src/lib/server/embeddingEndpoints/tei/embeddingEndpoints.ts
CHANGED
|
@@ -25,8 +25,13 @@ const getModelInfoByUrl = async (url: string, authorization?: string) => {
|
|
| 25 |
},
|
| 26 |
});
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
};
|
| 31 |
|
| 32 |
export async function embeddingEndpointTei(
|
|
|
|
| 25 |
},
|
| 26 |
});
|
| 27 |
|
| 28 |
+
try {
|
| 29 |
+
const json = await response.json();
|
| 30 |
+
return { max_client_batch_size: 32, max_batch_tokens: 16384, ...json };
|
| 31 |
+
} catch {
|
| 32 |
+
console.log("Could not get info from TEI embedding endpoint. Using defaults.");
|
| 33 |
+
return { max_client_batch_size: 32, max_batch_tokens: 16384 };
|
| 34 |
+
}
|
| 35 |
};
|
| 36 |
|
| 37 |
export async function embeddingEndpointTei(
|