Skip to content

[Examples] Bootstrap functions vs. explicit codeΒ #693

@chr-hertel

Description

@chr-hertel

I'm struggling a bit with some refactoring we've done in the examples - explicitly around dealing with the result of the Platform.

I'd argue the purpose of examples is to provide working code snippets for various platforms & features. ready for copy & paste - and understanding what's going on.

in the beginning I introduced bootstrap for getting rid of secondary things - basically boring stuff that wasn't around Symfony AI. retrieving env vars with error message, a logger and instantiating an http client with a logger.

with functions like print_token_usage we now hide how to actually access and use the token data, and devs would need to switch from the example to the bootstrap.php
other functions in question: print_vectors, perplexity_print_* and print_stream

i get that there's a lot of duplicated code, but i think that's the nature of it. and I'd argue it's kinda stupid code, that is easy to maintain.

WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExamplesRFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions