Skip to content

Commit 7c85dc4

Browse files
committed
update to latest LlamaLib, add embedding test
1 parent 3dc59af commit 7c85dc4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Tests/Runtime/TestLLM.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Collections;
88
using UnityEngine.TestTools;
99
using System.IO;
10+
using NUnit.Framework.Internal;
1011

1112
namespace LLMUnityTests
1213
{
@@ -86,6 +87,8 @@ public virtual async Task RunTests()
8687
llmCharacter.SetPrompt(prompt);
8788
await llmCharacter.Chat("hi");
8889
TestInitParameters((await llmCharacter.Tokenize(prompt)).Count + 2, 3);
90+
List<float> embeddings = await llmCharacter.Embeddings("hi how are you?");
91+
TestEmbeddings(embeddings);
8992
llm.OnDestroy();
9093
}
9194
catch (Exception e)
@@ -126,7 +129,7 @@ public void TestWarmup()
126129

127130
public void TestChat(string reply)
128131
{
129-
string AIReply = "To increase your meme production/output, you can consider the following:\n1. Use";
132+
string AIReply = "One way to increase your meme production/output is by creating a more complex and customized";
130133
Assert.That(reply.Trim() == AIReply);
131134
}
132135

@@ -141,6 +144,11 @@ public void TestPostChat(int num)
141144
Assert.That(llmCharacter.chat.Count == num);
142145
}
143146

147+
public void TestEmbeddings(List<float> embeddings)
148+
{
149+
Assert.That(embeddings.Count == 1024);
150+
}
151+
144152
public virtual void OnDestroy()
145153
{
146154
LLMManager.Remove(filename);

0 commit comments

Comments
 (0)