Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speedup LLMCharacter warmup #257

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
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
13 changes: 11 additions & 2 deletions Runtime/LLMCharacter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,18 @@ public async Task<string> Complete(string prompt, Callback<string> callback = nu
/// <param name="completionCallback">callback function called when the full response has been received</param>
/// <param name="query">user prompt used during the initialisation (not added to history)</param>
/// <returns>the LLM response</returns>
public async Task<string> Warmup(EmptyCallback completionCallback = null, string query = "hi")
public async Task Warmup(EmptyCallback completionCallback = null)
{
return await Chat(query, null, completionCallback, false);
await LoadTemplate();
if (!CheckTemplate()) return;
if (!await InitNKeep()) return;

string prompt = template.ComputePrompt(chat, playerName, AIName);
ChatRequest request = GenerateRequest(prompt);
request.n_predict = 0;
string json = JsonUtility.ToJson(request);
await CompletionRequest(json);
completionCallback?.Invoke();
}

/// <summary>
Expand Down
Loading