> For the complete documentation index, see [llms.txt](https://docs.raga.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.raga.ai/ragaai-catalyst/ragaai-metric-library/code-generation/ruby.md).

# Ruby

Test LLM outputs with Ruby metrics. Assess token overlap for translation accuracy and language precision.

**Objective:**

Ruby uses program dependency graph (PDG) analysis to evaluate code structure similarity. It compares the logical structure and dependencies of generated code with a reference, identifying structural and semantic alignment, making it well-suited for complex programming tasks where accuracy in logic flow is crucial.

**Required Columns in Dataset:**

`Generated Code`, `Reference Code`

**Interpretation:**

* **High Ruby Score:** Suggests that the generated code aligns closely with the logical structure of the reference code.
* **Low Ruby Score:** Indicates deviations in code logic or structure, potentially affecting functionality.

**Execution via UI:**

<figure><img src="https://1811327582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYbIiNdp1QbG4avl7VShw%2Fuploads%2FvI4w9FeSPlD05MV4l3rL%2FScreenshot%202024-10-28%20at%204.48.15%E2%80%AFPM.png?alt=media&amp;token=a5ed9494-df63-41bf-8c37-5f1356407ec9" alt=""><figcaption></figcaption></figure>

**Execution via SDK:**

```python
metrics=[
    {"name": "Ruby", "schema_mapping": {"generated_code": "Generated Code", "reference_code": "Reference Code"}}
]

```
