Skip to content

feat: supporting citations from perplexity models #382

Open
@patryk-kowalski-ds

Description

@patryk-kowalski-ds

Feature description

Perplexity sonar-pro returns citations in response.citations field ignored in ragbits.core.llms.litellm.LiteLLM._call.

The ask is to include response.citations in outputs returned by _call, or otherwise support a method that exposes citations, perhaps generate_with_metadata.

I think you can just add this

            if hasattr(response, 'citations'): # type: ignore
                outputs.citations = response.citations  # type: ignore

(#383)

Motivation

User wanting to use perplexity has to use api directly, missing out on tracing etc.

Additional context

here's what perplexity api returns
dict_keys(['id', 'choices', 'created', 'model', 'object', 'usage', 'citations'])

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions