Skip to content

Commit

Permalink
add info on setting up LLM/LLMClient dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
amakropoulos committed Jan 15, 2024
1 parent 5d19c07 commit 9919343
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Create a GameObject for the LLM :chess_pawn::

In your script you can then use it as follows :unicorn::
``` c#
using LLMUnity;

public class MyScript {
public LLM llm;

Expand Down Expand Up @@ -125,6 +127,36 @@ You can also:
}
```

</details>
<details>
<summary>Add a LLM / LLMClient component dynamically</summary>

``` c#
using UnityEngine;
using LLMUnity;

public class MyScript : MonoBehaviour
{
LLM llm;
LLMClient llmclient;

async void Start()
{
// Add and setup a LLM object
gameObject.SetActive(false);
llm = gameObject.AddComponent<LLM>();
await llm.SetModel("mistral-7b-instruct-v0.1.Q4_K_M.gguf");
llm.prompt = "A chat between a curious human and an artificial intelligence assistant.";
gameObject.SetActive(true);
// or a LLMClient object
gameObject.SetActive(false);
llmclient = gameObject.AddComponent<LLMClient>();
llmclient.prompt = "A chat between a curious human and an artificial intelligence assistant.";
gameObject.SetActive(true);
}
}
```

</details>


Expand Down

0 comments on commit 9919343

Please sign in to comment.