You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+12-8Lines changed: 12 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,21 +39,25 @@ We focus on being a **precision thin layer**—prioritizing raw API fidelity, re
39
39
40
40
This library is part of the `rain` ecosystem. To maintain consistency across clients (e.g., `ollama-client-rs`), we adhere to a shared set of interface patterns:
41
41
42
-
1.**Builder Pattern**: Clients should always implement `new`, `with_client`, and `with_api_url`.
43
-
2.**Pinned Streams**: All streaming methods must return `Pin<Box<dyn Stream>>` to simplify caller integration.
44
-
3.**Standardized Telemetry**: Use the internal `telemetry_*!` macros. Never use raw `tracing` calls directly in the client logic.
45
-
4.**Error Mapping**: Maintain a flat, descriptive `GeminiError` enum using `thiserror`.
42
+
1.**Macro-First DX**: Prioritize declarative request building via procedural macros (`gemini_chat!`, `gemini_parts!`).
43
+
2.**Standardized Schema Generation**: All structured outputs should use the `GeminiSchema` derive macro.
44
+
3.**Builder Pattern**: Clients should always implement `new`, `with_client`, and `with_api_url`.
45
+
4.**Pinned Streams**: All streaming methods must return `Pin<Box<dyn Stream>>` to simplify caller integration.
46
+
5.**Standardized Telemetry**: Use the internal `telemetry_*!` macros.
47
+
6.**Error Mapping**: Maintain a flat, descriptive `GeminiError` enum using `thiserror`.
46
48
47
49
---
48
50
49
51
## 🛠️ Architectural Philosophy
50
52
51
53
When contributing to the core client, adhere to these principles:
52
54
53
-
1.**Thin Layer Philosophy**: The client is a transport and mapping layer. Avoid adding complex state machines, orchestration logic, or "agentic" capabilities. These belong in higher-level crates (like `rain`).
54
-
2.**Transparent Proxy**: Preserving byte-for-byte fidelity and API structure is a priority. Avoid abstractions that hide underlying API features.
55
-
3.**Rust Type Safety**: Leverage Rust's type system to make API constraints (like `TaskType` or `FinishReason`) explicit and compile-time safe.
56
-
4.**Zero-Overhead Abstractions**: Ensure the mapping from request structs to JSON is efficient and follows the public API documentation precisely.
55
+
1.**Thin Layer Foundation**: The core client is a transport and mapping layer. Avoid adding complex state machines or orchestration logic.
56
+
2.**Ergonomic Macro Overlay**: Provide a best-in-class developer experience via macros that simplify common tasks (e.g., chat construction, tool declaration).
57
+
3.**Transparent Proxy**: Preserving byte-for-byte fidelity and API structure in the core types is a priority.
58
+
4.**Rust Type Safety**: Leverage Rust's type system to make API constraints explicit and compile-time safe.
59
+
5.**Zero-Overhead Abstractions**: Ensure the mapping from macros to request structs is efficient.
0 commit comments