Skip to content

Commit

Permalink
update to latest LlamaLib, add embedding test
Browse files Browse the repository at this point in the history
  • Loading branch information
amakropoulos committed Aug 19, 2024
1 parent 3dc59af commit 7c85dc4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Tests/Runtime/TestLLM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections;
using UnityEngine.TestTools;
using System.IO;
using NUnit.Framework.Internal;

namespace LLMUnityTests
{
Expand Down Expand Up @@ -86,6 +87,8 @@ public virtual async Task RunTests()
llmCharacter.SetPrompt(prompt);
await llmCharacter.Chat("hi");
TestInitParameters((await llmCharacter.Tokenize(prompt)).Count + 2, 3);
List<float> embeddings = await llmCharacter.Embeddings("hi how are you?");
TestEmbeddings(embeddings);
llm.OnDestroy();
}
catch (Exception e)
Expand Down Expand Up @@ -126,7 +129,7 @@ public void TestWarmup()

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

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

public void TestEmbeddings(List<float> embeddings)
{
Assert.That(embeddings.Count == 1024);
}

public virtual void OnDestroy()
{
LLMManager.Remove(filename);
Expand Down

0 comments on commit 7c85dc4

Please sign in to comment.