Skip to content

Conversation

@infuzu-yidisprei
Copy link
Contributor

No description provided.

- Introduced `get_version` function in `utils.py` to read and validate
  the application's version from a `.package-version` file.
- Updated `__init__.py` to include `get_version` in the module
  exports, allowing for easy access to version information.
- Encapsulated the logic in `main.py` under a `__main__` check
  to ensure the environment is only loaded when the script is
  executed directly, promoting better modularity and testability.
Added a newline at the end of the utils.py file to maintain
consistency and adhere to POSIX standards. This prevents potential
issues with file concatenation and improves code readability.
Added a dynamic User-Agent header to enhance request tracking and
compatibility. The header now includes the infuzu-python version,
Python version, httpx version, and the operating system info. This
improvement aids in better server analytics and debugging.
Updated exception handling to use a custom InfuzuAPIError instead
of httpx.HTTPStatusError for clearer error reporting when API
requests fail. This enhances code readability and maintains
consistency in error management across the codebase.
Updated the return type in the docstring of the chat completion
function from a dictionary to a ChatCompletionsObject. This
clarifies the expected output and improves code readability and
understanding for developers using this function.
Added type annotations to improve code readability and catch potential
type-related errors early. This helps in understanding the expected
types of variables and enhances the maintainability of the codebase.
Refactor Pydantic models to use ConfigDict instead of the Config
inner class. This change streamlines the code by directly setting
the 'extra' attribute to 'allow' within the model_config attribute,
enhancing readability and maintainability. This approach aligns
with the latest Pydantic practices and ensures consistent behavior
across all models in handling extra fields.
Refactored validation logic to use `model_validator` for improved
clarity and maintainability. Replaced `validator` with
`model_validator` in `ChatCompletionsRequestContentPart` and
`ChatCompletionsHandlerRequestMessage`. Changed `dict` to
`model_dump` for payload serialization, enhancing data handling
consistency.
This change removes an unused 'validator' import from the pydantic
module in the api_client.py file. By cleaning up unused imports, it
improves code readability and reduces potential confusion for future
developers working on the codebase.
@infuzu-yidisprei infuzu-yidisprei merged commit f72dd7e into main Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants