aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/ai/vespa
diff options
context:
space:
mode:
Diffstat (limited to 'vespajlib/src/test/java/ai/vespa')
-rw-r--r--vespajlib/src/test/java/ai/vespa/http/DomainNameTest.java2
-rw-r--r--vespajlib/src/test/java/ai/vespa/http/HttpURLTest.java2
-rw-r--r--vespajlib/src/test/java/ai/vespa/llm/client/openai/OpenAiClientCompletionTest.java22
-rw-r--r--vespajlib/src/test/java/ai/vespa/llm/completion/CompletionTest.java1
-rw-r--r--vespajlib/src/test/java/ai/vespa/net/CidrBlockTest.java4
-rw-r--r--vespajlib/src/test/java/ai/vespa/validation/NameTest.java2
-rw-r--r--vespajlib/src/test/java/ai/vespa/validation/PathValidatorTest.java1
-rw-r--r--vespajlib/src/test/java/ai/vespa/validation/ValidationTest.java2
8 files changed, 28 insertions, 8 deletions
diff --git a/vespajlib/src/test/java/ai/vespa/http/DomainNameTest.java b/vespajlib/src/test/java/ai/vespa/http/DomainNameTest.java
index 761ef16c578..ed7650d2929 100644
--- a/vespajlib/src/test/java/ai/vespa/http/DomainNameTest.java
+++ b/vespajlib/src/test/java/ai/vespa/http/DomainNameTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.http;
import org.junit.jupiter.api.Test;
diff --git a/vespajlib/src/test/java/ai/vespa/http/HttpURLTest.java b/vespajlib/src/test/java/ai/vespa/http/HttpURLTest.java
index ee0b98c00ed..0b9527cc421 100644
--- a/vespajlib/src/test/java/ai/vespa/http/HttpURLTest.java
+++ b/vespajlib/src/test/java/ai/vespa/http/HttpURLTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.http;
import ai.vespa.http.HttpURL.Path;
diff --git a/vespajlib/src/test/java/ai/vespa/llm/client/openai/OpenAiClientCompletionTest.java b/vespajlib/src/test/java/ai/vespa/llm/client/openai/OpenAiClientCompletionTest.java
index 961a02afea3..45ef7e270aa 100644
--- a/vespajlib/src/test/java/ai/vespa/llm/client/openai/OpenAiClientCompletionTest.java
+++ b/vespajlib/src/test/java/ai/vespa/llm/client/openai/OpenAiClientCompletionTest.java
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.llm.client.openai;
import ai.vespa.llm.completion.Completion;
@@ -10,12 +11,14 @@ import org.junit.jupiter.api.Test;
*/
public class OpenAiClientCompletionTest {
+ private static final String apiKey = "your-api-key-here";
+
@Test
@Disabled
public void testClient() {
- var client = new OpenAiClient.Builder("your token here").build();
+ var client = new OpenAiClient.Builder(apiKey).maxTokens(10).build();
String input = "You are an unhelpful assistant who never answers questions straightforwardly. " +
- "Be as long-winded as possible. Are humans smarter than cats?";
+ "Be as long-winded as possible. Are humans smarter than cats?\n\n";
StringPrompt prompt = StringPrompt.from(input);
System.out.print(prompt);
for (int i = 0; i < 10; i++) {
@@ -26,4 +29,19 @@ public class OpenAiClientCompletionTest {
}
}
+ @Test
+ @Disabled
+ public void testAsyncClient() {
+ var client = new OpenAiClient.Builder(apiKey).build();
+ String input = "You are an unhelpful assistant who never answers questions straightforwardly. " +
+ "Be as long-winded as possible. Are humans smarter than cats?\n\n";
+ StringPrompt prompt = StringPrompt.from(input);
+ System.out.print(prompt);
+ var future = client.completeAsync(prompt, completion -> {
+ System.out.print(completion.text());
+ });
+ System.out.println("Waiting for completion...");
+ System.out.println("\nFinished streaming because of " + future.join());
+ }
+
}
diff --git a/vespajlib/src/test/java/ai/vespa/llm/completion/CompletionTest.java b/vespajlib/src/test/java/ai/vespa/llm/completion/CompletionTest.java
index 26508228ab6..7407eb526e7 100644
--- a/vespajlib/src/test/java/ai/vespa/llm/completion/CompletionTest.java
+++ b/vespajlib/src/test/java/ai/vespa/llm/completion/CompletionTest.java
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.llm.completion;
import ai.vespa.llm.test.MockLanguageModel;
diff --git a/vespajlib/src/test/java/ai/vespa/net/CidrBlockTest.java b/vespajlib/src/test/java/ai/vespa/net/CidrBlockTest.java
index ff0f74c65fb..f8cf5463cd1 100644
--- a/vespajlib/src/test/java/ai/vespa/net/CidrBlockTest.java
+++ b/vespajlib/src/test/java/ai/vespa/net/CidrBlockTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.net;
import com.google.common.net.InetAddresses;
@@ -160,4 +160,4 @@ public class CidrBlockTest {
private InetAddress toInetAddress(String address) {
return InetAddresses.forString(address);
}
-} \ No newline at end of file
+}
diff --git a/vespajlib/src/test/java/ai/vespa/validation/NameTest.java b/vespajlib/src/test/java/ai/vespa/validation/NameTest.java
index 26a640b0ec0..688267fd597 100644
--- a/vespajlib/src/test/java/ai/vespa/validation/NameTest.java
+++ b/vespajlib/src/test/java/ai/vespa/validation/NameTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.validation;
import org.junit.jupiter.api.Test;
diff --git a/vespajlib/src/test/java/ai/vespa/validation/PathValidatorTest.java b/vespajlib/src/test/java/ai/vespa/validation/PathValidatorTest.java
index a2c1bd6bd0c..0618c4723f8 100644
--- a/vespajlib/src/test/java/ai/vespa/validation/PathValidatorTest.java
+++ b/vespajlib/src/test/java/ai/vespa/validation/PathValidatorTest.java
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.validation;
import org.junit.Test;
diff --git a/vespajlib/src/test/java/ai/vespa/validation/ValidationTest.java b/vespajlib/src/test/java/ai/vespa/validation/ValidationTest.java
index 0d3fe81ead6..85bd6ed393a 100644
--- a/vespajlib/src/test/java/ai/vespa/validation/ValidationTest.java
+++ b/vespajlib/src/test/java/ai/vespa/validation/ValidationTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.validation;
import org.junit.jupiter.api.Test;