# Quick Start

## `Skillful Inference Quick Start Guide`

Get started with each Skillful Inference capability using these basic implementations.

### `Question Answering`

For getting answers based on specific context:

```csharp
using SkillfulAI.API;
using UnityEngine;

public class SimpleQuestionAnswering : MonoBehaviour
{
    void Start()
    {
        string context = "The grass is green";
        string question = "What colour is grass?";

        SkillfulAPI.QuestionAnswering(question, context, response => {
            Debug.Log(response.answer);
        });
    }
}
```

### `Sentence Similarity`

For comparing an input sentence against a set of possibilities:

```csharp
using SkillfulAI.API;
using UnityEngine;

public class SimpleSimilarity : MonoBehaviour
{
    void Start()
    {
        string[] context = new string[] {
            "Ham and cheese burger",
            "Tomato Salad Burger",
            "Steak and Cheese Burger"
        };

        string inputSentence = "I really want a yummy steak burger please!";

        SkillfulAPI.SentenceSimilarity(inputSentence, context,
            (scores, maxScoreIndex, contexts) => {
                string bestMatch = contexts[maxScoreIndex];
                Debug.Log($"Best match: {bestMatch}");
            },
            error => Debug.LogError(error)
        );
    }
}
```

### `Speech Recognition`

For converting spoken words to text:

```csharp
using SkillfulAI.API;
using UnityEngine;

public class SimpleSpeechRecognition : MonoBehaviour
{
    void Update()
    {
        // Hold Space to record, release to process
        if (Input.GetKeyDown(KeyCode.Space))
        {
            AudioRecorder.StartRecording();
        }

        if (Input.GetKeyUp(KeyCode.Space))
        {
            var audioData = AudioRecorder.StopRecordingAndGetBytes();
            ProcessSpeech(audioData);
        }
    }

    void ProcessSpeech(byte[] audioData)
    {
        SkillfulAPI.SpeechRecognition(audioData, text => {
            Debug.Log($"Recognized speech: {text}");
        });
    }
}
```

### `Text Classification`

For analyzing sentiment in text:

```csharp
using SkillfulAI.API;
using UnityEngine;

public class SimpleClassification : MonoBehaviour
{
    void Start()
    {
        string inputText = "You did amazing in the race. However you were in last place.";

        SkillfulAPI.TextClassification(inputText, response => {
            Debug.Log($"Positive Score: {response.PositiveScore}");
            Debug.Log($"Negative Score: {response.NegativeScore}");
        });
    }
}
```

### `Text Generation`

For creating new text based on a prompt:

```csharp
using SkillfulAI.API;
using UnityEngine;

public class SimpleTextGeneration : MonoBehaviour
{
    void Start()
    {
        string prompt = "A murder mystery";

        SkillfulAPI.TextGeneration(prompt, result => {
            Debug.Log($"Generated story: {result}");
        });
    }
}
```

### `Text Summarization`

For condensing longer text into summaries:

```csharp
using SkillfulAI.API;
using UnityEngine;

public class SimpleSummarization : MonoBehaviour
{
    void Start()
    {
        string inputText = "The cab arrived late. The inside was in as bad of shape as the outside which was concerning, and it didn't appear that it had been cleaned in months. The green tree air-freshener hanging from the rearview mirror was either exhausted of its scent or not strong enough to overcome the other odors emitting from the cab.";

        SkillfulAPI.Summarization(inputText, result => {
            Debug.Log($"Summary: {result}");
        });
    }
}
```

### `Text-To-Image`

For generating images from text descriptions:

```csharp
using SkillfulAI.API;
using UnityEngine;
using UnityEngine.UI;

public class SimpleTextToImage : MonoBehaviour
{
    public Image displayImage;

    void Start()
    {
        string inputText = "A blue fish";

        SkillfulAPI.TextToImage(inputText, generatedImage => {
            displayImage.sprite = Utilities.Texture2DToSprite(generatedImage);
        });
    }
}
```

### `Translation`

For translating text between languages:

```csharp
using SkillfulAI.API;
using UnityEngine;

public class SimpleTranslation : MonoBehaviour
{
    void Start()
    {
        string inputText = "Now I can seamlessly translate game content!";

        SkillfulAPI.Translate(inputText, LanguagePairs.LanguagePair.EnglishToFrench, 
            result => {
                Debug.Log($"Translated text: {result}");
            });
    }
}
```

### `Zero-Shot Classification`

For classifying text without pre-training:

```csharp
using SkillfulAI.API;
using UnityEngine;

public class SimpleZeroShot : MonoBehaviour
{
    void Start()
    {
        string[] categories = new string[] {
            "new customer",
            "refund",
            "legal"
        };

        SkillfulAPI.ZeroShotTextClassification(
            "Hi I need to rent a new car for my holiday.", 
            categories, 
            result => {
                foreach (var classification in result.classifications)
                {
                    Debug.Log($"{classification.Label}: {classification.Score}");
                }
            });
    }
}
```

Each of these examples can be expanded based on your specific needs. Remember to:

* Handle errors appropriately in production code
* Consider performance implications for real-time usage
* Cache results when appropriate
* Implement proper cleanup and resource management

For more advanced implementations and best practices, check out the Service Reference documentation.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gaming.skillfulai.io/unity-gaming-sdk/services/skillful-inference/quick-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
