Skip to content

Commit

Permalink
briefly introduced the repr modes in the prompt section of the docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
djl11 committed Sep 18, 2024
1 parent cf2ddf4 commit a32f946
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion universal_api/prompts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,32 @@ prompt = unify.Prompt("This is a user message.")
print(prompt)
```
```
Prompt(
messages=[{'content': 'This is a user message.', 'role': 'user'}],
frequency_penalty=None,
logit_bias=None,
logprobs=None,
top_logprobs=None,
max_completion_tokens=None,
n=None,
presence_penalty=None,
response_format=None,
seed=None,
stop=None,
temperature=None,
top_p=None,
tools=None,
tool_choice=None,
parallel_tool_calls=None,
extra_headers=None,
extra_query=None,
extra_body=None
)
```

We can prune all `None` values from the representation by setting
`unify.set_repr_mode("concise")`, to print a more concise representation:
```
Prompt(
"messages": [
{
Expand All @@ -61,7 +87,10 @@ Prompt(
)
```

The messages can also be expressed explicitly:
For all subsequent printed prompts in the docs,
we will assume `concise` mode for brevity.

The messages can also be passed explicitly in the `Prompt` constructor:

```python
import unify
Expand Down

0 comments on commit a32f946

Please sign in to comment.