Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
fdc53bf
WIP
amakropoulos Aug 13, 2025
bda6dff
Merge fdc53bf9e7b72d3ed871bf9d9a4fae8a09e50340 into 891497bf8ad6d10f9…
amakropoulos Aug 13, 2025
0f94f6f
update VERSION
amakropoulos Aug 13, 2025
728babc
working setup
amakropoulos Aug 15, 2025
ddc67c6
fix platform paths on postprocess
amakropoulos Aug 15, 2025
ff1afde
initial working LLM with LlamaLib
amakropoulos Aug 15, 2025
00a76ec
add NewtonSoft JSON dependency
amakropoulos Aug 15, 2025
bd1ec6d
add LlamaLib
amakropoulos Aug 15, 2025
bc74831
implementation of LLMAgent methods (untested)
amakropoulos Aug 15, 2025
8118aa5
allow empty templates
amakropoulos Aug 17, 2025
05caeea
small fixes mainly on the ChatAsync
amakropoulos Aug 17, 2025
23282d4
use ChatAsync instead of Chat
amakropoulos Aug 17, 2025
8762162
move completion parameters to LLMCaller
amakropoulos Aug 18, 2025
42ae20f
rename LLMCaller to LLMClient
amakropoulos Aug 18, 2025
5c62cec
simplify grammar by keeping the grammar value instead of the file
amakropoulos Aug 18, 2025
f778fb9
remove unused completion parameters
amakropoulos Aug 18, 2025
567ad3f
getters/setters for variables needing more actions
amakropoulos Aug 18, 2025
958f8b9
remove not needed classes
amakropoulos Aug 18, 2025
2614d20
general improvements and small fixes
amakropoulos Aug 19, 2025
18d1d1b
more changes
amakropoulos Aug 19, 2025
8f7f869
more improvements
amakropoulos Aug 19, 2025
c715ccf
check callback target for destruction
amakropoulos Aug 20, 2025
b9e9464
initial pass of basic unit test
amakropoulos Nov 11, 2025
116e41e
update to latest LlamaLib (remote changes)
amakropoulos Nov 13, 2025
548820b
simplify library finding
amakropoulos Nov 13, 2025
1425189
small fixes
amakropoulos Nov 13, 2025
9d75920
fix llmagent save test
amakropoulos Nov 17, 2025
6be3137
autosave history
amakropoulos Nov 18, 2025
7d27df9
fix blas selection with exclusion list
amakropoulos Nov 18, 2025
68412f6
adapt for chat history removal of system prompt
amakropoulos Nov 18, 2025
ea13827
functionality to return and show the service command
amakropoulos Nov 18, 2025
35804a6
remove chat template tests
amakropoulos Nov 18, 2025
84ecfc1
remove template functionality
amakropoulos Dec 2, 2025
f11d0ba
Option to debug the LLM prompts
amakropoulos Dec 2, 2025
2cf2e41
show grammar with box
amakropoulos Dec 2, 2025
556e63e
comment typo
amakropoulos Dec 2, 2025
9250efd
remove save cache functionality
amakropoulos Dec 2, 2025
7726186
adapt tests to recent changes
amakropoulos Dec 2, 2025
ed276ca
update Samples to v3
amakropoulos Dec 2, 2025
84efdf7
fix setting up of functions dependent on caller object
amakropoulos Dec 2, 2025
f08e89a
Add undream libraries in macOS Xcode
amakropoulos Dec 5, 2025
1c4c701
update tooltips
amakropoulos Dec 5, 2025
ec01c69
fix: Bypasses the issue where errors occur due to antivirus program d…
Nov 21, 2025
750c06a
Add migration guide
amakropoulos Dec 8, 2025
5613738
await rag.Add
amakropoulos Dec 8, 2025
7328049
retain loras in Editor
amakropoulos Dec 9, 2025
73a8556
work around async warning
amakropoulos Dec 9, 2025
9db50a4
use LLMUnity exceptions alongside an error log
amakropoulos Dec 10, 2025
a24c721
update Readme
amakropoulos Dec 10, 2025
12924ff
fix typos
amakropoulos Dec 10, 2025
c6b1647
update LlamaLib
amakropoulos Dec 11, 2025
2930ddd
try-catch in Chat
amakropoulos Dec 11, 2025
95f000d
update LlamaLib
amakropoulos Dec 11, 2025
bcd67aa
remove user and assistant roles
amakropoulos Dec 11, 2025
7857ebd
fix usearch for iOS
amakropoulos Jul 17, 2025
1e4aa40
update tooltips
amakropoulos Dec 12, 2025
b5900c8
update tests
amakropoulos Dec 12, 2025
c536a62
implement changes for IL2CPP
amakropoulos Dec 16, 2025
60dd270
fix build location for Android
amakropoulos Dec 16, 2025
cf2bcb7
adapt Readme
amakropoulos Dec 16, 2025
e58836d
update LlamaLib
amakropoulos Dec 16, 2025
73ad540
update LlamaLib
amakropoulos Dec 16, 2025
09a1728
set debug level before creating LlamaLib
amakropoulos Dec 16, 2025
e2e66c8
build usearch for Android 16kb support
amakropoulos Dec 16, 2025
3ce0451
serialize embedding fields
amakropoulos Dec 17, 2025
a741e63
update LlamaLib API
amakropoulos Dec 23, 2025
0b1d1b9
update tests
amakropoulos Dec 23, 2025
8436724
use internal debug prompt
amakropoulos Dec 23, 2025
3855ab5
update license
amakropoulos Dec 23, 2025
102eb53
show server architecture in the command
amakropoulos Dec 23, 2025
b60de0e
update LlamaLib
amakropoulos Jan 6, 2026
5af2577
move tests to Editor instead of Runtime, adapt tests for windows
amakropoulos Jan 6, 2026
9f409e1
fix and polish samples
amakropoulos Jan 7, 2026
fc3b214
check for null before competion
amakropoulos Jan 8, 2026
06da6c5
auto-indentation
amakropoulos Jan 8, 2026
e865b10
bring back the legacy input / event system
amakropoulos Jan 8, 2026
615279e
adapt unit tests
amakropoulos Jan 8, 2026
11ecc69
implement auto-setup of EventSystem for both legacy and latest Unity …
amakropoulos Jan 8, 2026
fbf0aa9
handle both input systems at the same time
amakropoulos Jan 8, 2026
004ff0f
remove secondar contentSizeFitter
amakropoulos Jan 8, 2026
ada88cf
show error if a LLM is used for embedding
amakropoulos Jan 8, 2026
1937328
update Windows unit tests
amakropoulos Jan 8, 2026
913a98d
remove exit button from mobile demo
amakropoulos Jan 8, 2026
4cf6e69
use __Internal only in iOS Player
amakropoulos Jan 10, 2026
05c8b21
fix iOS/visionOS plugin filenames
amakropoulos Jan 10, 2026
593c9b4
get processor type outside async
amakropoulos Jan 10, 2026
d576373
add search paths to xcode project
amakropoulos Jan 12, 2026
25202be
add cublas toggle in setup settings
amakropoulos Jan 12, 2026
0ebe145
add cublas toggle only in LLM
amakropoulos Jan 12, 2026
827961a
add logo
amakropoulos Jan 12, 2026
09eb29b
select (down)loaded model
amakropoulos Jan 12, 2026
e68192a
add logo meta
amakropoulos Jan 12, 2026
ef2eca2
update images
amakropoulos Jan 12, 2026
7abb5df
remove redundant variables
amakropoulos Jan 12, 2026
fc1d441
fix update tooltips script and update them
amakropoulos Jan 12, 2026
fd76b9c
update readme
amakropoulos Jan 12, 2026
e691523
guard VisionOS for Unity 2021 compatibility
amakropoulos Jan 12, 2026
9bde194
add gemma-embedding to embedding architectures
amakropoulos Jan 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
github: [amakropoulos]
ko_fi: amakropoulos
Binary file removed .github/LLMCharacter_GameObject.png
Binary file not shown.
Binary file removed .github/LLM_GameObject.png
Binary file not shown.
Binary file modified .github/LLM_manager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/LLM_manager_expanded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion .github/doxygen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = "LLM for Unity"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = v2.5.2
PROJECT_NUMBER = v3.0.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
10 changes: 5 additions & 5 deletions .github/update_tooltips.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def find_eligible_classes(file_paths):
ret_classes.append(check_class)
check_classes += child_classes.get(check_class, [])
return ret_classes



def add_tooltips_to_unity_file(file_path, allowed_classes):
Expand All @@ -55,21 +55,21 @@ def add_tooltips_to_unity_file(file_path, allowed_classes):
if '<summary>' in stripped_line:
in_summary = True
summary_text = ''

if in_summary:
if summary_text != "": summary_text += ' '
summary_text += stripped_line.replace("///", "").replace("<summary>", "").replace("</summary>", "").strip()

if '</summary>' in stripped_line:
in_summary = False

if 'Tooltip' in stripped_line:
if ('Tooltip: ignore' not in stripped_line):
continue

include_terms = ['public', ';']
include_terms = ['public', 'private', 'protected']
exclude_terms = ['{', 'static', 'abstract']
if all([x in stripped_line for x in include_terms]) and not any([x in stripped_line for x in exclude_terms]):
if any([x in stripped_line for x in include_terms]) and ';' in stripped_line and not any([x in stripped_line for x in exclude_terms]):
if summary_text != '':
num_spaces = len(line) - len(line.lstrip())
tooltip = ''.join([' '] * num_spaces + [f'[Tooltip("{summary_text}")]', '\n'])
Expand Down
74 changes: 54 additions & 20 deletions Editor/LLMBuildProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;
#if UNITY_IOS || UNITY_VISIONOS
using System.Collections.Generic;
#if UNITY_STANDALONE_OSX || UNITY_IOS || UNITY_VISIONOS
using System.IO;
using UnityEditor.iOS.Xcode;
#endif
Expand All @@ -27,56 +28,89 @@ private void OnBuildError(string condition, string stacktrace, LogType type)
if (type == LogType.Error) BuildCompleted();
}

#if UNITY_IOS || UNITY_VISIONOS
#if UNITY_STANDALONE_OSX || UNITY_IOS || UNITY_VISIONOS
/// <summary>
/// Postprocess the iOS Build
/// </summary>
public static void PostprocessIOSBuild(BuildTarget buildTarget, string outputPath)
{
List<string> libraryFileNames = new List<string>();
#if UNITY_IOS
string projPath = PBXProject.GetPBXProjectPath(outputPath);
#if UNITY_VISIONOS
projPath = projPath.Replace("Unity-iPhone", "Unity-VisionOS");
libraryFileNames.Add("libllamalib_ios.a");
#elif UNITY_VISIONOS
string projPath = PBXProject.GetPBXProjectPath(outputPath).Replace("Unity-iPhone", "Unity-VisionOS");
libraryFileNames.Add("libllamalib_visionos.a");
#else
string projPath = Path.Combine(outputPath, Path.GetFileName(outputPath) + ".xcodeproj", "project.pbxproj");
if (!File.Exists(projPath)) return;
libraryFileNames.Add("libllamalib_osx-universal_acc.dylib");
libraryFileNames.Add("libllamalib_osx-universal_no-acc.dylib");
#endif

PBXProject project = new PBXProject();
project.ReadFromFile(projPath);

string targetGuid = project.GetUnityFrameworkTargetGuid();
string frameworkTargetGuid = project.GetUnityFrameworkTargetGuid();
string unityMainTargetGuid = project.GetUnityMainTargetGuid();
string embedFrameworksGuid = project.GetResourcesBuildPhaseByTarget(frameworkTargetGuid);
string targetGuid = project.GetUnityFrameworkTargetGuid();

// Add Accelerate framework
project.AddFrameworkToProject(unityMainTargetGuid, "Accelerate.framework", false);
project.AddFrameworkToProject(targetGuid, "Accelerate.framework", false);
if (targetGuid != null) project.AddFrameworkToProject(targetGuid, "Accelerate.framework", false);

List<string> libraryFiles = new List<string>();
foreach (string libraryFileName in libraryFileNames)
{
string lib = LLMUnitySetup.SearchDirectory(outputPath, libraryFileName);
if (lib != null) libraryFiles.Add(lib);
}

string libraryFile = LLMUnitySetup.RelativePath(LLMUnitySetup.SearchDirectory(outputPath, $"libundreamai_{buildTarget.ToString().ToLower()}.a"), outputPath);
string fileGuid = project.FindFileGuidByProjectPath(libraryFile);
if (string.IsNullOrEmpty(fileGuid)) Debug.LogError($"Library file {libraryFile} not found in project");
if (libraryFiles.Count == 0)
{
Debug.LogError($"No library files found for the build");
}
else
{
foreach (var phaseGuid in project.GetAllBuildPhasesForTarget(unityMainTargetGuid))
foreach (string libraryFile in libraryFiles)
{
if (project.GetBuildPhaseName(phaseGuid) == "Embed Frameworks")
string relLibraryFile = LLMUnitySetup.RelativePath(libraryFile, outputPath);
string fileGuid = project.FindFileGuidByProjectPath(relLibraryFile);
if (string.IsNullOrEmpty(fileGuid))
{
project.RemoveFileFromBuild(phaseGuid, fileGuid);
break;
Debug.LogError($"Library file {relLibraryFile} not found in project");
}
}
else
{
foreach (var phaseGuid in project.GetAllBuildPhasesForTarget(unityMainTargetGuid))
{
if (project.GetBuildPhaseName(phaseGuid) == "Embed Frameworks")
{
project.RemoveFileFromBuild(phaseGuid, fileGuid);
break;
}
}

project.AddFileToBuild(unityMainTargetGuid, fileGuid);
project.AddFileToBuild(targetGuid, fileGuid);
string relLibraryDir = Path.GetDirectoryName(relLibraryFile);
project.AddFileToBuild(unityMainTargetGuid, fileGuid);
project.AddBuildProperty(unityMainTargetGuid, "LIBRARY_SEARCH_PATHS", "$(PROJECT_DIR)/" + relLibraryDir);
if (targetGuid != null)
{
project.AddFileToBuild(targetGuid, fileGuid);
project.AddBuildProperty(targetGuid, "LIBRARY_SEARCH_PATHS", "$(PROJECT_DIR)/" + relLibraryDir);
}
}
}
}

project.WriteToFile(projPath);
AssetDatabase.ImportAsset(projPath);
}

#endif

// called after the build
public void OnPostprocessBuild(BuildReport report)
{
#if UNITY_IOS || UNITY_VISIONOS
#if UNITY_STANDALONE_OSX || UNITY_IOS || UNITY_VISIONOS
PostprocessIOSBuild(report.summary.platform, report.summary.outputPath);
#endif
EditorApplication.delayCall += () =>
Expand Down
22 changes: 5 additions & 17 deletions Editor/LLMCallerEditor.cs → Editor/LLMClientEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

namespace LLMUnity
{
[CustomEditor(typeof(LLMCaller), true)]
[CustomEditor(typeof(LLMClient), true)]
public class LLMCallerEditor : PropertyEditor {}

[CustomEditor(typeof(LLMCharacter), true)]
public class LLMCharacterEditor : LLMCallerEditor
[CustomEditor(typeof(LLMAgent), true)]
public class LLMAgentEditor : LLMCallerEditor
{
public override void AddModelSettings(SerializedObject llmScriptSO)
{
Expand All @@ -23,26 +23,14 @@ public override void AddModelSettings(SerializedObject llmScriptSO)
ShowPropertiesOfClass("", llmScriptSO, new List<Type> { typeof(ModelAttribute) }, false);

EditorGUILayout.BeginHorizontal();
GUILayout.Label("Grammar", GUILayout.Width(EditorGUIUtility.labelWidth));
if (GUILayout.Button("Load grammar", GUILayout.Width(buttonWidth)))
{
EditorApplication.delayCall += () =>
{
string path = EditorUtility.OpenFilePanelWithFilters("Select a gbnf grammar file", "", new string[] { "Grammar Files", "gbnf" });
string path = EditorUtility.OpenFilePanelWithFilters("Select a grammar file", "", new string[] { "Grammar Files", "json,gbnf" });
if (!string.IsNullOrEmpty(path))
{
((LLMCharacter)target).SetGrammar(path);
}
};
}
if (GUILayout.Button("Load JSON grammar", GUILayout.Width(buttonWidth)))
{
EditorApplication.delayCall += () =>
{
string path = EditorUtility.OpenFilePanelWithFilters("Select a json schema grammar file", "", new string[] { "Grammar Files", "json" });
if (!string.IsNullOrEmpty(path))
{
((LLMCharacter)target).SetJSONGrammar(path);
((LLMAgent)target).LoadGrammar(path);
}
};
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading