diff --git a/.codeboarding/Data_Models_Error_Handling.json b/.codeboarding/Data_Models_Error_Handling.json new file mode 100644 index 0000000..1089c1d --- /dev/null +++ b/.codeboarding/Data_Models_Error_Handling.json @@ -0,0 +1,137 @@ +{ + "description": "This analysis outlines the final component structure of the `friendli_core` SDK, detailing its five key components: Core Client, Service Modules, Data Models & Error Handling, Utility Functions, and Examples and Documentation. It describes each component's role, associated source files, and interactions within the SDK, providing a comprehensive overview of the system's architecture and interdependencies.", + "components": [ + { + "name": "Core Client", + "description": "The central entry point for the SDK, responsible for managing authentication, session handling, and dispatching requests to the appropriate service modules. It provides the primary interface for users to interact with the Friendli AI platform.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.client", + "reference_file": "friendli_core.client.py", + "reference_start_line": 1, + "reference_end_line": 1 + } + ] + }, + { + "name": "Service Modules", + "description": "Encapsulate specific API functionalities (e.g., chat, completions, image generation, audio processing). Each module provides high-level methods for its domain, abstracting the underlying RESTful API calls and handling domain-specific logic.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.chat", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/chat.py", + "reference_start_line": null, + "reference_end_line": null + }, + { + "qualified_name": "friendli_core.completions", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/completions.py", + "reference_start_line": null, + "reference_end_line": null + }, + { + "qualified_name": "friendli_core.image", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/image.py", + "reference_start_line": null, + "reference_end_line": null + }, + { + "qualified_name": "friendli_core.audio", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/audio.py", + "reference_start_line": null, + "reference_end_line": null + } + ] + }, + { + "name": "Data Models & Error Handling", + "description": "Defines standardized data structures for all API requests and responses, ensuring consistent data representation across the SDK. This component also provides a comprehensive set of error types, facilitating robust and standardized error reporting from the Friendli AI platform.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.models", + "reference_file": "friendli_core.models.py", + "reference_start_line": 1, + "reference_end_line": 1 + }, + { + "qualified_name": "friendli_core.errors", + "reference_file": "friendli_core.errors.py", + "reference_start_line": 1, + "reference_end_line": 1 + } + ] + }, + { + "name": "Utility Functions", + "description": "Provides common helper functions for SDK-wide tasks such as JSON serialization/deserialization, parameter validation, configuration loading, and other reusable logic that supports the core functionalities.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.utils", + "reference_file": "friendli_core.utils.py", + "reference_start_line": 1, + "reference_end_line": 1 + } + ] + }, + { + "name": "Examples and Documentation", + "description": "Comprises practical code examples demonstrating how to effectively use the SDK's functionalities and comprehensive documentation (API references, guides) to assist developers in integrating and utilizing the Friendli AI platform.", + "referenced_source_code": [ + { + "qualified_name": "examples", + "reference_file": "examples/", + "reference_start_line": 1, + "reference_end_line": 1 + }, + { + "qualified_name": "docs", + "reference_file": "docs/", + "reference_start_line": 1, + "reference_end_line": 1 + } + ] + } + ], + "components_relations": [ + { + "relation": "uses", + "src_name": "Core Client", + "dst_name": "Service Modules" + }, + { + "relation": "uses", + "src_name": "Core Client", + "dst_name": "Data Models & Error Handling" + }, + { + "relation": "uses", + "src_name": "Core Client", + "dst_name": "Utility Functions" + }, + { + "relation": "utilizes", + "src_name": "Service Modules", + "dst_name": "Data Models & Error Handling" + }, + { + "relation": "uses", + "src_name": "Service Modules", + "dst_name": "Utility Functions" + }, + { + "relation": "showcases usage of", + "src_name": "Examples and Documentation", + "dst_name": "Core Client" + }, + { + "relation": "showcases usage of", + "src_name": "Examples and Documentation", + "dst_name": "Service Modules" + }, + { + "relation": "relies on", + "src_name": "Examples and Documentation", + "dst_name": "Data Models & Error Handling" + } + ] +} diff --git a/.codeboarding/Data_Models_Error_Handling.md b/.codeboarding/Data_Models_Error_Handling.md new file mode 100644 index 0000000..304d639 --- /dev/null +++ b/.codeboarding/Data_Models_Error_Handling.md @@ -0,0 +1,78 @@ +```mermaid +graph LR + Core_Client["Core Client"] + Service_Modules["Service Modules"] + Data_Models_Error_Handling["Data Models & Error Handling"] + Utility_Functions["Utility Functions"] + Examples_and_Documentation["Examples and Documentation"] + Core_Client -- "uses" --> Service_Modules + Core_Client -- "uses" --> Data_Models_Error_Handling + Core_Client -- "uses" --> Utility_Functions + Service_Modules -- "utilizes" --> Data_Models_Error_Handling + Service_Modules -- "uses" --> Utility_Functions + Examples_and_Documentation -- "showcases usage of" --> Core_Client + Examples_and_Documentation -- "showcases usage of" --> Service_Modules + Examples_and_Documentation -- "relies on" --> Data_Models_Error_Handling + click Service_Modules href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Service_Modules.md" "Details" + click Data_Models_Error_Handling href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Data_Models_Error_Handling.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +This analysis outlines the final component structure of the `friendli_core` SDK, detailing its five key components: Core Client, Service Modules, Data Models & Error Handling, Utility Functions, and Examples and Documentation. It describes each component's role, associated source files, and interactions within the SDK, providing a comprehensive overview of the system's architecture and interdependencies. + +### Core Client +The central entry point for the SDK, responsible for managing authentication, session handling, and dispatching requests to the appropriate service modules. It provides the primary interface for users to interact with the Friendli AI platform. + + +**Related Classes/Methods**: + +- `friendli_core.client` + + +### Service Modules [[Expand]](./Service_Modules.md) +Encapsulate specific API functionalities (e.g., chat, completions, image generation, audio processing). Each module provides high-level methods for its domain, abstracting the underlying RESTful API calls and handling domain-specific logic. + + +**Related Classes/Methods**: + +- `friendli_core.chat` +- `friendli_core.completions` +- `friendli_core.image` +- `friendli_core.audio` + + +### Data Models & Error Handling [[Expand]](./Data_Models_Error_Handling.md) +Defines standardized data structures for all API requests and responses, ensuring consistent data representation across the SDK. This component also provides a comprehensive set of error types, facilitating robust and standardized error reporting from the Friendli AI platform. + + +**Related Classes/Methods**: + +- `friendli_core.models` +- `friendli_core.errors` + + +### Utility Functions +Provides common helper functions for SDK-wide tasks such as JSON serialization/deserialization, parameter validation, configuration loading, and other reusable logic that supports the core functionalities. + + +**Related Classes/Methods**: + +- `friendli_core.utils` + + +### Examples and Documentation +Comprises practical code examples demonstrating how to effectively use the SDK's functionalities and comprehensive documentation (API references, guides) to assist developers in integrating and utilizing the Friendli AI platform. + + +**Related Classes/Methods**: + +- `examples` +- `docs` + + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) diff --git a/.codeboarding/Friendli_Client_Public_API_.json b/.codeboarding/Friendli_Client_Public_API_.json new file mode 100644 index 0000000..cf2c3f9 --- /dev/null +++ b/.codeboarding/Friendli_Client_Public_API_.json @@ -0,0 +1,159 @@ +{ + "description": "Final Component Overview for the `Friendli Client (Public API)` subsystem, structured according to Client-side SDK patterns.", + "components": [ + { + "name": "Core Client (Public API)", + "description": "The primary entry point for end-users, offering a high-level, consistent interface for interacting with the Friendli AI platform, supporting both synchronous and asynchronous operations. It acts as the orchestrator, delegating requests to specific service modules.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.sdk", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/sdk.py", + "reference_start_line": null, + "reference_end_line": null + } + ] + }, + { + "name": "Service Modules", + "description": "Encapsulate the logic for interacting with specific API endpoints (e.g., chat, completions, images, audio). Each module handles the construction of requests, serialization of data models, and deserialization of responses for its domain.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.chat", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/chat.py", + "reference_start_line": null, + "reference_end_line": null + }, + { + "qualified_name": "friendli_core.completions", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/completions.py", + "reference_start_line": null, + "reference_end_line": null + }, + { + "qualified_name": "friendli_core.images", + "reference_file": "friendli_core.images", + "reference_start_line": 1, + "reference_end_line": 1 + }, + { + "qualified_name": "friendli_core.audio", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/audio.py", + "reference_start_line": null, + "reference_end_line": null + } + ] + }, + { + "name": "Data Models", + "description": "Define the structure of data exchanged with the Friendli AI platform, including request bodies, response objects, and various parameters. Ensures type safety and consistency across all API interactions within the SDK.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.models", + "reference_file": "friendli_core.models", + "reference_start_line": 1, + "reference_end_line": 1 + } + ] + }, + { + "name": "HTTP Client/Transport Layer", + "description": "Handles the low-level HTTP communication with the Friendli AI platform. This includes managing connections, sending requests, receiving responses, and abstracting away network-level concerns like retries and timeouts.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.http_client", + "reference_file": "friendli_core.http_client", + "reference_start_line": 1, + "reference_end_line": 1 + } + ] + }, + { + "name": "Error Handling", + "description": "Manages and standardizes error responses from both the API and the network layer. It provides custom exception classes and mechanisms for users to gracefully handle API-related issues and network errors, ensuring a consistent error reporting experience.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.errors", + "reference_file": "friendli_core.errors", + "reference_start_line": 1, + "reference_end_line": 1 + } + ] + }, + { + "name": "Configuration Management", + "description": "Centralizes and manages SDK-wide configuration settings, such as API keys, base URLs, default timeouts, and retry policies. It provides a consistent and accessible way to configure the SDK's behavior.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.config", + "reference_file": "friendli_core.config", + "reference_start_line": 1, + "reference_end_line": 1 + } + ] + }, + { + "name": "Utility Functions", + "description": "Provides common helper functions and reusable functionalities that support various parts of the SDK, such as authentication token management, data validation, or specific data transformations that are not tied to a particular API domain.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.utils", + "reference_file": "friendli_core.utils", + "reference_start_line": 1, + "reference_end_line": 1 + } + ] + } + ], + "components_relations": [ + { + "relation": "uses", + "src_name": "Core Client (Public API)", + "dst_name": "Service Modules" + }, + { + "relation": "uses", + "src_name": "Core Client (Public API)", + "dst_name": "Configuration Management" + }, + { + "relation": "uses", + "src_name": "Core Client (Public API)", + "dst_name": "Data Models" + }, + { + "relation": "uses", + "src_name": "Core Client (Public API)", + "dst_name": "Utility Functions" + }, + { + "relation": "uses", + "src_name": "Service Modules", + "dst_name": "HTTP Client/Transport Layer" + }, + { + "relation": "uses", + "src_name": "Service Modules", + "dst_name": "Data Models" + }, + { + "relation": "uses", + "src_name": "Service Modules", + "dst_name": "Error Handling" + }, + { + "relation": "uses", + "src_name": "Service Modules", + "dst_name": "Utility Functions" + }, + { + "relation": "uses", + "src_name": "HTTP Client/Transport Layer", + "dst_name": "Configuration Management" + }, + { + "relation": "uses", + "src_name": "HTTP Client/Transport Layer", + "dst_name": "Error Handling" + } + ] +} diff --git a/.codeboarding/Friendli_Client_Public_API_.md b/.codeboarding/Friendli_Client_Public_API_.md new file mode 100644 index 0000000..c16befd --- /dev/null +++ b/.codeboarding/Friendli_Client_Public_API_.md @@ -0,0 +1,98 @@ +```mermaid +graph LR + Core_Client_Public_API_["Core Client (Public API)"] + Service_Modules["Service Modules"] + Data_Models["Data Models"] + HTTP_Client_Transport_Layer["HTTP Client/Transport Layer"] + Error_Handling["Error Handling"] + Configuration_Management["Configuration Management"] + Utility_Functions["Utility Functions"] + Core_Client_Public_API_ -- "uses" --> Service_Modules + Core_Client_Public_API_ -- "uses" --> Configuration_Management + Core_Client_Public_API_ -- "uses" --> Data_Models + Core_Client_Public_API_ -- "uses" --> Utility_Functions + Service_Modules -- "uses" --> HTTP_Client_Transport_Layer + Service_Modules -- "uses" --> Data_Models + Service_Modules -- "uses" --> Error_Handling + Service_Modules -- "uses" --> Utility_Functions + HTTP_Client_Transport_Layer -- "uses" --> Configuration_Management + HTTP_Client_Transport_Layer -- "uses" --> Error_Handling + click Service_Modules href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Service_Modules.md" "Details" + click Error_Handling href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Error_Handling.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +Final Component Overview for the `Friendli Client (Public API)` subsystem, structured according to Client-side SDK patterns. + +### Core Client (Public API) +The primary entry point for end-users, offering a high-level, consistent interface for interacting with the Friendli AI platform, supporting both synchronous and asynchronous operations. It acts as the orchestrator, delegating requests to specific service modules. + + +**Related Classes/Methods**: + +- `friendli_core.sdk` + + +### Service Modules [[Expand]](./Service_Modules.md) +Encapsulate the logic for interacting with specific API endpoints (e.g., chat, completions, images, audio). Each module handles the construction of requests, serialization of data models, and deserialization of responses for its domain. + + +**Related Classes/Methods**: + +- `friendli_core.chat` +- `friendli_core.completions` +- `friendli_core.images` +- `friendli_core.audio` + + +### Data Models +Define the structure of data exchanged with the Friendli AI platform, including request bodies, response objects, and various parameters. Ensures type safety and consistency across all API interactions within the SDK. + + +**Related Classes/Methods**: + +- `friendli_core.models` + + +### HTTP Client/Transport Layer +Handles the low-level HTTP communication with the Friendli AI platform. This includes managing connections, sending requests, receiving responses, and abstracting away network-level concerns like retries and timeouts. + + +**Related Classes/Methods**: + +- `friendli_core.http_client` + + +### Error Handling [[Expand]](./Error_Handling.md) +Manages and standardizes error responses from both the API and the network layer. It provides custom exception classes and mechanisms for users to gracefully handle API-related issues and network errors, ensuring a consistent error reporting experience. + + +**Related Classes/Methods**: + +- `friendli_core.errors` + + +### Configuration Management +Centralizes and manages SDK-wide configuration settings, such as API keys, base URLs, default timeouts, and retry policies. It provides a consistent and accessible way to configure the SDK's behavior. + + +**Related Classes/Methods**: + +- `friendli_core.config` + + +### Utility Functions +Provides common helper functions and reusable functionalities that support various parts of the SDK, such as authentication token management, data validation, or specific data transformations that are not tied to a particular API domain. + + +**Related Classes/Methods**: + +- `friendli_core.utils` + + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) diff --git a/.codeboarding/Platform_Abstractions.json b/.codeboarding/Platform_Abstractions.json new file mode 100644 index 0000000..711230c --- /dev/null +++ b/.codeboarding/Platform_Abstractions.json @@ -0,0 +1,77 @@ +{ + "description": "Abstract Components Overview", + "components": [ + { + "name": "Platform Abstractions", + "description": "Defines the foundational base structures and interfaces that enable the SDK to adapt its behavior to various operational modes (e.g., dedicated, serverless) of the Friendli platform. It provides the abstract contracts for interacting with different deployment types.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.basesdk:BaseSDK", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/basesdk.py", + "reference_start_line": 19, + "reference_end_line": 106 + } + ] + }, + { + "name": "Dedicated Client", + "description": "A concrete implementation of the `Platform Abstractions` tailored specifically for interacting with the Friendli platform in a \"dedicated\" operational mode. It provides the specific logic and configurations required for this environment.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.dedicated:BaseDedicated", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/dedicated.py", + "reference_start_line": 24, + "reference_end_line": 32 + }, + { + "qualified_name": "friendli_core.dedicated:SyncDedicated", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/dedicated.py", + "reference_start_line": 35, + "reference_end_line": 49 + }, + { + "qualified_name": "friendli_core.dedicated:AsyncDedicated", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/dedicated.py", + "reference_start_line": 52, + "reference_end_line": 66 + } + ] + }, + { + "name": "Serverless Client", + "description": "A concrete implementation of the `Platform Abstractions` designed for interacting with the Friendli platform in a \"serverless\" operational mode. It encapsulates the specific logic and configurations for this environment.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.serverless:BaseServerless", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/serverless.py", + "reference_start_line": 24, + "reference_end_line": 32 + }, + { + "qualified_name": "friendli_core.serverless:SyncServerless", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/serverless.py", + "reference_start_line": 35, + "reference_end_line": 49 + }, + { + "qualified_name": "friendli_core.serverless:AsyncServerless", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/serverless.py", + "reference_start_line": 52, + "reference_end_line": 68 + } + ] + } + ], + "components_relations": [ + { + "relation": "implements", + "src_name": "Dedicated Client", + "dst_name": "Platform Abstractions" + }, + { + "relation": "implements", + "src_name": "Serverless Client", + "dst_name": "Platform Abstractions" + } + ] +} diff --git a/.codeboarding/Platform_Abstractions.md b/.codeboarding/Platform_Abstractions.md new file mode 100644 index 0000000..ac695ea --- /dev/null +++ b/.codeboarding/Platform_Abstractions.md @@ -0,0 +1,50 @@ +```mermaid +graph LR + Platform_Abstractions["Platform Abstractions"] + Dedicated_Client["Dedicated Client"] + Serverless_Client["Serverless Client"] + Dedicated_Client -- "implements" --> Platform_Abstractions + Serverless_Client -- "implements" --> Platform_Abstractions + click Platform_Abstractions href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Platform_Abstractions.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +Abstract Components Overview + +### Platform Abstractions [[Expand]](./Platform_Abstractions.md) +Defines the foundational base structures and interfaces that enable the SDK to adapt its behavior to various operational modes (e.g., dedicated, serverless) of the Friendli platform. It provides the abstract contracts for interacting with different deployment types. + + +**Related Classes/Methods**: + +- `friendli_core.basesdk:BaseSDK`:19-106 + + +### Dedicated Client +A concrete implementation of the `Platform Abstractions` tailored specifically for interacting with the Friendli platform in a "dedicated" operational mode. It provides the specific logic and configurations required for this environment. + + +**Related Classes/Methods**: + +- `friendli_core.dedicated:BaseDedicated`:24-32 +- `friendli_core.dedicated:SyncDedicated`:35-49 +- `friendli_core.dedicated:AsyncDedicated`:52-66 + + +### Serverless Client +A concrete implementation of the `Platform Abstractions` designed for interacting with the Friendli platform in a "serverless" operational mode. It encapsulates the specific logic and configurations for this environment. + + +**Related Classes/Methods**: + +- `friendli_core.serverless:BaseServerless`:24-32 +- `friendli_core.serverless:SyncServerless`:35-49 +- `friendli_core.serverless:AsyncServerless`:52-68 + + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) diff --git a/.codeboarding/SDK_Core.json b/.codeboarding/SDK_Core.json new file mode 100644 index 0000000..2b5d84e --- /dev/null +++ b/.codeboarding/SDK_Core.json @@ -0,0 +1,199 @@ +{ + "description": "This section synthesizes the architectural components of the Friendli AI Python SDK, focusing on the `SDK Core` and its interactions within a client-side SDK pattern.", + "components": [ + { + "name": "SDK Core", + "description": "The foundational layer and central orchestrator of the SDK. It encapsulates the fundamental logic for API communication, request/response processing, and integrates core SDK abstractions. It provides the base classes (`BaseSDK`, `AsyncSDK`, `SyncSDK`) from which other service modules inherit, ensuring consistent interaction patterns and extensibility. It also manages global settings and extensibility points.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.basesdk", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/basesdk.py", + "reference_start_line": null, + "reference_end_line": null + } + ] + }, + { + "name": "Service Modules", + "description": "These modules encapsulate specific API functionalities (e.g., Chat, Completions, Image, Dataset). They extend the `SDK Core`'s base classes to provide high-level, domain-specific methods for interacting with different parts of the Friendli AI platform.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.chat", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/chat.py", + "reference_start_line": null, + "reference_end_line": null + }, + { + "qualified_name": "friendli_core.completions", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/completions.py", + "reference_start_line": null, + "reference_end_line": null + } + ] + }, + { + "name": "Data Models", + "description": "Defines the structured data objects (e.g., request bodies, response objects) used for communication with the Friendli AI platform. These models ensure type safety, consistency, and ease of use when exchanging data with the API.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.models", + "reference_file": "friendli_core/models.py", + "reference_start_line": 0, + "reference_end_line": 0 + } + ] + }, + { + "name": "Error Handling", + "description": "Manages and standardizes error responses originating from the API or internal SDK operations. It provides custom exceptions and robust error handling mechanisms, allowing developers to gracefully manage and respond to issues.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.errors", + "reference_file": "friendli_core/errors.py", + "reference_start_line": 0, + "reference_end_line": 0 + } + ] + }, + { + "name": "SDK Configuration", + "description": "Manages global settings and parameters for the SDK, such as API keys, base URLs, timeouts, and other configurable options. It provides a centralized mechanism for developers to customize the SDK's behavior.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.config", + "reference_file": "friendli_core/config.py", + "reference_start_line": 0, + "reference_end_line": 0 + } + ] + }, + { + "name": "Utility Functions", + "description": "Provides a collection of helper functions for common tasks that support the SDK's overall functionality. This includes operations like authentication, data serialization/deserialization, and other general-purpose utilities.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.utils", + "reference_file": "friendli_core/utils.py", + "reference_start_line": 0, + "reference_end_line": 0 + } + ] + }, + { + "name": "Asynchronous/Synchronous Adapters", + "description": "Provides distinct interfaces and implementations for both asynchronous (non-blocking) and synchronous (blocking) API calls. This allows developers to choose the appropriate execution model based on their application's architecture and performance requirements.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.basesdk", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/basesdk.py", + "reference_start_line": null, + "reference_end_line": null + } + ] + }, + { + "name": "Extensibility (Hooks)", + "description": "Offers mechanisms for extending SDK behavior through hooks or context objects (e.g., `HookContext`). This allows developers to inject custom logic at various points in the request/response lifecycle without altering the core SDK code.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.basesdk", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/basesdk.py", + "reference_start_line": null, + "reference_end_line": null + } + ] + } + ], + "components_relations": [ + { + "relation": "provides base classes to", + "src_name": "SDK Core", + "dst_name": "Service Modules" + }, + { + "relation": "utilizes", + "src_name": "Service Modules", + "dst_name": "SDK Core" + }, + { + "relation": "serializes/deserializes", + "src_name": "SDK Core", + "dst_name": "Data Models" + }, + { + "relation": "defines format for", + "src_name": "Data Models", + "dst_name": "SDK Core" + }, + { + "relation": "raises exceptions from", + "src_name": "SDK Core", + "dst_name": "Error Handling" + }, + { + "relation": "defines exceptions for", + "src_name": "Error Handling", + "dst_name": "SDK Core" + }, + { + "relation": "consumes settings from", + "src_name": "SDK Core", + "dst_name": "SDK Configuration" + }, + { + "relation": "provides parameters to", + "src_name": "SDK Configuration", + "dst_name": "SDK Core" + }, + { + "relation": "defines interface for", + "src_name": "SDK Core", + "dst_name": "Asynchronous/Synchronous Adapters" + }, + { + "relation": "provides execution paths for", + "src_name": "Asynchronous/Synchronous Adapters", + "dst_name": "SDK Core" + }, + { + "relation": "invokes", + "src_name": "SDK Core", + "dst_name": "Extensibility (Hooks)" + }, + { + "relation": "modifies behavior of", + "src_name": "Extensibility (Hooks)", + "dst_name": "SDK Core" + }, + { + "relation": "constructs requests with", + "src_name": "Service Modules", + "dst_name": "Data Models" + }, + { + "relation": "returns responses as", + "src_name": "Service Modules", + "dst_name": "Data Models" + }, + { + "relation": "handles exceptions from", + "src_name": "Service Modules", + "dst_name": "Error Handling" + }, + { + "relation": "defines error types for", + "src_name": "Error Handling", + "dst_name": "Service Modules" + }, + { + "relation": "provides helpers to", + "src_name": "Utility Functions", + "dst_name": "SDK Core" + }, + { + "relation": "provides helpers to", + "src_name": "Utility Functions", + "dst_name": "Service Modules" + } + ] +} diff --git a/.codeboarding/SDK_Core.md b/.codeboarding/SDK_Core.md new file mode 100644 index 0000000..82a5f6b --- /dev/null +++ b/.codeboarding/SDK_Core.md @@ -0,0 +1,115 @@ +```mermaid +graph LR + SDK_Core["SDK Core"] + Service_Modules["Service Modules"] + Data_Models["Data Models"] + Error_Handling["Error Handling"] + SDK_Configuration["SDK Configuration"] + Utility_Functions["Utility Functions"] + Asynchronous_Synchronous_Adapters["Asynchronous/Synchronous Adapters"] + Extensibility_Hooks_["Extensibility (Hooks)"] + SDK_Core -- "provides base classes to" --> Service_Modules + Service_Modules -- "utilizes" --> SDK_Core + SDK_Core -- "serializes/deserializes" --> Data_Models + Data_Models -- "defines format for" --> SDK_Core + SDK_Core -- "raises exceptions from" --> Error_Handling + Error_Handling -- "defines exceptions for" --> SDK_Core + SDK_Core -- "consumes settings from" --> SDK_Configuration + SDK_Configuration -- "provides parameters to" --> SDK_Core + SDK_Core -- "defines interface for" --> Asynchronous_Synchronous_Adapters + Asynchronous_Synchronous_Adapters -- "provides execution paths for" --> SDK_Core + SDK_Core -- "invokes" --> Extensibility_Hooks_ + Extensibility_Hooks_ -- "modifies behavior of" --> SDK_Core + Service_Modules -- "constructs requests with" --> Data_Models + Service_Modules -- "returns responses as" --> Data_Models + Service_Modules -- "handles exceptions from" --> Error_Handling + Error_Handling -- "defines error types for" --> Service_Modules + Utility_Functions -- "provides helpers to" --> SDK_Core + Utility_Functions -- "provides helpers to" --> Service_Modules + click SDK_Core href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/SDK_Core.md" "Details" + click Service_Modules href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Service_Modules.md" "Details" + click Error_Handling href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Error_Handling.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +This section synthesizes the architectural components of the Friendli AI Python SDK, focusing on the `SDK Core` and its interactions within a client-side SDK pattern. + +### SDK Core [[Expand]](./SDK_Core.md) +The foundational layer and central orchestrator of the SDK. It encapsulates the fundamental logic for API communication, request/response processing, and integrates core SDK abstractions. It provides the base classes (`BaseSDK`, `AsyncSDK`, `SyncSDK`) from which other service modules inherit, ensuring consistent interaction patterns and extensibility. It also manages global settings and extensibility points. + + +**Related Classes/Methods**: + +- `friendli_core.basesdk` + + +### Service Modules [[Expand]](./Service_Modules.md) +These modules encapsulate specific API functionalities (e.g., Chat, Completions, Image, Dataset). They extend the `SDK Core`'s base classes to provide high-level, domain-specific methods for interacting with different parts of the Friendli AI platform. + + +**Related Classes/Methods**: + +- `friendli_core.chat` +- `friendli_core.completions` + + +### Data Models +Defines the structured data objects (e.g., request bodies, response objects) used for communication with the Friendli AI platform. These models ensure type safety, consistency, and ease of use when exchanging data with the API. + + +**Related Classes/Methods**: + +- `friendli_core.models` + + +### Error Handling [[Expand]](./Error_Handling.md) +Manages and standardizes error responses originating from the API or internal SDK operations. It provides custom exceptions and robust error handling mechanisms, allowing developers to gracefully manage and respond to issues. + + +**Related Classes/Methods**: + +- `friendli_core.errors` + + +### SDK Configuration +Manages global settings and parameters for the SDK, such as API keys, base URLs, timeouts, and other configurable options. It provides a centralized mechanism for developers to customize the SDK's behavior. + + +**Related Classes/Methods**: + +- `friendli_core.config` + + +### Utility Functions +Provides a collection of helper functions for common tasks that support the SDK's overall functionality. This includes operations like authentication, data serialization/deserialization, and other general-purpose utilities. + + +**Related Classes/Methods**: + +- `friendli_core.utils` + + +### Asynchronous/Synchronous Adapters +Provides distinct interfaces and implementations for both asynchronous (non-blocking) and synchronous (blocking) API calls. This allows developers to choose the appropriate execution model based on their application's architecture and performance requirements. + + +**Related Classes/Methods**: + +- `friendli_core.basesdk` + + +### Extensibility (Hooks) +Offers mechanisms for extending SDK behavior through hooks or context objects (e.g., `HookContext`). This allows developers to inject custom logic at various points in the request/response lifecycle without altering the core SDK code. + + +**Related Classes/Methods**: + +- `friendli_core.basesdk` + + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) diff --git a/.codeboarding/Service_Modules.json b/.codeboarding/Service_Modules.json new file mode 100644 index 0000000..0b09674 --- /dev/null +++ b/.codeboarding/Service_Modules.json @@ -0,0 +1,135 @@ +{ + "description": "These components are chosen based on their fundamental architectural importance in a Client-side SDK. The `Service Modules` are the primary interface for users, encapsulating domain logic. The `Security Utility` is essential for authentication, a core cross-cutting concern. `JSON Unmarshalling Utility` and `Event Streaming Utility` are vital for handling diverse API response formats. Finally, `Hook Context Management` provides the necessary extensibility, aligning with the \"Extensibility\" principle mentioned in the project context. This set of components provides a clear, modular, and functional breakdown of the SDK's core responsibilities.", + "components": [ + { + "name": "Service Modules", + "description": "These modules encapsulate the core API domain logic for specific functionalities like Chat, Completions, Dataset management, and Image processing. They provide high-level, domain-specific methods that abstract the underlying API interactions, supporting both asynchronous and synchronous operations. This component is central to the SDK's usability, offering a clear interface for developers to interact with different parts of the Friendli API.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.chat.SyncChat", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/chat.py", + "reference_start_line": 18, + "reference_end_line": 372 + }, + { + "qualified_name": "friendli_core.chat.AsyncChat", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/chat.py", + "reference_start_line": 375, + "reference_end_line": 729 + }, + { + "qualified_name": "friendli_core.completions.SyncCompletions", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/completions.py", + "reference_start_line": 18, + "reference_end_line": 194 + }, + { + "qualified_name": "friendli_core.completions.AsyncCompletions", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/completions.py", + "reference_start_line": 197, + "reference_end_line": 373 + }, + { + "qualified_name": "friendli_core.dataset.SyncDataset", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/dataset.py", + "reference_start_line": 19, + "reference_end_line": 1528 + }, + { + "qualified_name": "friendli_core.dataset.AsyncDataset", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/dataset.py", + "reference_start_line": 1531, + "reference_end_line": 3040 + }, + { + "qualified_name": "friendli_core.image.SyncImage", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/image.py", + "reference_start_line": 18, + "reference_end_line": 118 + }, + { + "qualified_name": "friendli_core.image.AsyncImage", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/image.py", + "reference_start_line": 121, + "reference_end_line": 221 + } + ] + }, + { + "name": "Security Utility", + "description": "Responsible for securely retrieving and managing API credentials, typically from environment variables or other configuration sources. This component ensures that API requests are properly authenticated.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.utils.security.get_security_from_env", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/utils/security.py", + "reference_start_line": 57, + "reference_end_line": 69 + } + ] + }, + { + "name": "JSON Unmarshalling Utility", + "description": "Handles the deserialization of JSON responses received from the Friendli API into structured Python objects. This component is crucial for converting raw API data into usable formats within the SDK.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.utils.unmarshal_json_response.unmarshal_json_response", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/utils/unmarshal_json_response.py", + "reference_start_line": 11, + "reference_end_line": 24 + } + ] + }, + { + "name": "Event Streaming Utility", + "description": "Provides mechanisms for processing and managing streaming responses from the API, particularly for operations that return continuous data streams (e.g., chat completions). It abstracts the complexities of handling server-sent events or similar streaming protocols.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.utils.eventstreaming.EventStream", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/utils/eventstreaming.py", + "reference_start_line": 19, + "reference_end_line": 42 + }, + { + "qualified_name": "friendli_core.utils.eventstreaming.EventStreamAsync", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/utils/eventstreaming.py", + "reference_start_line": 45, + "reference_end_line": 68 + } + ] + }, + { + "name": "Hook Context Management", + "description": "Manages an extensibility mechanism that allows developers to inject custom logic (hooks) at various points during the API interaction lifecycle. This component supports the SDK's extensibility, enabling custom pre-processing, post-processing, or error handling.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core._hooks.types.HookContext", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/_hooks/types.py", + "reference_start_line": 11, + "reference_end_line": 30 + } + ] + } + ], + "components_relations": [ + { + "relation": "calls", + "src_name": "Service Modules", + "dst_name": "Security Utility" + }, + { + "relation": "invokes", + "src_name": "Service Modules", + "dst_name": "JSON Unmarshalling Utility" + }, + { + "relation": "interacts with", + "src_name": "Service Modules", + "dst_name": "Event Streaming Utility" + }, + { + "relation": "utilizes", + "src_name": "Service Modules", + "dst_name": "Hook Context Management" + } + ] +} diff --git a/.codeboarding/Service_Modules.md b/.codeboarding/Service_Modules.md new file mode 100644 index 0000000..fd2e67b --- /dev/null +++ b/.codeboarding/Service_Modules.md @@ -0,0 +1,76 @@ +```mermaid +graph LR + Service_Modules["Service Modules"] + Security_Utility["Security Utility"] + JSON_Unmarshalling_Utility["JSON Unmarshalling Utility"] + Event_Streaming_Utility["Event Streaming Utility"] + Hook_Context_Management["Hook Context Management"] + Service_Modules -- "calls" --> Security_Utility + Service_Modules -- "invokes" --> JSON_Unmarshalling_Utility + Service_Modules -- "interacts with" --> Event_Streaming_Utility + Service_Modules -- "utilizes" --> Hook_Context_Management + click Service_Modules href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Service_Modules.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +These components are chosen based on their fundamental architectural importance in a Client-side SDK. The `Service Modules` are the primary interface for users, encapsulating domain logic. The `Security Utility` is essential for authentication, a core cross-cutting concern. `JSON Unmarshalling Utility` and `Event Streaming Utility` are vital for handling diverse API response formats. Finally, `Hook Context Management` provides the necessary extensibility, aligning with the "Extensibility" principle mentioned in the project context. This set of components provides a clear, modular, and functional breakdown of the SDK's core responsibilities. + +### Service Modules [[Expand]](./Service_Modules.md) +These modules encapsulate the core API domain logic for specific functionalities like Chat, Completions, Dataset management, and Image processing. They provide high-level, domain-specific methods that abstract the underlying API interactions, supporting both asynchronous and synchronous operations. This component is central to the SDK's usability, offering a clear interface for developers to interact with different parts of the Friendli API. + + +**Related Classes/Methods**: + +- `friendli_core.chat.SyncChat`:18-372 +- `friendli_core.chat.AsyncChat`:375-729 +- `friendli_core.completions.SyncCompletions`:18-194 +- `friendli_core.completions.AsyncCompletions`:197-373 +- `friendli_core.dataset.SyncDataset`:19-1528 +- `friendli_core.dataset.AsyncDataset`:1531-3040 +- `friendli_core.image.SyncImage`:18-118 +- `friendli_core.image.AsyncImage`:121-221 + + +### Security Utility +Responsible for securely retrieving and managing API credentials, typically from environment variables or other configuration sources. This component ensures that API requests are properly authenticated. + + +**Related Classes/Methods**: + +- `friendli_core.utils.security.get_security_from_env`:57-69 + + +### JSON Unmarshalling Utility +Handles the deserialization of JSON responses received from the Friendli API into structured Python objects. This component is crucial for converting raw API data into usable formats within the SDK. + + +**Related Classes/Methods**: + +- `friendli_core.utils.unmarshal_json_response.unmarshal_json_response`:11-24 + + +### Event Streaming Utility +Provides mechanisms for processing and managing streaming responses from the API, particularly for operations that return continuous data streams (e.g., chat completions). It abstracts the complexities of handling server-sent events or similar streaming protocols. + + +**Related Classes/Methods**: + +- `friendli_core.utils.eventstreaming.EventStream`:19-42 +- `friendli_core.utils.eventstreaming.EventStreamAsync`:45-68 + + +### Hook Context Management +Manages an extensibility mechanism that allows developers to inject custom logic (hooks) at various points during the API interaction lifecycle. This component supports the SDK's extensibility, enabling custom pre-processing, post-processing, or error handling. + + +**Related Classes/Methods**: + +- `friendli_core._hooks.types.HookContext`:11-30 + + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) diff --git a/.codeboarding/analysis.json b/.codeboarding/analysis.json new file mode 100644 index 0000000..f9e8470 --- /dev/null +++ b/.codeboarding/analysis.json @@ -0,0 +1,576 @@ +{ + "description": "One paragraph explaining the functionality which is represented by this graph. What the main flow is and what is its purpose.", + "components": [ + { + "name": "Friendli Client (Public API)", + "description": "The primary entry point for end-users, offering a high-level, consistent interface for interacting with the Friendli AI platform, supporting both synchronous and asynchronous operations.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.sdk", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/sdk.py", + "reference_start_line": null, + "reference_end_line": null + } + ], + "assigned_files": [ + "src/friendli/friendli.py", + "src/friendli/__init__.py", + "src/friendli_core/sdk.py" + ], + "can_expand": true + }, + { + "name": "SDK Core", + "description": "The central orchestrator managing fundamental logic for API communication, request/response processing, and integrating foundational SDK abstractions and extensibility points.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.basesdk", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/basesdk.py", + "reference_start_line": null, + "reference_end_line": null + } + ], + "assigned_files": [ + "src/friendli/httpclient.py", + "src/friendli/config.py", + "src/friendli_core/__init__.py", + "src/friendli_core/endpoint.py", + "src/friendli_core/basesdk.py", + "src/friendli_core/httpclient.py", + "src/friendli_core/sdkconfiguration.py" + ], + "can_expand": true + }, + { + "name": "Service Modules", + "description": "Encapsulate specific API domains (e.g., chat, completions, datasets), providing high-level, domain-specific methods that simplify interactions with particular parts of the Friendli API.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.chat", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/chat.py", + "reference_start_line": null, + "reference_end_line": null + }, + { + "qualified_name": "friendli_core.completions", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/completions.py", + "reference_start_line": null, + "reference_end_line": null + }, + { + "qualified_name": "friendli_core.dataset", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/dataset.py", + "reference_start_line": null, + "reference_end_line": null + }, + { + "qualified_name": "friendli_core.image", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/image.py", + "reference_start_line": null, + "reference_end_line": null + } + ], + "assigned_files": [ + "src/friendli/container/completions.py", + "src/friendli/container/__init__.py", + "src/friendli/container/chat.py", + "src/friendli/container/token.py", + "src/friendli/dataset/__init__.py", + "src/friendli/dataset/dataset.py", + "src/friendli/file/__init__.py", + "src/friendli/file/file.py", + "src/friendli_core/completions.py", + "src/friendli_core/file.py", + "src/friendli_core/container.py", + "src/friendli_core/chat.py", + "src/friendli_core/friendlicore_image.py", + "src/friendli_core/friendlicore_completions.py", + "src/friendli_core/image.py", + "src/friendli_core/toolassistedchat.py", + "src/friendli_core/dataset.py", + "src/friendli_core/token.py", + "src/friendli_core/friendlicore_token.py", + "src/friendli_core/friendlicore_chat.py", + "src/friendli_core/knowledge.py", + "src/friendli_core/audio.py" + ], + "can_expand": true + }, + { + "name": "Data Models & Error Handling", + "description": "Defines standardized data structures for API requests and responses, along with a comprehensive set of error types, ensuring consistent data representation and robust error reporting.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.models", + "reference_file": "N/A", + "reference_start_line": 0, + "reference_end_line": 0 + } + ], + "assigned_files": [ + "src/friendli/models.py", + "src/friendli/types.py", + "src/friendli_core/model.py", + "src/friendli_core/models/containerdetokenizationop.py", + "src/friendli_core/models/splitinfo.py", + "src/friendli_core/models/dedicatedgetendpointstatusop.py", + "src/friendli_core/models/createdatasetrequest.py", + "src/friendli_core/models/responseformat.py", + "src/friendli_core/models/serverlesstoolassistedchatcompletionstreamsuccess.py", + "src/friendli_core/models/toolstatusparameter.py", + "src/friendli_core/models/serverlesscompletionsbody.py", + "src/friendli_core/models/no_response_error.py", + "src/friendli_core/models/completionsstreambodywithtokens.py", + "src/friendli_core/models/__init__.py", + "src/friendli_core/models/containercompletionsstreamop.py", + "src/friendli_core/models/chatlogprobscontent.py", + "src/friendli_core/models/dedicatedendpointupdatebody.py", + "src/friendli_core/models/listsplitsresponse.py", + "src/friendli_core/models/textcontent.py", + "src/friendli_core/models/containertokenizationop.py", + "src/friendli_core/models/dedicatedcreateendpointop.py", + "src/friendli_core/models/inferencedeploymenterrorcode.py", + "src/friendli_core/models/dedicatedchatstreamop.py", + "src/friendli_core/models/containercompletionscompleteop.py", + "src/friendli_core/models/responseformattext.py", + "src/friendli_core/models/dedicatedaudiotranscriptionsop.py", + "src/friendli_core/models/assistantmessagetoolcallfunction.py", + "src/friendli_core/models/serverlesschatcompletionstreambody.py", + "src/friendli_core/models/completionsdedicatedbodywithprompt.py", + "src/friendli_core/models/completionschoice.py", + "src/friendli_core/models/serverlesstokenizationbody.py", + "src/friendli_core/models/chatusage.py", + "src/friendli_core/models/completionslogprobs.py", + "src/friendli_core/models/pricingmodel.py", + "src/friendli_core/models/completionsbodywithprompt.py", + "src/friendli_core/models/get_infoop.py", + "src/friendli_core/models/serverlesstoolassistedchatcompletionbody.py", + "src/friendli_core/models/streamedtoolcallresult.py", + "src/friendli_core/models/completionsdedicatedbodywithtokens.py", + "src/friendli_core/models/serverlesscompletionsstreamop.py", + "src/friendli_core/models/containercompletionsbody.py", + "src/friendli_core/models/functionality.py", + "src/friendli_core/models/serverlesscompletionscompleteop.py", + "src/friendli_core/models/serverlesstokenizationop.py", + "src/friendli_core/models/security.py", + "src/friendli_core/models/function.py", + "src/friendli_core/models/listversionsresponse.py", + "src/friendli_core/models/containercompletionsstreamsuccess.py", + "src/friendli_core/models/dedicatedcompletionsstreamop.py", + "src/friendli_core/models/completionsstreamdedicatedbodywithprompt.py", + "src/friendli_core/models/friendlicoreerror.py", + "src/friendli_core/models/dedicatedaudiotranscriptionsuccess.py", + "src/friendli_core/models/usermessage.py", + "src/friendli_core/models/dedicatedwakeendpointop.py", + "src/friendli_core/models/streamedfunctionresult.py", + "src/friendli_core/models/dedicatedendpointwandbartifactcreatebody.py", + "src/friendli_core/models/b64imageitem.py", + "src/friendli_core/models/containerdetokenizationbody.py", + "src/friendli_core/models/responseformatjsonschema.py", + "src/friendli_core/models/httpvalidationerror.py", + "src/friendli_core/models/serverlessmodellistsuccess.py", + "src/friendli_core/models/dedicatedendpointwandbartifactcreateop.py", + "src/friendli_core/models/usermessagecontentmultimodal.py", + "src/friendli_core/models/dedicatedupdateendpointop.py", + "src/friendli_core/models/acceleratorrequirement.py", + "src/friendli_core/models/serverlesschatstreamop.py", + "src/friendli_core/models/videodata.py", + "src/friendli_core/models/toolstatusdata.py", + "src/friendli_core/models/functionresult.py", + "src/friendli_core/models/dedicatedimagegeneratesuccess.py", + "src/friendli_core/models/serverlessdetokenizationbody.py", + "src/friendli_core/models/containerchatstreamop.py", + "src/friendli_core/models/responseformatjsonschemaschema.py", + "src/friendli_core/models/serverlessknowledgeretrievalbody.py", + "src/friendli_core/models/dedicateddatasetmodalitytype.py", + "src/friendli_core/models/dedicatedterminateendpointop.py", + "src/friendli_core/models/streamedtoolassistedchattoken.py", + "src/friendli_core/models/completionsserverlessbodywithprompt.py", + "src/friendli_core/models/filegetdownloadurlresponse.py", + "src/friendli_core/models/listdatasetsresponse.py", + "src/friendli_core/models/dedicatedendpointversionhistoryresponse.py", + "src/friendli_core/models/get_splitop.py", + "src/friendli_core/models/get_download_urlop.py", + "src/friendli_core/models/serverlesstoolassistedchatstreamop.py", + "src/friendli_core/models/toolcallresult.py", + "src/friendli_core/models/dedicateddatasetmodality.py", + "src/friendli_core/models/chatlogprobs.py", + "src/friendli_core/models/toolstatuserror.py", + "src/friendli_core/models/dedicatedimagegenerationbody.py", + "src/friendli_core/models/autoscalingpolicy.py", + "src/friendli_core/models/dedicatedgetendpointop.py", + "src/friendli_core/models/list_versionsop.py", + "src/friendli_core/models/completionsstreamdedicatedbodywithtokens.py", + "src/friendli_core/models/completionsstreamserverlessbodywithtokens.py", + "src/friendli_core/models/streamedcompletionschoice.py", + "src/friendli_core/models/get_versionop.py", + "src/friendli_core/models/toolassistedchattool.py", + "src/friendli_core/models/dedicatedtokenizationop.py", + "src/friendli_core/models/containercompletionssuccess.py", + "src/friendli_core/models/completionsstreamserverlessbodywithtokens.py", + "src/friendli_core/models/add_samplesop.py", + "src/friendli_core/models/containerchatcompletesuccess.py", + "src/friendli_core/models/delete_samplesop.py", + "src/friendli_core/models/imagecontent.py", + "src/friendli_core/models/audiocontent.py", + "src/friendli_core/models/dedicatedendpointstatus.py", + "src/friendli_core/models/serverlessdetokenizationsuccess.py", + "src/friendli_core/models/toolmessage.py", + "src/friendli_core/models/serverlessdetokenizationop.py", + "src/friendli_core/models/dedicatedcompletionsbody.py", + "src/friendli_core/models/usage.py", + "src/friendli_core/models/containertokenizationsuccess.py", + "src/friendli_core/models/sdkerror.py", + "src/friendli_core/models/serverlessknowledgeretrieveop.py", + "src/friendli_core/models/dedicatedchatcompletionbody.py", + "src/friendli_core/models/delete_versionop.py", + "src/friendli_core/models/inferencedeploymentstatus.py", + "src/friendli_core/models/serverlesstoolassistedchatcompleteop.py", + "src/friendli_core/models/dedicatedrestartendpointop.py", + "src/friendli_core/models/list_datasetsop.py", + "src/friendli_core/models/streamoptions.py", + "src/friendli_core/models/streamedtoolassistedchattoolstatus.py", + "src/friendli_core/models/assistantmessagetoolcall.py", + "src/friendli_core/models/delete_datasetop.py", + "src/friendli_core/models/dedicatedtokenizationbody.py", + "src/friendli_core/models/dedicatedgetendpointversionhistoryop.py", + "src/friendli_core/models/dedicatedcompletionscompleteop.py", + "src/friendli_core/models/imagedata.py", + "src/friendli_core/models/dedicatedaudiotranscriptionbody.py", + "src/friendli_core/models/containerchatcompletionstreambody.py", + "src/friendli_core/models/responseformatregex.py", + "src/friendli_core/models/create_versionop.py", + "src/friendli_core/models/knowledgeretrievedchunk.py", + "src/friendli_core/models/otherbuiltintool.py", + "src/friendli_core/models/fileinituploadrequest.py", + "src/friendli_core/models/dedicatedendpointcreatebody.py", + "src/friendli_core/models/systemmessage.py", + "src/friendli_core/models/streamedchatchoicedelta.py", + "src/friendli_core/models/serverlesscompletionsstreambody.py", + "src/friendli_core/models/dedicatedendpointwandbartifactcreateresponse.py", + "src/friendli_core/models/containerimagesgenerateop.py", + "src/friendli_core/models/dedicateddeleteendpointop.py", + "src/friendli_core/models/chatchoicemessage.py", + "src/friendli_core/models/chatlogprobscontenttoplogprob.py", + "src/friendli_core/models/tool.py", + "src/friendli_core/models/delete_splitop.py", + "src/friendli_core/models/fileinituploadresponse.py", + "src/friendli_core/models/urlimageitem.py", + "src/friendli_core/models/servervadchunkingstrategy.py", + "src/friendli_core/models/serverlesschatcompletionbody.py", + "src/friendli_core/models/create_splitop.py", + "src/friendli_core/models/message.py", + "src/friendli_core/models/filebuiltintool.py", + "src/friendli_core/models/chatchoice.py", + "src/friendli_core/models/dedicatedchatcompletionstreambody.py", + "src/friendli_core/models/containerchatcompletionbody.py", + "src/friendli_core/models/dedicatedendpointlistresponse.py", + "src/friendli_core/models/completionsbodywithtokens.py", + "src/friendli_core/models/endpointsimplescaleconfig.py", + "src/friendli_core/models/dedicateddetokenizationbody.py", + "src/friendli_core/models/containerimagegeneratesuccess.py", + "src/friendli_core/models/serverlesstoolassistedchatcompletionstreambody.py", + "src/friendli_core/models/deletesamplesresponse.py", + "src/friendli_core/models/chatcompletebodytoolchoicefunction.py", + "src/friendli_core/models/containercompletionsstreambody.py", + "src/friendli_core/models/containertokenizationbody.py", + "src/friendli_core/models/completionsstreambodywithprompt.py", + "src/friendli_core/models/containerimagegenerationbody.py", + "src/friendli_core/models/dedicateddetokenizationop.py", + "src/friendli_core/models/list_splitsop.py", + "src/friendli_core/models/serverlesstokenizationsuccess.py", + "src/friendli_core/models/datasetinfo.py", + "src/friendli_core/models/containerchatcompleteop.py", + "src/friendli_core/models/modelcatalogresponseitem.py", + "src/friendli_core/models/serverlessknowledgeretrievalsuccess.py", + "src/friendli_core/models/toolstatusfile.py", + "src/friendli_core/models/chatcompletebodytoolchoice.py", + "src/friendli_core/models/tokensequence.py", + "src/friendli_core/models/dedicatedlistendpointsop.py", + "src/friendli_core/models/dedicatedimagesgenerateop.py", + "src/friendli_core/models/addsamplesresponse.py", + "src/friendli_core/models/body_upload_raw_samples.py", + "src/friendli_core/models/dedicatedsleependpointop.py", + "src/friendli_core/models/list_samplesop.py", + "src/friendli_core/models/completionsserverlessbodywithtokens.py", + "src/friendli_core/models/dedicatedtokenizationsuccess.py", + "src/friendli_core/models/serverlesschatcompleteop.py", + "src/friendli_core/models/streamedchatchoice.py", + "src/friendli_core/models/videocontent.py", + "src/friendli_core/models/dedicatedchatcompleteop.py", + "src/friendli_core/models/containerchatcompletionstreamsuccess.py", + "src/friendli_core/models/listsamplesresponse.py", + "src/friendli_core/models/complete_uploadop.py", + "src/friendli_core/models/serverlesspriceunittype.py", + "src/friendli_core/models/versioninfo.py", + "src/friendli_core/models/endpointadvancedconfig.py", + "src/friendli_core/models/assistantmessage.py", + "src/friendli_core/models/dedicatedendpointspec.py", + "src/friendli_core/models/get_datasetop.py", + "src/friendli_core/models/responseformatjsonobject.py", + "src/friendli_core/models/responsevalidationerror.py", + "src/friendli_core/models/upload_raw_samplesop.py", + "src/friendli_core/models/dedicatedcompletionsstreambody.py", + "src/friendli_core/models/containerdetokenizationsuccess.py", + "src/friendli_core/models/accountfilestatus.py", + "src/friendli_core/models/audiodata.py", + "src/friendli_core/models/validationerror.py", + "src/friendli_core/models/dedicateddetokenizationsuccess.py", + "src/friendli_core/models/create_datasetop.py", + "src/friendli_core/models/init_uploadop.py", + "src/friendli_core/models/streamedchatdata.py", + "src/friendli_core/models/fileinfo.py", + "src/friendli_core/models/streamedcompletiondata.py", + "src/friendli_core/types/__init__.py", + "src/friendli_core/types/basemodel.py" + ], + "can_expand": true + }, + { + "name": "Platform Abstractions", + "description": "Provides base structures and interfaces tailored for different operational modes or deployment types within the Friendli platform, enabling the SDK to adapt its behavior to the target environment.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core.dedicated", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/dedicated.py", + "reference_start_line": null, + "reference_end_line": null + }, + { + "qualified_name": "friendli_core.serverless", + "reference_file": "/mnt/e/StartUp/friendli-python/src/friendli_core/serverless.py", + "reference_start_line": null, + "reference_end_line": null + } + ], + "assigned_files": [ + "src/friendli/serverless/completions.py", + "src/friendli/serverless/__init__.py", + "src/friendli/serverless/chat.py", + "src/friendli/serverless/tool_assisted_chat.py", + "src/friendli/serverless/model.py", + "src/friendli/serverless/token.py", + "src/friendli/serverless/knowledge.py", + "src/friendli/dedicated/completions.py", + "src/friendli/dedicated/__init__.py", + "src/friendli/dedicated/chat.py", + "src/friendli/dedicated/endpoint.py", + "src/friendli/dedicated/image.py", + "src/friendli/dedicated/token.py", + "src/friendli/dedicated/audio.py", + "src/friendli_core/friendlicore_serverless_chat.py", + "src/friendli_core/dedicated.py", + "src/friendli_core/friendlicore_serverless_token.py", + "src/friendli_core/serverless.py", + "src/friendli_core/friendlicore_serverless_completions.py" + ], + "can_expand": true + }, + { + "name": "Hooks & Extensibility", + "description": "Offers an extensible mechanism for injecting custom logic at various stages of the request/response lifecycle, allowing for pre-processing, post-processing, and error handling customization.", + "referenced_source_code": [ + { + "qualified_name": "friendli_core._hooks", + "reference_file": "N/A", + "reference_start_line": 0, + "reference_end_line": 0 + } + ], + "assigned_files": [ + "src/friendli_core/_hooks/__init__.py", + "src/friendli_core/_hooks/sdkhooks.py", + "src/friendli_core/_hooks/registration.py", + "src/friendli_core/_hooks/types.py" + ], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [ + "src/friendli/utils.py", + "src/friendli_core/_version.py", + "src/friendli_core/utils/metadata.py", + "src/friendli_core/utils/__init__.py", + "src/friendli_core/utils/forms.py", + "src/friendli_core/utils/queryparams.py", + "src/friendli_core/utils/serializers.py", + "src/friendli_core/utils/security.py", + "src/friendli_core/utils/datetimes.py", + "src/friendli_core/utils/requestbodies.py", + "src/friendli_core/utils/enums.py", + "src/friendli_core/utils/url.py", + "src/friendli_core/utils/retries.py", + "src/friendli_core/utils/values.py", + "src/friendli_core/utils/headers.py", + "src/friendli_core/utils/logger.py", + "src/friendli_core/utils/unmarshal_json_response.py", + "src/friendli_core/utils/eventstreaming.py", + "src/friendli_core/utils/annotations.py", + "scripts/prepare_readme.py", + "scripts/auto-fix.py" + ], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + }, + { + "name": "Unclassified", + "description": "Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)", + "referenced_source_code": [], + "assigned_files": [], + "can_expand": false + } + ], + "components_relations": [ + { + "relation": "delegates requests to", + "src_name": "Friendli Client (Public API)", + "dst_name": "SDK Core" + }, + { + "relation": "utilizes", + "src_name": "SDK Core", + "dst_name": "Data Models & Error Handling" + }, + { + "relation": "adapts behavior based on", + "src_name": "SDK Core", + "dst_name": "Platform Abstractions" + }, + { + "relation": "integrates and consumes", + "src_name": "SDK Core", + "dst_name": "Hooks & Extensibility" + }, + { + "relation": "utilize", + "src_name": "Service Modules", + "dst_name": "SDK Core" + }, + { + "relation": "rely on", + "src_name": "Service Modules", + "dst_name": "Data Models & Error Handling" + } + ] +} diff --git a/.codeboarding/codeboarding_version.json b/.codeboarding/codeboarding_version.json new file mode 100644 index 0000000..5794f67 --- /dev/null +++ b/.codeboarding/codeboarding_version.json @@ -0,0 +1,4 @@ +{ + "commit_hash": "1def28d72026955db7b012597f0a488a89928ade", + "code_boarding_version": "0.2.0" +} diff --git a/.codeboarding/overview.md b/.codeboarding/overview.md new file mode 100644 index 0000000..1d62dc5 --- /dev/null +++ b/.codeboarding/overview.md @@ -0,0 +1,221 @@ +```mermaid +graph LR + Friendli_Client_Public_API_["Friendli Client (Public API)"] + SDK_Core["SDK Core"] + Service_Modules["Service Modules"] + Data_Models_Error_Handling["Data Models & Error Handling"] + Platform_Abstractions["Platform Abstractions"] + Hooks_Extensibility["Hooks & Extensibility"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Friendli_Client_Public_API_ -- "delegates requests to" --> SDK_Core + SDK_Core -- "utilizes" --> Data_Models_Error_Handling + SDK_Core -- "adapts behavior based on" --> Platform_Abstractions + SDK_Core -- "integrates and consumes" --> Hooks_Extensibility + Service_Modules -- "utilize" --> SDK_Core + Service_Modules -- "rely on" --> Data_Models_Error_Handling + click Friendli_Client_Public_API_ href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Friendli_Client_Public_API_.md" "Details" + click SDK_Core href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/SDK_Core.md" "Details" + click Service_Modules href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Service_Modules.md" "Details" + click Data_Models_Error_Handling href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Data_Models_Error_Handling.md" "Details" + click Platform_Abstractions href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Platform_Abstractions.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +One paragraph explaining the functionality which is represented by this graph. What the main flow is and what is its purpose. + +### Friendli Client (Public API) [[Expand]](./Friendli_Client_Public_API_.md) +The primary entry point for end-users, offering a high-level, consistent interface for interacting with the Friendli AI platform, supporting both synchronous and asynchronous operations. + + +**Related Classes/Methods**: + +- `friendli_core.sdk` + + +### SDK Core [[Expand]](./SDK_Core.md) +The central orchestrator managing fundamental logic for API communication, request/response processing, and integrating foundational SDK abstractions and extensibility points. + + +**Related Classes/Methods**: + +- `friendli_core.basesdk` + + +### Service Modules [[Expand]](./Service_Modules.md) +Encapsulate specific API domains (e.g., chat, completions, datasets), providing high-level, domain-specific methods that simplify interactions with particular parts of the Friendli API. + + +**Related Classes/Methods**: + +- `friendli_core.chat` +- `friendli_core.completions` +- `friendli_core.dataset` +- `friendli_core.image` + + +### Data Models & Error Handling [[Expand]](./Data_Models_Error_Handling.md) +Defines standardized data structures for API requests and responses, along with a comprehensive set of error types, ensuring consistent data representation and robust error reporting. + + +**Related Classes/Methods**: + +- `friendli_core.models` + + +### Platform Abstractions [[Expand]](./Platform_Abstractions.md) +Provides base structures and interfaces tailored for different operational modes or deployment types within the Friendli platform, enabling the SDK to adapt its behavior to the target environment. + + +**Related Classes/Methods**: + +- `friendli_core.dedicated` +- `friendli_core.serverless` + + +### Hooks & Extensibility +Offers an extensible mechanism for injecting custom logic at various stages of the request/response lifecycle, allowing for pre-processing, post-processing, and error handling customization. + + +**Related Classes/Methods**: + +- `friendli_core._hooks` + + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) diff --git a/.github/workflows/codeboarding-docs.yaml b/.github/workflows/codeboarding-docs.yaml new file mode 100644 index 0000000..86cd411 --- /dev/null +++ b/.github/workflows/codeboarding-docs.yaml @@ -0,0 +1,177 @@ +name: CodeBoarding Documentation update workflow + +on: + schedule: + - cron: '0 20 * * 6' # Every Saturday at 8:00 PM UTC + workflow_dispatch: + inputs: + repository_url: + description: 'Repository URL to test with' + required: false + default: 'https://github.com/friendliai/friendli-python' + type: string + source_branch: + description: 'Source branch for generation' + required: false + default: 'main' + type: string + target_branch: + description: 'Target branch for pull request' + required: false + default: 'main' + type: string + output_format: + description: 'Output format for documentation' + required: false + default: '.md' + type: choice + options: + - '.mdx' + - '.md' + - '.rst' + output_directory: + description: 'Output directory for documentation files' + required: false + default: '.codeboarding' + type: string + +jobs: + update-docs-action-usage: + runs-on: ubuntu-latest + timeout-minutes: 45 + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 # Required to access branch history + + # Determine branches based on context + - name: Set branch variables + id: set-branches + run: | + if [ "${{ github.event_name }}" = "pull_request" ]; then + echo "source_branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT + echo "target_branch=${{ github.base_ref }}" >> $GITHUB_OUTPUT + elif [ "${{ github.event.inputs.source_branch }}" != "" ] && [ "${{ github.event.inputs.target_branch }}" != "" ]; then + echo "source_branch=${{ github.event.inputs.source_branch }}" >> $GITHUB_OUTPUT + echo "target_branch=${{ github.event.inputs.target_branch }}" >> $GITHUB_OUTPUT + else + echo "source_branch=main" >> $GITHUB_OUTPUT + echo "target_branch=main" >> $GITHUB_OUTPUT + fi + + - name: Fetch CodeBoarding Documentation + timeout-minutes: 30 + id: codeboarding + uses: CodeBoarding/CodeBoarding-GHAction@0.1.2 + with: + repository_url: ${{ github.event.inputs.repository_url }} + source_branch: ${{ steps.set-branches.outputs.source_branch }} + target_branch: ${{ steps.set-branches.outputs.target_branch }} + output_directory: ${{ github.event.inputs.output_directory || '.codeboarding' }} + output_format: ${{ github.event.inputs.output_format || '.md' }} + + - name: Display Action Results + run: | + echo "Documentation files created: ${{ steps.codeboarding.outputs.markdown_files_created }}" + echo "JSON files created: ${{ steps.codeboarding.outputs.json_files_created }}" + echo "Documentation directory: ${{ steps.codeboarding.outputs.output_directory }}" + echo "JSON directory: ${{ steps.codeboarding.outputs.json_directory }}" + echo "Has changes: ${{ steps.codeboarding.outputs.has_changes }}" + + # Check if we have any changes to commit + - name: Check for changes + id: git-changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "has_git_changes=true" >> $GITHUB_OUTPUT + else + echo "has_git_changes=false" >> $GITHUB_OUTPUT + fi + + # Create docs/architecture directory and copy CodeBoarding files + - name: Copy CodeBoarding documentation to architecture folder + if: steps.git-changes.outputs.has_git_changes == 'true' && steps.codeboarding.outputs.has_changes == 'true' + run: | + # Create docs/architecture directory if it doesn't exist + mkdir -p docs/architecture + + # Create on_boarding.md if it doesn't exist + if [ ! -f "docs/architecture/on_boarding.md" ]; then + cat > docs/architecture/on_boarding.md << 'EOF' + # Friendli Python SDK - Architecture & Onboarding + + This section contains automatically generated documentation to help developers understand the codebase architecture and onboarding process. + + ## Generated Documentation + + The following documentation files are automatically generated by CodeBoarding to provide insights into the codebase: + + EOF + fi + + # Log the files found in the CodeBoarding directory + echo "📁 Scanning CodeBoarding directory for .md files..." + ls -la .codeboarding/ || echo "⚠️ CodeBoarding directory not found" + + # Copy all .md files from CodeBoarding to docs/architecture + copied_files_count=0 + + for file in .codeboarding/*.md; do + if [ -f "$file" ]; then + filename=$(basename "$file") + echo "✅ Copying: $filename to docs/architecture/" + cp "$file" "docs/architecture/$filename" + copied_files_count=$((copied_files_count + 1)) + + # Add reference to on_boarding.md + echo "- [$filename](./$filename)" >> docs/architecture/on_boarding.md + fi + done + + # Add timestamp to on_boarding.md + echo "" >> docs/architecture/on_boarding.md + echo "_Last updated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')_" >> docs/architecture/on_boarding.md + + # Summary logging + echo "" + echo "📊 File copy summary:" + echo " - Total .md files copied: $copied_files_count" + echo " - Destination: docs/architecture/" + + # List final contents + if [ $copied_files_count -gt 0 ]; then + echo " - Files in destination:" + ls -la docs/architecture/*.md 2>/dev/null || echo " No .md files found in destination" + fi + + echo "CodeBoarding documentation copied to docs/architecture/" + + - name: Commit and push changes + if: steps.git-changes.outputs.has_git_changes == 'true' && steps.codeboarding.outputs.has_changes == 'true' + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add . + git commit -m "docs: update codeboarding architecture documentation + + ## 📚 Architecture Documentation Update + This commit contains updated documentation files fetched from the CodeBoarding service and copied to the architecture documentation section. + + ### 📊 Summary + - Documentation files created/updated: ${{ steps.codeboarding.outputs.markdown_files_created }} + - JSON files created/updated: ${{ steps.codeboarding.outputs.json_files_created }} + - Documentation directory: ${{ steps.codeboarding.outputs.output_directory }}/ + - JSON directory: ${{ steps.codeboarding.outputs.json_directory }}/ + - Output format: ${{ github.event.inputs.output_format || '.md' }} + - Repository analyzed: ${{ github.server_url }}/${{ github.repository }} + - Destination: docs/architecture/ + + The generated .md files have been automatically copied to the architecture documentation section and referenced in on_boarding.md. + + 🤖 This commit was automatically generated by the CodeBoarding documentation update workflow." + git push diff --git a/README.md b/README.md index 25223be..65b4410 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,9 @@ When using Friendli Python SDK, you need to provide a Friendli Token for authent 5. Create a new Friendli Token by clicking the "Create token" button. 6. Copy the token and save it in a safe place. You will not be able to see this token again once the page is refreshed. +## Architecture & Development Onboarding + +For developers looking to understand the codebase architecture and get started with contributing to the Friendli Python SDK, please refer to our [Architecture Documentation](./docs/architecture/on_boarding.md). @@ -24,6 +27,7 @@ When using Friendli Python SDK, you need to provide a Friendli Token for authent * [Friendli Python SDK](#friendli-python-sdk) * [Token Setup](#token-setup) + * [Architecture & Development Onboarding](#architecture--development-onboarding) * [SDK Installation](#sdk-installation) * [SDK Example Usage](#sdk-example-usage) * [Authentication](#authentication) diff --git a/docs/architecture/Data_Models_Error_Handling.md b/docs/architecture/Data_Models_Error_Handling.md new file mode 100644 index 0000000..304d639 --- /dev/null +++ b/docs/architecture/Data_Models_Error_Handling.md @@ -0,0 +1,78 @@ +```mermaid +graph LR + Core_Client["Core Client"] + Service_Modules["Service Modules"] + Data_Models_Error_Handling["Data Models & Error Handling"] + Utility_Functions["Utility Functions"] + Examples_and_Documentation["Examples and Documentation"] + Core_Client -- "uses" --> Service_Modules + Core_Client -- "uses" --> Data_Models_Error_Handling + Core_Client -- "uses" --> Utility_Functions + Service_Modules -- "utilizes" --> Data_Models_Error_Handling + Service_Modules -- "uses" --> Utility_Functions + Examples_and_Documentation -- "showcases usage of" --> Core_Client + Examples_and_Documentation -- "showcases usage of" --> Service_Modules + Examples_and_Documentation -- "relies on" --> Data_Models_Error_Handling + click Service_Modules href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Service_Modules.md" "Details" + click Data_Models_Error_Handling href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Data_Models_Error_Handling.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +This analysis outlines the final component structure of the `friendli_core` SDK, detailing its five key components: Core Client, Service Modules, Data Models & Error Handling, Utility Functions, and Examples and Documentation. It describes each component's role, associated source files, and interactions within the SDK, providing a comprehensive overview of the system's architecture and interdependencies. + +### Core Client +The central entry point for the SDK, responsible for managing authentication, session handling, and dispatching requests to the appropriate service modules. It provides the primary interface for users to interact with the Friendli AI platform. + + +**Related Classes/Methods**: + +- `friendli_core.client` + + +### Service Modules [[Expand]](./Service_Modules.md) +Encapsulate specific API functionalities (e.g., chat, completions, image generation, audio processing). Each module provides high-level methods for its domain, abstracting the underlying RESTful API calls and handling domain-specific logic. + + +**Related Classes/Methods**: + +- `friendli_core.chat` +- `friendli_core.completions` +- `friendli_core.image` +- `friendli_core.audio` + + +### Data Models & Error Handling [[Expand]](./Data_Models_Error_Handling.md) +Defines standardized data structures for all API requests and responses, ensuring consistent data representation across the SDK. This component also provides a comprehensive set of error types, facilitating robust and standardized error reporting from the Friendli AI platform. + + +**Related Classes/Methods**: + +- `friendli_core.models` +- `friendli_core.errors` + + +### Utility Functions +Provides common helper functions for SDK-wide tasks such as JSON serialization/deserialization, parameter validation, configuration loading, and other reusable logic that supports the core functionalities. + + +**Related Classes/Methods**: + +- `friendli_core.utils` + + +### Examples and Documentation +Comprises practical code examples demonstrating how to effectively use the SDK's functionalities and comprehensive documentation (API references, guides) to assist developers in integrating and utilizing the Friendli AI platform. + + +**Related Classes/Methods**: + +- `examples` +- `docs` + + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) diff --git a/docs/architecture/Friendli_Client_Public_API_.md b/docs/architecture/Friendli_Client_Public_API_.md new file mode 100644 index 0000000..c16befd --- /dev/null +++ b/docs/architecture/Friendli_Client_Public_API_.md @@ -0,0 +1,98 @@ +```mermaid +graph LR + Core_Client_Public_API_["Core Client (Public API)"] + Service_Modules["Service Modules"] + Data_Models["Data Models"] + HTTP_Client_Transport_Layer["HTTP Client/Transport Layer"] + Error_Handling["Error Handling"] + Configuration_Management["Configuration Management"] + Utility_Functions["Utility Functions"] + Core_Client_Public_API_ -- "uses" --> Service_Modules + Core_Client_Public_API_ -- "uses" --> Configuration_Management + Core_Client_Public_API_ -- "uses" --> Data_Models + Core_Client_Public_API_ -- "uses" --> Utility_Functions + Service_Modules -- "uses" --> HTTP_Client_Transport_Layer + Service_Modules -- "uses" --> Data_Models + Service_Modules -- "uses" --> Error_Handling + Service_Modules -- "uses" --> Utility_Functions + HTTP_Client_Transport_Layer -- "uses" --> Configuration_Management + HTTP_Client_Transport_Layer -- "uses" --> Error_Handling + click Service_Modules href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Service_Modules.md" "Details" + click Error_Handling href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Error_Handling.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +Final Component Overview for the `Friendli Client (Public API)` subsystem, structured according to Client-side SDK patterns. + +### Core Client (Public API) +The primary entry point for end-users, offering a high-level, consistent interface for interacting with the Friendli AI platform, supporting both synchronous and asynchronous operations. It acts as the orchestrator, delegating requests to specific service modules. + + +**Related Classes/Methods**: + +- `friendli_core.sdk` + + +### Service Modules [[Expand]](./Service_Modules.md) +Encapsulate the logic for interacting with specific API endpoints (e.g., chat, completions, images, audio). Each module handles the construction of requests, serialization of data models, and deserialization of responses for its domain. + + +**Related Classes/Methods**: + +- `friendli_core.chat` +- `friendli_core.completions` +- `friendli_core.images` +- `friendli_core.audio` + + +### Data Models +Define the structure of data exchanged with the Friendli AI platform, including request bodies, response objects, and various parameters. Ensures type safety and consistency across all API interactions within the SDK. + + +**Related Classes/Methods**: + +- `friendli_core.models` + + +### HTTP Client/Transport Layer +Handles the low-level HTTP communication with the Friendli AI platform. This includes managing connections, sending requests, receiving responses, and abstracting away network-level concerns like retries and timeouts. + + +**Related Classes/Methods**: + +- `friendli_core.http_client` + + +### Error Handling [[Expand]](./Error_Handling.md) +Manages and standardizes error responses from both the API and the network layer. It provides custom exception classes and mechanisms for users to gracefully handle API-related issues and network errors, ensuring a consistent error reporting experience. + + +**Related Classes/Methods**: + +- `friendli_core.errors` + + +### Configuration Management +Centralizes and manages SDK-wide configuration settings, such as API keys, base URLs, default timeouts, and retry policies. It provides a consistent and accessible way to configure the SDK's behavior. + + +**Related Classes/Methods**: + +- `friendli_core.config` + + +### Utility Functions +Provides common helper functions and reusable functionalities that support various parts of the SDK, such as authentication token management, data validation, or specific data transformations that are not tied to a particular API domain. + + +**Related Classes/Methods**: + +- `friendli_core.utils` + + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) diff --git a/docs/architecture/Hooks_Extensibility.md b/docs/architecture/Hooks_Extensibility.md new file mode 100644 index 0000000..a615f66 --- /dev/null +++ b/docs/architecture/Hooks_Extensibility.md @@ -0,0 +1,66 @@ +```mermaid +graph LR + Query_Processor["Query Processor"] + Information_Retriever["Information Retriever"] + Response_Generator["Response Generator"] + History_Logger["History Logger"] + Unclassified["Unclassified"] + Query_Processor -- "sends query to" --> Information_Retriever + Information_Retriever -- "sends info to" --> Response_Generator + Response_Generator -- "sends response to" --> History_Logger + Information_Retriever -- "receives query from" --> Query_Processor + Response_Generator -- "receives info from" --> Information_Retriever + History_Logger -- "receives response from" --> Response_Generator +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +This graph represents the core functionality of a system that processes user queries, generates responses using a language model, and stores interaction history. The main flow involves receiving a query, retrieving relevant information, generating a response, and then saving the interaction. Its purpose is to provide an interactive question-answering system with memory. + +### Query Processor +Handles incoming user queries and prepares them for further processing. + + +**Related Classes/Methods**: + +- `QueryHandler.process` + + +### Information Retriever +Fetches relevant information based on the processed query from a knowledge base. + + +**Related Classes/Methods**: + +- `KnowledgeBase.retrieve`:20-115 + + +### Response Generator +Utilizes a language model to generate a natural language response. + + +**Related Classes/Methods**: + +- `LanguageModel.generate_response` + + +### History Logger +Stores the user query and the generated response for future reference. + + +**Related Classes/Methods**: + +- `InteractionLogger.log` + + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) diff --git a/docs/architecture/Platform_Abstractions.md b/docs/architecture/Platform_Abstractions.md new file mode 100644 index 0000000..ac695ea --- /dev/null +++ b/docs/architecture/Platform_Abstractions.md @@ -0,0 +1,50 @@ +```mermaid +graph LR + Platform_Abstractions["Platform Abstractions"] + Dedicated_Client["Dedicated Client"] + Serverless_Client["Serverless Client"] + Dedicated_Client -- "implements" --> Platform_Abstractions + Serverless_Client -- "implements" --> Platform_Abstractions + click Platform_Abstractions href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Platform_Abstractions.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +Abstract Components Overview + +### Platform Abstractions [[Expand]](./Platform_Abstractions.md) +Defines the foundational base structures and interfaces that enable the SDK to adapt its behavior to various operational modes (e.g., dedicated, serverless) of the Friendli platform. It provides the abstract contracts for interacting with different deployment types. + + +**Related Classes/Methods**: + +- `friendli_core.basesdk:BaseSDK`:19-106 + + +### Dedicated Client +A concrete implementation of the `Platform Abstractions` tailored specifically for interacting with the Friendli platform in a "dedicated" operational mode. It provides the specific logic and configurations required for this environment. + + +**Related Classes/Methods**: + +- `friendli_core.dedicated:BaseDedicated`:24-32 +- `friendli_core.dedicated:SyncDedicated`:35-49 +- `friendli_core.dedicated:AsyncDedicated`:52-66 + + +### Serverless Client +A concrete implementation of the `Platform Abstractions` designed for interacting with the Friendli platform in a "serverless" operational mode. It encapsulates the specific logic and configurations for this environment. + + +**Related Classes/Methods**: + +- `friendli_core.serverless:BaseServerless`:24-32 +- `friendli_core.serverless:SyncServerless`:35-49 +- `friendli_core.serverless:AsyncServerless`:52-68 + + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) diff --git a/docs/architecture/SDK_Core.md b/docs/architecture/SDK_Core.md new file mode 100644 index 0000000..82a5f6b --- /dev/null +++ b/docs/architecture/SDK_Core.md @@ -0,0 +1,115 @@ +```mermaid +graph LR + SDK_Core["SDK Core"] + Service_Modules["Service Modules"] + Data_Models["Data Models"] + Error_Handling["Error Handling"] + SDK_Configuration["SDK Configuration"] + Utility_Functions["Utility Functions"] + Asynchronous_Synchronous_Adapters["Asynchronous/Synchronous Adapters"] + Extensibility_Hooks_["Extensibility (Hooks)"] + SDK_Core -- "provides base classes to" --> Service_Modules + Service_Modules -- "utilizes" --> SDK_Core + SDK_Core -- "serializes/deserializes" --> Data_Models + Data_Models -- "defines format for" --> SDK_Core + SDK_Core -- "raises exceptions from" --> Error_Handling + Error_Handling -- "defines exceptions for" --> SDK_Core + SDK_Core -- "consumes settings from" --> SDK_Configuration + SDK_Configuration -- "provides parameters to" --> SDK_Core + SDK_Core -- "defines interface for" --> Asynchronous_Synchronous_Adapters + Asynchronous_Synchronous_Adapters -- "provides execution paths for" --> SDK_Core + SDK_Core -- "invokes" --> Extensibility_Hooks_ + Extensibility_Hooks_ -- "modifies behavior of" --> SDK_Core + Service_Modules -- "constructs requests with" --> Data_Models + Service_Modules -- "returns responses as" --> Data_Models + Service_Modules -- "handles exceptions from" --> Error_Handling + Error_Handling -- "defines error types for" --> Service_Modules + Utility_Functions -- "provides helpers to" --> SDK_Core + Utility_Functions -- "provides helpers to" --> Service_Modules + click SDK_Core href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/SDK_Core.md" "Details" + click Service_Modules href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Service_Modules.md" "Details" + click Error_Handling href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Error_Handling.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +This section synthesizes the architectural components of the Friendli AI Python SDK, focusing on the `SDK Core` and its interactions within a client-side SDK pattern. + +### SDK Core [[Expand]](./SDK_Core.md) +The foundational layer and central orchestrator of the SDK. It encapsulates the fundamental logic for API communication, request/response processing, and integrates core SDK abstractions. It provides the base classes (`BaseSDK`, `AsyncSDK`, `SyncSDK`) from which other service modules inherit, ensuring consistent interaction patterns and extensibility. It also manages global settings and extensibility points. + + +**Related Classes/Methods**: + +- `friendli_core.basesdk` + + +### Service Modules [[Expand]](./Service_Modules.md) +These modules encapsulate specific API functionalities (e.g., Chat, Completions, Image, Dataset). They extend the `SDK Core`'s base classes to provide high-level, domain-specific methods for interacting with different parts of the Friendli AI platform. + + +**Related Classes/Methods**: + +- `friendli_core.chat` +- `friendli_core.completions` + + +### Data Models +Defines the structured data objects (e.g., request bodies, response objects) used for communication with the Friendli AI platform. These models ensure type safety, consistency, and ease of use when exchanging data with the API. + + +**Related Classes/Methods**: + +- `friendli_core.models` + + +### Error Handling [[Expand]](./Error_Handling.md) +Manages and standardizes error responses originating from the API or internal SDK operations. It provides custom exceptions and robust error handling mechanisms, allowing developers to gracefully manage and respond to issues. + + +**Related Classes/Methods**: + +- `friendli_core.errors` + + +### SDK Configuration +Manages global settings and parameters for the SDK, such as API keys, base URLs, timeouts, and other configurable options. It provides a centralized mechanism for developers to customize the SDK's behavior. + + +**Related Classes/Methods**: + +- `friendli_core.config` + + +### Utility Functions +Provides a collection of helper functions for common tasks that support the SDK's overall functionality. This includes operations like authentication, data serialization/deserialization, and other general-purpose utilities. + + +**Related Classes/Methods**: + +- `friendli_core.utils` + + +### Asynchronous/Synchronous Adapters +Provides distinct interfaces and implementations for both asynchronous (non-blocking) and synchronous (blocking) API calls. This allows developers to choose the appropriate execution model based on their application's architecture and performance requirements. + + +**Related Classes/Methods**: + +- `friendli_core.basesdk` + + +### Extensibility (Hooks) +Offers mechanisms for extending SDK behavior through hooks or context objects (e.g., `HookContext`). This allows developers to inject custom logic at various points in the request/response lifecycle without altering the core SDK code. + + +**Related Classes/Methods**: + +- `friendli_core.basesdk` + + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) diff --git a/docs/architecture/Service_Modules.md b/docs/architecture/Service_Modules.md new file mode 100644 index 0000000..fd2e67b --- /dev/null +++ b/docs/architecture/Service_Modules.md @@ -0,0 +1,76 @@ +```mermaid +graph LR + Service_Modules["Service Modules"] + Security_Utility["Security Utility"] + JSON_Unmarshalling_Utility["JSON Unmarshalling Utility"] + Event_Streaming_Utility["Event Streaming Utility"] + Hook_Context_Management["Hook Context Management"] + Service_Modules -- "calls" --> Security_Utility + Service_Modules -- "invokes" --> JSON_Unmarshalling_Utility + Service_Modules -- "interacts with" --> Event_Streaming_Utility + Service_Modules -- "utilizes" --> Hook_Context_Management + click Service_Modules href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Service_Modules.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +These components are chosen based on their fundamental architectural importance in a Client-side SDK. The `Service Modules` are the primary interface for users, encapsulating domain logic. The `Security Utility` is essential for authentication, a core cross-cutting concern. `JSON Unmarshalling Utility` and `Event Streaming Utility` are vital for handling diverse API response formats. Finally, `Hook Context Management` provides the necessary extensibility, aligning with the "Extensibility" principle mentioned in the project context. This set of components provides a clear, modular, and functional breakdown of the SDK's core responsibilities. + +### Service Modules [[Expand]](./Service_Modules.md) +These modules encapsulate the core API domain logic for specific functionalities like Chat, Completions, Dataset management, and Image processing. They provide high-level, domain-specific methods that abstract the underlying API interactions, supporting both asynchronous and synchronous operations. This component is central to the SDK's usability, offering a clear interface for developers to interact with different parts of the Friendli API. + + +**Related Classes/Methods**: + +- `friendli_core.chat.SyncChat`:18-372 +- `friendli_core.chat.AsyncChat`:375-729 +- `friendli_core.completions.SyncCompletions`:18-194 +- `friendli_core.completions.AsyncCompletions`:197-373 +- `friendli_core.dataset.SyncDataset`:19-1528 +- `friendli_core.dataset.AsyncDataset`:1531-3040 +- `friendli_core.image.SyncImage`:18-118 +- `friendli_core.image.AsyncImage`:121-221 + + +### Security Utility +Responsible for securely retrieving and managing API credentials, typically from environment variables or other configuration sources. This component ensures that API requests are properly authenticated. + + +**Related Classes/Methods**: + +- `friendli_core.utils.security.get_security_from_env`:57-69 + + +### JSON Unmarshalling Utility +Handles the deserialization of JSON responses received from the Friendli API into structured Python objects. This component is crucial for converting raw API data into usable formats within the SDK. + + +**Related Classes/Methods**: + +- `friendli_core.utils.unmarshal_json_response.unmarshal_json_response`:11-24 + + +### Event Streaming Utility +Provides mechanisms for processing and managing streaming responses from the API, particularly for operations that return continuous data streams (e.g., chat completions). It abstracts the complexities of handling server-sent events or similar streaming protocols. + + +**Related Classes/Methods**: + +- `friendli_core.utils.eventstreaming.EventStream`:19-42 +- `friendli_core.utils.eventstreaming.EventStreamAsync`:45-68 + + +### Hook Context Management +Manages an extensibility mechanism that allows developers to inject custom logic (hooks) at various points during the API interaction lifecycle. This component supports the SDK's extensibility, enabling custom pre-processing, post-processing, or error handling. + + +**Related Classes/Methods**: + +- `friendli_core._hooks.types.HookContext`:11-30 + + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) diff --git a/docs/architecture/on_boarding.md b/docs/architecture/on_boarding.md new file mode 100644 index 0000000..b4fbc00 --- /dev/null +++ b/docs/architecture/on_boarding.md @@ -0,0 +1,267 @@ +```mermaid +graph LR + Friendli_Client_Public_API_["Friendli Client (Public API)"] + SDK_Core["SDK Core"] + Service_Modules["Service Modules"] + Data_Models_Error_Handling["Data Models & Error Handling"] + Platform_Abstractions["Platform Abstractions"] + Hooks_Extensibility["Hooks & Extensibility"] + Friendli_Client_Public_API_ -- "delegates requests to" --> SDK_Core + SDK_Core -- "utilizes" --> Data_Models_Error_Handling + SDK_Core -- "adapts behavior based on" --> Platform_Abstractions + SDK_Core -- "integrates and consumes" --> Hooks_Extensibility + Service_Modules -- "utilize" --> SDK_Core + Service_Modules -- "rely on" --> Data_Models_Error_Handling + click Friendli_Client_Public_API_ href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Friendli_Client_Public_API_.md" "Details" + click SDK_Core href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/SDK_Core.md" "Details" + click Service_Modules href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Service_Modules.md" "Details" + click Data_Models_Error_Handling href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Data_Models_Error_Handling.md" "Details" + click Platform_Abstractions href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Platform_Abstractions.md" "Details" + click Hooks_Extensibility href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Hooks_Extensibility.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +One paragraph explaining the functionality which is represented by this graph. What the main flow is and what is its purpose. + +### Friendli Client (Public API) [[Expand]](./Friendli_Client_Public_API_.md) +The primary entry point for end-users, offering a high-level, consistent interface for interacting with the Friendli AI platform, supporting both synchronous and asynchronous operations. + + +**Related Classes/Methods**: + +- `friendli_core.sdk` + + +### SDK Core [[Expand]](./SDK_Core.md) +The central orchestrator managing fundamental logic for API communication, request/response processing, and integrating foundational SDK abstractions and extensibility points. + + +**Related Classes/Methods**: + +- `friendli_core.basesdk` + + +### Service Modules [[Expand]](./Service_Modules.md) +Encapsulate specific API domains (e.g., chat, completions, datasets), providing high-level, domain-specific methods that simplify interactions with particular parts of the Friendli API. + + +**Related Classes/Methods**: + +- `friendli_core.chat` +- `friendli_core.completions` +- `friendli_core.dataset` +- `friendli_core.image` + + +### Data Models & Error Handling [[Expand]](./Data_Models_Error_Handling.md) +Defines standardized data structures for API requests and responses, along with a comprehensive set of error types, ensuring consistent data representation and robust error reporting. + + +**Related Classes/Methods**: + +- `friendli_core.models` + + +### Platform Abstractions [[Expand]](./Platform_Abstractions.md) +Provides base structures and interfaces tailored for different operational modes or deployment types within the Friendli platform, enabling the SDK to adapt its behavior to the target environment. + + +**Related Classes/Methods**: + +- `friendli_core.dedicated` +- `friendli_core.serverless` + + +### Hooks & Extensibility [[Expand]](./Hooks_Extensibility.md) +Offers an extensible mechanism for injecting custom logic at various stages of the request/response lifecycle, allowing for pre-processing, post-processing, and error handling customization. + + +**Related Classes/Methods**: + +- `friendli_core._hooks` + + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq) +- [on_boarding.md](./on_boarding.md) + +_Last updated: 2025-08-30 20:26:36 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-09-06 20:25:32 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-09-13 20:27:42 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-09-20 20:28:14 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-09-27 20:30:20 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-10-04 20:31:16 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-10-11 20:28:27 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-10-18 20:31:42 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-10-25 20:31:31 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-11-08 20:30:16 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-11-15 20:35:14 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-11-22 20:33:01 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-11-29 20:36:48 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-12-06 20:34:16 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-12-13 20:34:17 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-12-20 20:34:05 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2025-12-27 20:35:57 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2026-01-03 20:39:50 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Hooks_Extensibility.md](./Hooks_Extensibility.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2026-01-10 20:36:29 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2026-01-17 20:36:12 UTC_ +- [Data_Models_Error_Handling.md](./Data_Models_Error_Handling.md) +- [Friendli_Client_Public_API_.md](./Friendli_Client_Public_API_.md) +- [Platform_Abstractions.md](./Platform_Abstractions.md) +- [SDK_Core.md](./SDK_Core.md) +- [Service_Modules.md](./Service_Modules.md) +- [overview.md](./overview.md) + +_Last updated: 2026-01-24 20:36:21 UTC_ diff --git a/docs/architecture/overview.md b/docs/architecture/overview.md new file mode 100644 index 0000000..1d62dc5 --- /dev/null +++ b/docs/architecture/overview.md @@ -0,0 +1,221 @@ +```mermaid +graph LR + Friendli_Client_Public_API_["Friendli Client (Public API)"] + SDK_Core["SDK Core"] + Service_Modules["Service Modules"] + Data_Models_Error_Handling["Data Models & Error Handling"] + Platform_Abstractions["Platform Abstractions"] + Hooks_Extensibility["Hooks & Extensibility"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Unclassified["Unclassified"] + Friendli_Client_Public_API_ -- "delegates requests to" --> SDK_Core + SDK_Core -- "utilizes" --> Data_Models_Error_Handling + SDK_Core -- "adapts behavior based on" --> Platform_Abstractions + SDK_Core -- "integrates and consumes" --> Hooks_Extensibility + Service_Modules -- "utilize" --> SDK_Core + Service_Modules -- "rely on" --> Data_Models_Error_Handling + click Friendli_Client_Public_API_ href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Friendli_Client_Public_API_.md" "Details" + click SDK_Core href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/SDK_Core.md" "Details" + click Service_Modules href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Service_Modules.md" "Details" + click Data_Models_Error_Handling href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Data_Models_Error_Handling.md" "Details" + click Platform_Abstractions href "https://github.com/CodeBoarding/friendli-python/blob/main/.codeboarding/Platform_Abstractions.md" "Details" +``` + +[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/CodeBoarding)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/diagrams)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org) + +## Details + +One paragraph explaining the functionality which is represented by this graph. What the main flow is and what is its purpose. + +### Friendli Client (Public API) [[Expand]](./Friendli_Client_Public_API_.md) +The primary entry point for end-users, offering a high-level, consistent interface for interacting with the Friendli AI platform, supporting both synchronous and asynchronous operations. + + +**Related Classes/Methods**: + +- `friendli_core.sdk` + + +### SDK Core [[Expand]](./SDK_Core.md) +The central orchestrator managing fundamental logic for API communication, request/response processing, and integrating foundational SDK abstractions and extensibility points. + + +**Related Classes/Methods**: + +- `friendli_core.basesdk` + + +### Service Modules [[Expand]](./Service_Modules.md) +Encapsulate specific API domains (e.g., chat, completions, datasets), providing high-level, domain-specific methods that simplify interactions with particular parts of the Friendli API. + + +**Related Classes/Methods**: + +- `friendli_core.chat` +- `friendli_core.completions` +- `friendli_core.dataset` +- `friendli_core.image` + + +### Data Models & Error Handling [[Expand]](./Data_Models_Error_Handling.md) +Defines standardized data structures for API requests and responses, along with a comprehensive set of error types, ensuring consistent data representation and robust error reporting. + + +**Related Classes/Methods**: + +- `friendli_core.models` + + +### Platform Abstractions [[Expand]](./Platform_Abstractions.md) +Provides base structures and interfaces tailored for different operational modes or deployment types within the Friendli platform, enabling the SDK to adapt its behavior to the target environment. + + +**Related Classes/Methods**: + +- `friendli_core.dedicated` +- `friendli_core.serverless` + + +### Hooks & Extensibility +Offers an extensible mechanism for injecting custom logic at various stages of the request/response lifecycle, allowing for pre-processing, post-processing, and error handling customization. + + +**Related Classes/Methods**: + +- `friendli_core._hooks` + + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + +### Unclassified +Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies) + + +**Related Classes/Methods**: _None_ + + + +### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq)