@@ -35,7 +35,7 @@ public static void main(String[] args) throws IOException, InterruptedException,
3535 setupStmt .executeUpdate ("DROP TABLE IF EXISTS documents" );
3636
3737 Statement createStmt = conn .createStatement ();
38- createStmt .executeUpdate ("CREATE TABLE documents (id bigserial PRIMARY KEY, content text, embedding bit(1024 ))" );
38+ createStmt .executeUpdate ("CREATE TABLE documents (id bigserial PRIMARY KEY, content text, embedding bit(1536 ))" );
3939
4040 String [] input = {
4141 "The dog is barking" ,
@@ -70,14 +70,14 @@ private static List<byte[]> embed(String[] texts, String inputType, String apiKe
7070 for (String v : texts ) {
7171 root .withArray ("texts" ).add (v );
7272 }
73- root .put ("model" , "embed-english-v3 .0" );
73+ root .put ("model" , "embed-v4 .0" );
7474 root .put ("input_type" , inputType );
7575 root .withArray ("embedding_types" ).add ("binary" );
7676 String json = mapper .writeValueAsString (root );
7777
7878 HttpClient client = HttpClient .newHttpClient ();
7979 HttpRequest request = HttpRequest .newBuilder ()
80- .uri (URI .create ("https://api.cohere.com/v1 /embed" ))
80+ .uri (URI .create ("https://api.cohere.com/v2 /embed" ))
8181 .header ("Authorization" , "Bearer " + apiKey )
8282 .header ("Content-Type" , "application/json" )
8383 .POST (BodyPublishers .ofString (json ))
0 commit comments