Installation is straightforward with `pip install structured-logprobs`. The library includes functions for mapping characters to token indices and methods for incorporating log probabilities, such as adding them as a separate field in the response or embedding them inline within the message content. The usage involves importing necessary modules, creating a client, and generating completions with log probabilities, which can then be processed using the library's functions.
Key takeaways:
- Structured-logprobs is an open-source Python library that provides detailed information about token log probabilities to enhance OpenAI's structured outputs.
- The library works with OpenAI's Structured Outputs to ensure model responses adhere to a supplied JSON Schema, preventing missing keys or invalid values.
- Installation is simple using pip, and the library can be used to add log probabilities to OpenAI model outputs.
- Key features include functions for mapping characters to token indices and methods for adding or embedding log probabilities in responses.