---
title: "Rate Log By Id"
method: POST
path: "/v1/logs/{log_id}/rating"
tags: ["logs"]
---

# Rate Log By Id

`POST /v1/logs/{log_id}/rating`

Rate a specific request by its ID. When accessing it via an App's API Key, this endpoint will only allow
rating a log of that specific app.

## Path parameters

- `log_id` string, uuid, required

## Request body

- RequestRating
  - `good_answer` boolean, nullable — The rating given to this request. It can be good (`True`), bad (`False`) or none (`None` == `null`)
  - `feedback` string, nullable — An optional text with accompanies the feedback's rating

## Response `200`

Successful Response

- LogRequest
  - `conversation_id` string, uuid, nullable, required
  - `parent_request_id` string, uuid, nullable, required
  - `good_answer` boolean, nullable — The rating given to this request. It can be good (`True`), bad (`False`) or none (`None` == `null`)
  - `feedback` string, nullable — An optional text with accompanies the feedback's rating
  - `prompt_tokens` integer — Number of tokens the request used
  - `completion_tokens` integer — Number of tokens the response used
  - `total_tokens` integer — Number of tokens of (request + response)
  - `prompt_tokens_cost` number — Cost (in $) of the prompt
  - `completion_tokens_cost` number — Cost (in $) of the response
  - `total_tokens_cost` number — Cost (in $) of the (request + response)
  - `prompt_tokens_cost_savings` number — Cost (in $) saved in the prompt costs comparison to the benchmark model
  - `completion_tokens_cost_savings` number — Cost (in $) saved in the completion costs comparison to the benchmark model
  - `total_tokens_cost_savings` number — Cost (in $) saved in total, in comparison to the benchmark model
  - `app_id` string, uuid, nullable, required — The ID of the app that performed the request
  - `auth0_id` string, nullable, required — The Auth0 ID of the user that performed the request
  - `costs_incurred` boolean — When a request requires multiple intermediate calls, they are stored as 'no costs incurred' -- that way we can store the costs, but don't charge the user
  - `namespace` string, nullable — The name of the provider's model which was used to answer the request
  - `payload` PulzeCompletionRequest
    - `model` string, nullable — https://docs.pulze.ai/overview/models Specify the model you'd like Pulze to use. (optional). Can be the full model name, or a subset for multi-matching. Defaults to our dynamic routing, i.e. best model for this request.
    - `max_tokens` integer, nullable — The maximum number of tokens that the response can contain.
    - `temperature` number, nullable — Optionally specify the temperature for this request only. Leave empty to allow Pulze to guess it for you.
    - `top_p` number, nullable — https://octo.ai/docs/text-gen-solution/rest-api#input-parameters A value between 0.0 and 1.0 that controls the probability of the model generating a particular token.
    - `tools` ToolFunctionOutput[], nullable
      - `type` 'function'
      - `function` ToolFunctionDetail, required
        - `name` string, required — A unique name for the function
        - `description` string, nullable — A description of the function. Might help the LLM to figure out the structure and parameters
        - `parameters` FunctionParameters, required
          - `type` string — Following JSON schema, this must be 'object'.
          - `properties` object, required — JSON schema's properties
          - `required` string[], nullable, required — List of required parameters
    - `tool_choice` union
      - 'none' | 'auto'
      - ToolChoice
        - `type` 'function' | 'json_object', nullable — (Note: Not supported by all models yet) // `json_object`: If you instruct the model to return a JSON object, the model will respond in a valid JSON format. || `function`: If you set this to function, you must also pass the `function` parameter with extra information. ||
        - `function` ToolChoiceFunction
          - `name` string, required — The name of the function you'd like the code to call
    - `n` integer, nullable — How many completions to generate for each prompt. @default 1
    - `stream` boolean, nullable — Specify if you want the response to be streamed or to be returned as a standard HTTP request. Currently we only support streaming for OpenAI-compatible models.
    - `logprobs` integer, nullable — COMING SOON https://platform.openai.com/docs/api-reference/completions/create#completions/create-logprobs Include the log probabilities on the logprobs most likely tokens, as well the chosen tokens.
    - `stop` union — Stop responding when this sequence of characters is generated. Leave empty to allow the model to decide.
      - string
      - string[]
    - `presence_penalty` number, nullable — https://platform.openai.com/docs/api-reference/completions/create#completions/create-presence_penalty Increase the model's likelihood to talk about new topics
    - `frequency_penalty` number, nullable — https://platform.openai.com/docs/api-reference/completions/create#completions/create-frequency_penalty Increase the model's likelihood to not repeat tokens/words
    - `best_of` integer, nullable — The number of responses to _generate_. Out of those, it will return the best `n`.
    - `logit_bias` object, nullable — COMING SOON https://platform.openai.com/docs/api-reference/completions/create#completions/create-logit_bias Modify the likelihood of specified tokens appearing in the completion. See here for a detailed explanation on how to use: https://help.openai.com/en/articles/5247780-using-logit-bias-to-define-token-probability
    - `response_format` RequestResponseFormat
      - `type` 'text' | 'json_object', required
    - `messages` RoleContentChatChoiceOutput[], nullable
      - `role` 'user' | 'assistant' | 'system', required
      - `content` union, required
        - string
        - RoleContentChatChoiceContent[]
          - `type` 'text' | 'image_url', required
          - `text` string, nullable
          - `image_url` RoleContentChatChoiceContentImageUrl
            - `url` string, required
      - `tool_calls` ToolCall[], nullable — If `tool_choice` parameter was passed, and the model supports it, this will return a list of the different calls/functions used.
        - `function` FunctionCallArguments, required
          - `arguments` string, required — A stringified JSON that represents the arguments for the function
          - `name` string, required — The name of the function to which the arguments correspond
        - `id` string, required
        - `type` 'function'
    - `assistant_id` string, uuid, nullable — The Assistant ID to use for this request
    - `assistant_version_id` string, uuid, nullable — The Assistant version ID to use for this request
    - `conversation_id` string, uuid, nullable — The Conversation ID to use for this request
    - `parent_request_id` string, uuid, nullable — The Parent Request ID to use for this request
    - `plugins` string[] — The list of plugins to enable for the request
    - `images` string[], nullable — Images to be analyzed
    - `files` string[], nullable — A list of file urls that should be included. Images, audio, etc.
    - `custom_headers` PulzeCustomHeadersData
      - `labels` object, nullable — Custom labeling of this request. If `None`, no labels will be stored.
      - `headers` object, nullable — HTTP Headers, without the custom `pulze-*` headers
      - `weights` LLMModelWeights
        - `cost` number — Prioritizes cost when selecting the most optimized models for your use case.
        - `latency` number — Prioritizes latency and reduces the time delay between submitting a request and receiving the response.
        - `quality` number — Prioritizes the quality and readability of the generated responses.
      - `policies` LLMModelPolicies
        - `privacy_level` 1 | 2 | 3 — The level of privacy for a given request 0 = (UNSUPPORTED -- public logs) 1 = Log request, response and all of its metadata (Normal mode) 2 = Do not log neither the request prompt nor the response text. Logs are still visible, and all of the request metadata accessible. Retrievable as a log. (TBD) 3 = Do not log at all. Internally, a minimal representation may be stored for billing: model name, tokens used, which app it belongs to, and timestamp. Not retrievable as a log. (TBD)
        - `max_cost` number — The maximum cost allowed for a request. Only works with compounded requests that require multiple LLM calls. If the value is reached, it will exit with an exception.
        - `max_switch_model_retries` integer — If an LLM call fails, _how many other models_ should Pulze try, chosen by quality descending? It will be a maximum of N+1 models (original + N other models)
        - `max_same_model_retries` integer — If an LLM call fails, how many times should Pulze _retry the call to the same LLM_? There will be a maximum of N+1 calls (original + N retries)
        - `optimize_internal_requests` 0 | 1 — Optimize the internal / intermediate LLM requests, for a big gain in speed and cost savings, at the cost of a potential, and very slight, penalty on quality. The final request ("SYNTHESIZE") is always performed using your original settings.
        - `prompt_id` string, uuid, nullable — Prompt ID that we will use for requests
      - `feature_flags` PulzeFeatureFlags
        - `citations` boolean — Whether to include citations to data sources in the response
        - `auto_tools` boolean — Whether to automatically select the appropriate tool to aid in generation
        - `smart_learn` boolean — Learn from liked responses
  - `privacy_level` 1 | 2 | 3 — How much is logged? 1: everything, 2: mask request+response (but show log), 3: Not visible, not retrievable, no information stored.
  - `prompt` string, nullable — The prompt in text format
  - `request_type` 'completions' | 'chat_completions', nullable — The type of request (text completion or chat) the user sends and expects back
  - `response_text` string — The response in text format
  - `response` PulzeEngineResponse, required — The response of any request to Completions or Chat Completions endpoints. This is a generic class!
    - `choices` union — The Response contains a list of choices. The role: *.message.role, and the content: *.message.content or, for text completions, the *.text attribute.
      - ResponseCompletionChatChoice[]
        - `index` integer, required
        - `finish_reason` string, nullable — The reason the model stopped generating tokens. Possible values: "stop", "length", "content_filter", "function_call", "max_tokens", ...
        - `message` RoleContentChatChoiceOutput, required
          - `role` 'user' | 'assistant' | 'system', required
          - `content` union, required
            - string
            - RoleContentChatChoiceContent[]
              - …
          - `tool_calls` ToolCall[], nullable — If `tool_choice` parameter was passed, and the model supports it, this will return a list of the different calls/functions used.
            - `function` FunctionCallArguments, required
              - …
            - `id` string, required
            - `type` 'function'
      - ResponseCompletionChoice[]
        - `index` integer, required
        - `finish_reason` string, nullable — The reason the model stopped generating tokens. Possible values: "stop", "length", "content_filter", "function_call", "max_tokens", ...
        - `text` string, required
        - `logprobs` integer, nullable
    - `created` integer — Creation timestamp -- in milliseconds (!)
    - `metadata` PulzeEngineResponseMetadata
      - `app_id` string — The ID of the app this request belongs to
      - `model` ModelParts
        - `model` string, required — The name of the model. Can belong to many providers
        - `provider` string, nullable — The provider for the model.
        - `owner` string, nullable — The owner of the model. Sometimes, for a provider/model combination, many instances exist, trained on different data
        - `namespace` string, required — The fully qualified (namespaced) model name
        - `at` string, nullable — Extra model settings inferred from namespace
      - `costs` PulzeEngineTokens
        - `total_tokens` number
        - `prompt_tokens` number
        - `completion_tokens` number
      - `cost_savings` PulzeEngineTokens
        - `total_tokens` number
        - `prompt_tokens` number
        - `completion_tokens` number
      - `generated_artifacts` PulzeGeneratedArtifacts
        - `items` object[] — Generated artifacts
      - `search_results` PulzeSearchResults
        - `items` object[] — Search results
      - `latency` number, nullable — The time it took for the Provider to return a response
      - `labels` object, nullable — Custom labels (metadata) sent along in the request
      - `error` string, nullable — If an error occurs, it will be stored here
      - `scores` RankedScoringModels
        - `best_models` object[]
        - `candidates` object[], nullable
      - `score` number, nullable — The score for the currently used LLM
      - `temperature` union — Temperature used for the request
        - number
        - integer
      - `max_tokens` integer, nullable — Maximum number of tokens that can be used in the request+response.Leave empty to make it automatic, and set to `-1` to use the maximum context size (model-dependent)
      - `status_code` integer, nullable — Status code of the response
      - `retries` integer — The number of retries needed to get the answer. `null` or `0` means no retries were required
      - `extra` object, nullable — Extra data
      - `warning` string, nullable — Show a warning -- deprecation messages, etc.
    - `id` string — This ID gets generated by the database when we save the request
    - `usage` PulzeEngineTokens
      - `total_tokens` number
      - `prompt_tokens` number
      - `completion_tokens` number
    - `model` string, required — The fully qualified model name used by PulzeEngine
    - `object` 'text_completion' | 'chat.completion', required — The type of response object
  - `status_code` integer — The status code of the request to the AI model
  - `is_test` boolean — True if the request was performed from a sandbox app
  - `added_on` string, date-time, nullable — When the request was performed
  - `latency` number — Time it took for the LLM to respond
  - `timestamp` integer, required — The timestamp of the request, in milliseconds
  - `parent_id` string, uuid, nullable — Reference to the ID of the parent of this log. A log has a parent when it's a subrequest used to retrieve the final answer.
  - `id` string, uuid, required — ID of the request
  - `is_saved_for_later` boolean
  - `comment_count` integer
  - `parent` LogRequest — recursive
  - `children` LogRequest[], nullable — The children of the Request. Will equal None unless you use eager loading in the query
  - `model` ModelData
    - `supports_functions` boolean, required — True if the model supports `function`/`tool` call
    - `supports_json` boolean, required — True if the model supports `json`-formatted responses
    - `supports_n` boolean, required — True if the model supports `n` and `best_of` -- i.e, multiple responses
    - `supports_penalties` boolean, required — True if the model supports `frequency_penalty` and `presence_penalty`
    - `supports_stream` boolean, required — True if the model supports streaming responses
    - `supports_vision` boolean, required — True if the model supports image recognition (vision)
    - `completion_token_cost` number, required — The cost of a completion token, in USD
    - `prompt_token_cost` number, required — The cost of a prompt token, in USD
    - `base_cost` number, required — A (usually 0) cost added on top of a request. Some models charge per request, not only per token
    - `price_unit` 'tokens' | 'characters', required — The unit of billing for this model
    - `model` string, required — The name of the model. Can belong to many providers
    - `provider` string, nullable — The provider for the model.
    - `owner` string, nullable — The owner of the model. Sometimes, for a provider/model combination, many instances exist, trained on different data
    - `namespace` string, required — The fully qualified (namespaced) model name
    - `at` string, nullable — Extra model settings inferred from namespace
    - `context_window` integer, required — The max_tokens for this model
    - `until` string, date-time, nullable, required — The most recent data this model has been trained with
    - `description` string, required — A description of the model
    - `url` string, required — A URL to the model's page or more informatino
    - `api_target` string — Store the name of the model the API requires
    - `deprecated_on` string, date-time, nullable — For models whose deprecation date is known (past or future), to show errors and deny service, or show warnings
    - `parent_id` string, uuid, nullable — The ID of parent, in case it's not a base model
    - `parent` ModelData — recursive
    - `prompt_id` string, uuid, nullable — The ID of prompt, used for this model
    - `is_rag` boolean, required — Whether it's rag-tuned or not
    - `is_ft` boolean, required — Whether it's fine-tuned or not
    - `is_open_source` boolean, required — True if the model is open source
    - `is_gdpr` boolean, required — True if the model complies with GDPR
    - `is_chat` boolean, required — True if the model is of type Chat Completions, False if it's a Text Completion model.
    - `id` string, uuid, nullable, required — The ID of this model
    - `app_id` string, uuid, nullable, required — The app_id that has access to this model (if only one)
    - `org_id` string, uuid, nullable, required — The org_id that has acccess to this model
    - `added_by` string, nullable, required — The user (auth0_id) who created the model
    - `added_on` string, date-time, nullable, required — When the model was added. Auto-populated in DB
    - `modified_on` string, date-time, nullable, required — When the model was updated. Auto-populated in DB
    - `is_public` boolean, required — True if the model is publicly accessible to all
    - `is_test_model` boolean, required — Test models are only used for testing and do not perform any LLM requests
    - `is_pulze_owner` boolean, required — Model has been created and shared by Pulze
    - `default_active` boolean, required — This determines if the model will be available + pre-selected when users create new apps.
  - `collections` AppCollectionRequest[], nullable — The collections this request is associated with
    - `name` string, required
    - `collection` AppCollection, required
      - `name` string, required
      - `description` string, nullable
      - `id` string, uuid, required
      - `request_count` integer, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/pulze/apis/pulze-ai-api.md) · [All operations](https://skmtc.net/pulze/apis/pulze-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pulze/pulze-ai-api/revisions/a5e0b539abc5/schema)
