Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
unify-dev-bot committed Jan 22, 2025
1 parent 15c6b59 commit 4ec8974
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 136 deletions.
6 changes: 3 additions & 3 deletions api-reference/llm_queries/chat_completions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ curl --request POST \
"response_format": "{ \"type\": \"json_mode\"}",
"seed": 11,
"stream_options": [
"include_usage",
true
true,
"include_usage"
],
"top_p": 0.5,
"tool_choice": "{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}",
Expand All @@ -218,7 +218,7 @@ url = "https://api.unify.ai/v0/chat/completions"

headers = {"Authorization": "Bearer <token>"}

json_input = {"messages": [{"content": "Tell me a joke", "role": "user"}], "model": "gpt-4o-mini@openai", "max_tokens": 1024, "stop": ["The End.", " is the answer."], "stream": False, "temperature": 0.9, "frequency_penalty": 1.5, "logit_bias": {"0": 10, "1": -75, "2": 90}, "logprobs": False, "top_logprobs": 15, "n": 15, "presence_penalty": -1.1, "response_format": "{ "type": "json_mode"}", "seed": 11, "stream_options": ["include_usage", True], "top_p": 0.5, "tool_choice": "{"type": "function", "function": {"name": "my_function"}}", "parallel_tool_calls": True, "user": "some_user", "signature": "python", "use_custom_keys": True, "tags": ["user123", "CompanyABC"], "drop_params": True}
json_input = {"messages": [{"content": "Tell me a joke", "role": "user"}], "model": "gpt-4o-mini@openai", "max_tokens": 1024, "stop": ["The End.", " is the answer."], "stream": False, "temperature": 0.9, "frequency_penalty": 1.5, "logit_bias": {"0": 10, "1": -75, "2": 90}, "logprobs": False, "top_logprobs": 15, "n": 15, "presence_penalty": -1.1, "response_format": "{ "type": "json_mode"}", "seed": 11, "stream_options": [True, "include_usage"], "top_p": 0.5, "tool_choice": "{"type": "function", "function": {"name": "my_function"}}", "parallel_tool_calls": True, "user": "some_user", "signature": "python", "use_custom_keys": True, "tags": ["user123", "CompanyABC"], "drop_params": True}

response = requests.request("POST", url, json=json_input, headers=headers)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: 'Create Log'
api: 'POST /v0/log'
title: 'Create Logs'
api: 'POST /v0/logs'
---
Creates a log associated to a project. Logs are
Creates one or more logs associated to a project. Logs are
LLM-call-level data that might depend on other variables.

A "explicit_types" dictionary can be passed as part of the `entries`.
If present, any matching key inside this dictionary will override the
inferred type of that particular entry.

This method returns the id of the new stored log.
This method returns the ids of the new stored logs.

#### Authorizations

Expand All @@ -23,12 +23,12 @@ This method returns the id of the new stored log.
Name of the project the stored entries will be associated to.
</ParamField>

<ParamField body="params" type="object" default={{}}>
Dictionary containing one or more key:value pairs that will be logged into the platform. Parameters will be automatically versioned based on their values. Values must be JSON serializable. If a `explicit_types` dictionary is present, its values will override the inferred types of the entries.
<ParamField body="params" type="object | array" default={{}}>
Dictionary containing one or more key:value pairs that will be logged into the platform. Can be either a single dictionary or a list of dictionaries for batch processing. When using lists for both params and entries, their lengths must match. Parameters will be automatically versioned based on their values. Values must be JSON serializable. If a `explicit_types` dictionary is present, its values will override the inferred types of the entries.
</ParamField>

<ParamField body="entries" type="object" default={{}}>
Dictionary containing one or more key:value pairs that will be logged into the platform. Values must be JSON serializable. If a `explicit_types` dictionary is present, its values will override the inferred types of the entries.
<ParamField body="entries" type="object | array" default={{}}>
Dictionary containing one or more key:value pairs that will be logged into the platform. Can be either a single dictionary or a list of dictionaries for batch processing. When using lists for both params and entries, their lengths must match. Values must be JSON serializable. If a `explicit_types` dictionary is present, its values will override the inferred types of the entries.
</ParamField>

<ParamField body="strongly_typed" type="boolean | array" default={true}>
Expand All @@ -39,36 +39,22 @@ Enforce strong typing for fields.

```bash cURL
curl --request POST \
--url 'https://api.unify.ai/v0/log' \
--url 'https://api.unify.ai/v0/logs' \
--header "Authorization: Bearer $UNIFY_KEY" \
--header 'Content-Type: application/json' \
--data '{
"project": "eval-project",
"params": {
"explicit_types": {
"system-prompt": "str"
},
"function_definition": "...",
"system-prompt": "..."
},
"entries": {
"explicit_types": {
"input": "Image"
},
"input": "...",
"score-test-1": "..."
}
"project": "eval-project"
}'
```

```python Python
import requests

url = "https://api.unify.ai/v0/log"
url = "https://api.unify.ai/v0/logs"

headers = {"Authorization": "Bearer <token>"}

json_input = {"project": "eval-project", "params": {"explicit_types": {"system-prompt": "str"}, "function_definition": "...", "system-prompt": "..."}, "entries": {"explicit_types": {"input": "Image"}, "input": "...", "score-test-1": "..."}}
json_input = {"project": "eval-project"}

response = requests.request("POST", url, json=json_input, headers=headers)

Expand All @@ -80,7 +66,12 @@ print(response.text)

```json 200
{
"info": "Log created successfully!"
"info": "Logs created successfully!",
"log_event_ids": [
1,
2,
3
]
}
```

Expand Down
Loading

0 comments on commit 4ec8974

Please sign in to comment.