Skip to main content

Use the Playground

In this tutorial, we will guide you through the process of using PhariaAI's Playground to interact with the models provided. The Playground is a powerful tool that allows you to input prompts in two modalities: only prompt and raw text string. We will also cover the basic settings available in the right sidebar and how to add custom settings for each model.

Accessing Playground

To access the playground, follow these steps:

  1. Open PhariaStudio at https://pharia-studio.{ingressDomain}
  2. Login with the provided credentials
  3. Select an existing project from the homepage or create a new one studio-landing-page.png
  4. Select the Playground menu item from the left sidebarstudio-how-to-use-playground.png

Model Selection

Select the desired model from the dropdown.

studio-model-selection.png

Overing the dropdown will show a copy button that will copy to the clipboard the model name to be used in your code.

Select prompt input mode

Using the toggle on the bottom of the input text box, it is possible to switch between the two modalities of prompt input

studio-select-prompt-input-mode.png

  • Only Prompt Mode: in this mode, you can focus on the pure content of the prompt, without seeing the low level template of the model. This is suitable for single turn interactions.
  • Raw Text String Mode: In this mode, you can change the fundamental way how the prompt is sent to the model (e.g. adding a system prompt).

Each model comes with their predefined templates. The models are selectable from the dropdown on top of the prompt text input.

Run your Prompt

Clicking on the Run button, the content of the prompt box will be sent to the model along with any of the non default settings that are set in the right sidebar.

The right sidebar contains the following basic settings:

  1. Maximum tokens: The maximum number of tokens allowed in the prompt.
  2. Temperature: A hyperparameter that controls the model's learning rate.
  3. Stop sequences: A list of stop words that will prevent the model from processing the prompt.
  4. Presence penalty: A hyperparameter that penalizes the model for presence of words in the prompt.
  5. Frequency penalty: A hyperparameter that penalizes the model for frequent words in the prompt.
  6. Raw completion: A toggle that allows you to see the raw completion of the model.

To add custom settings for a model, follow these steps:

studio-model-settings.png

  1. Click on the "+" button besides the model setting in the right sidebar.
  2. Search & Select the desired custom setting from the dropdown menu.
  3. Set the desired value for the custom setting.

Through the + button besides the model setting, it is possible to add any of the supported settings for that model. To have a complete explanation of the model settings, please refer to the Model settings section.

Output type

By default the playground will show the raw text output. It is possible to render the content as markdown by selecting Markdown from the toggle inside the Completion box.

studio-output-type.png

Exporting the prompt as Code

By clicking the </> Export Code button on the top right, under the user avatar, the Playground will show the code for the prompt to speed up the development.

studio-export-prompt.png

Model Settings

Maximum tokens (int, optional, default None)

The maximum number of tokens to be generated. Completion will terminate after the maximum number of tokens is reached. Increase this value to generate longer texts.

Temperature (float, optional, default 0.0)

A higher sampling temperature encourages the model to produce less probable outputs ("be more creative"). Values are expected in a range from 0.0 to 1.0. Try high values (e.g. 0.9) for a more "creative" response and the default 0.0 for a well defined and repeatable answer.

It is recommended to use either temperature, top_k or top_p and not all at the same time. If a combination of temperature, top_k or top_p is used rescaling of logits with temperature will be performed first. Then top_k is applied. Top_p follows last.

Top K (int, optional, default 0)

Introduces random sampling from generated tokens by randomly selecting the next token from the k most likely options. A value larger than 1 encourages the model to be more creative. Set to 0 if repeatable output is to be produced. It is recommended to use either temperature, top_k or top_p and not all at the same time. If a combination of temperature, top_k or top_p is used rescaling of logits with temperature will be performed first. Then top_k is applied. Top_p follows last.

Top P (float, optional, default 0.0)

Introduces random sampling for generated tokens by randomly selecting the next token from the smallest possible set of tokens whose cumulative probability exceeds the probability top_p. Set to 0.0 if repeatable output is to be produced. It is recommended to use either temperature, top_k or top_p and not all at the same time. If a combination of temperature, top_k or top_p is used rescaling of logits with temperature will be performed first. Then top_k is applied. Top_p follows last.

Presence Penalty (float, optional, default 0.0)

The presence penalty reduces the likelihood of generating tokens that are already present in the generated text (repetition_penalties_include_completion=true) respectively the prompt (repetition_penalties_include_prompt=true). Presence penalty is independent of the number of occurences. Increase the value to produce text that is not repeating the input.

Frequency Penalty (float, optional, default 0.0)

The frequency penalty reduces the likelihood of generating tokens that are already present in the generated text (repetition_penalties_include_completion=true) respectively the prompt (repetition_penalties_include_prompt=true). Frequency penalty is dependent on the number of occurences of a token.

Repetition Penalties Include Prompt (bool, optional, default False)

Flag deciding whether presence penalty or frequency penalty are updated from the prompt

Use Multiplicative Presence Penalty (bool, optional, default True)

Flag deciding whether presence penalty is applied multiplicatively (True) or additively (False). This changes the formula stated for presence and frequency penalty.

Penalty Bias (string, optional)

If set, all tokens in this text will be used in addition to the already penalized tokens for repetition penalties. These consist of the already generated completion tokens if repetition_penalties_include_completion is set to true and the prompt tokens, if repetition_penalties_include_prompt is set to true.

Penalty Exceptions (List(str), optional)

List of strings that may be generated without penalty, regardless of other penalty settings.

This is particularly useful for any completion that uses a structured few-shot prompt.

Penalty Exceptions Include Stop Sequences (bool, optional, default true)

By default, we include any stop_sequences in penalty_exceptions, to not penalize the presence of stop sequences that are present in few-shot prompts to provide structure to your completions.

You can set this to false if you do not want this behavior.

Stop Sequences (List(str), optional, default None)

List of strings which will stop generation if they're generated. Stop sequences may be helpful in structured texts.

Disable Optimization (bool, optional, default False)

We continually research optimal ways to work with our models. By default, we apply these optimizations to both your prompt and completion for you.

Our goal is to improve your results while using our API. But you can always pass disable_optimizations: true and we will leave your prompt and completion untouched.

Minimum Tokens (int, default 0)

Generate at least this number of tokens before an end-of-text token is generated.

Echo (bool, default False)

Echo the prompt in the completion. This may be especially helpful when log_probs is set to return logprobs for the prompt.

Use Multiplicative Frequency Penalty (bool, default False)

Flag deciding whether frequency penalty is applied multiplicatively (True) or additively (False).

Sequence Penalty (float, default 0.0)

Increasing the sequence penalty reduces the likelihood of reproducing token sequences that already appear in the prompt (if repetition_penalties_include_prompt is True) and prior completion (if repetition_penalties_include_completion is True).

Sequence Penalty Min Length (int, default 2)

Minimal number of tokens to be considered as sequence. Must be greater or eqaul 2.

Use Multiplicative Sequence Penalty (bool, default False)

Flag deciding whether sequence penalty is applied multiplicatively (True) or additively (False).

Completion Bias Inclusion (List[str], default [])

Bias the completion to only generate options within this list; all other tokens are disregarded at sampling

Note that strings in the inclusion list must not be prefixes of strings in the exclusion list and vice versa

Completion Bias Inclusion First Token Only (bool, default False)

Only consider the first token for the completion_bias_inclusion

Completion Bias Exclusion (List[str], default [])

Bias the completion to NOT generate options within this list; all other tokens are unaffected in sampling

Note that strings in the inclusion list must not be prefixes of strings in the exclusion list and vice versa

Completion Bias Exclusion First Token Only (bool, default False)

Only consider the first token for the completion_bias_exclusion

Contextual Control Threshold (float, default None)

If set to None, attention control parameters only apply to those tokens that have explicitly been set in the request. If set to a non-None value, we apply the control parameters to similar tokens as well. Controls that have been applied to one token will then be applied to all other tokens that have at least the similarity score defined by this parameter. The similarity score is the cosine similarity of token embeddings.

Control Log Additive (bool, default True)

True: apply control by adding the log(control_factor) to attention scores. False: apply control by (attention_scores - - attention_scores.min(-1)) * control_factor

Repetition Penalties Include Completion (bool, optional, default True)

Flag deciding whether presence penalty or frequency penalty are updated from the completion

Raw Completion (bool, default False)

Setting this parameter to true forces the raw completion of the model to be returned. For some models, we may optimize the completion that was generated by the model and return the optimized completion in the completion field of the CompletionResponse. The raw completion, if returned, will contain the un-optimized completion.