From 35d13abdfe57c4868d9ab3922dcd7ac58774679b Mon Sep 17 00:00:00 2001 From: Pascal Bach Date: Tue, 14 Jan 2025 22:19:15 +0100 Subject: [PATCH] . fix links to c03 examples (#37) The example was renamed from c03-kind.rs to c03-mapper.rs --- README.md | 20 ++++++++++---------- examples/c00-readme.rs | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0c7f3d1..95b5729 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,11 @@ Check out [devai.run](https://devai.run), the **Iterate to Automate** command-li ## Key Features -- Native Multi-AI Provider/Model: OpenAI, Anthropic, Gemini, Ollama, Groq, xAI, DeepSeek (Direct chat and stream) (see [examples/c00-readme.rs](examples/c00-readme.rs)) -- Image Analysis (for OpenAI, Gemini flash-2, Anthropic) (see [examples/c07-image.rs](examples/c07-image.rs)) -- Custom Auth/API Key (see [examples/c02-auth.rs](examples/c02-auth.rs)) -- Model Alias (see [examples/c05-model-names.rs](examples/c05-model-names.rs)) -- Custom Endpoint, Auth, and Model Identifier (see [examples/c06-target-resolver.rs](examples/c06-target-resolver.rs)) +- Native Multi-AI Provider/Model: OpenAI, Anthropic, Gemini, Ollama, Groq, xAI, DeepSeek (Direct chat and stream) (see [examples/c00-readme.rs](examples/c00-readme.rs)) +- Image Analysis (for OpenAI, Gemini flash-2, Anthropic) (see [examples/c07-image.rs](examples/c07-image.rs)) +- Custom Auth/API Key (see [examples/c02-auth.rs](examples/c02-auth.rs)) +- Model Alias (see [examples/c05-model-names.rs](examples/c05-model-names.rs)) +- Custom Endpoint, Auth, and Model Identifier (see [examples/c06-target-resolver.rs](examples/c06-target-resolver.rs)) [Examples](#examples) | [Thanks](#thanks) | [Library Focus](#library-focus) | [Changelog](CHANGELOG.md) | Provider Mapping: [ChatOptions](#chatoptions) | [MetaUsage](#metausage) @@ -77,7 +77,7 @@ const MODEL_AND_KEY_ENV_NAME_LIST: &[(&str, &str)] = &[ // - model in Groq models -> Groq // - For anything else -> Ollama // -// This can be customized; see `examples/c03-kind.rs` +// This can be customized; see `examples/c03-mapper.rs` #[tokio::main] async fn main() -> Result<(), Box> { @@ -126,7 +126,7 @@ async fn main() -> Result<(), Box> { - [examples/c00-readme.rs](examples/c00-readme.rs) - Quick overview code with multiple providers and streaming. - [examples/c01-conv.rs](examples/c01-conv.rs) - Shows how to build a conversation flow. - [examples/c02-auth.rs](examples/c02-auth.rs) - Demonstrates how to provide a custom `AuthResolver` to provide auth data (i.e., for api_key) per adapter kind. -- [examples/c03-kind.rs](examples/c03-kind.rs) - Demonstrates how to provide a custom `AdapterKindResolver` to customize the "model name" to "adapter kind" mapping. +- [examples/c03-mapper.rs](examples/c03-mapper.rs) - Demonstrates how to provide a custom `AdapterKindResolver` to customize the "model name" to "adapter kind" mapping. - [examples/c04-chat-options.rs](examples/c04-chat-options.rs) - Demonstrates how to set chat generation options such as `temperature` and `max_tokens` at the client level (for all requests) and per request level. - [examples/c05-model-names.rs](examples/c05-model-names.rs) - Show how to get model names per AdapterKind. - [examples/c06-target-resolver.rs](examples/c06-target-resolver.rs) - For custom Auth, EndPoint, and Model. @@ -147,7 +147,7 @@ async fn main() -> Result<(), Box> { - [(part 1/3) Module, Error, constructors/builders](https://www.youtube.com/watch?v=XCrZleaIUO4&list=PL7r-PXl6ZPcBcLsBdBABOFUuLziNyigqj) - [(part 2/3) Extension Traits, Project Files, Versioning](https://www.youtube.com/watch?v=LRfDAZfo00o&list=PL7r-PXl6ZPcBcLsBdBABOFUuLziNyigqj) - [(part 3/3) When to Async? Project Files, Versioning strategy](https://www.youtube.com/watch?v=93SS3VGsKx4&list=PL7r-PXl6ZPcCIOFaL7nVHXZvBmHNhrh_Q) - + ## Thanks - Thanks to [@AdamStrojek](https://github.com/AdamStrojek) for initial image support [PR #36](https://github.com/jeremychone/rust-genai/pull/36) @@ -162,7 +162,7 @@ async fn main() -> Result<(), Box> { - Focuses on standardizing chat completion APIs across major AI Services. -- Native implementation, meaning no per-service SDKs. +- Native implementation, meaning no per-service SDKs. - Reason: While there are some variations between all of the various APIs, they all follow the same pattern and high-level flow and constructs. Managing the differences at a lower layer is actually simpler and more cumulative accross services than doing sdks gymnastic. - Prioritizes ergonomics and commonality, with depth being secondary. (If you require complete client API, consider using [async-openai](https://crates.io/search?q=async-openai) and [ollama-rs](https://crates.io/crates/ollama-rs); they are both excellent and easy to use.) @@ -191,7 +191,7 @@ async fn main() -> Result<(), Box> { > **Note (1)**: At this point, `Ollama` does not emit input/output tokens when streaming due to the Ollama OpenAI compatibility layer limitation. (see [ollama #4448 - Streaming Chat Completion via OpenAI API should support stream option to include Usage](https://github.com/ollama/ollama/issues/4448)) -> **Note (2)** Right now, with [Gemini Stream API](https://ai.google.dev/api/rest/v1beta/models/streamGenerateContent), it's not really clear if the usage for each event is cumulative or needs to be added. Currently, it appears to be cumulative (i.e., the last message has the total amount of input, output, and total tokens), so that will be the assumption. See [possible tweet answer](https://twitter.com/jeremychone/status/1813734565967802859) for more info. +> **Note (2)** Right now, with [Gemini Stream API](https://ai.google.dev/api/rest/v1beta/models/streamGenerateContent), it's not really clear if the usage for each event is cumulative or needs to be added. Currently, it appears to be cumulative (i.e., the last message has the total amount of input, output, and total tokens), so that will be the assumption. See [possible tweet answer](https://twitter.com/jeremychone/status/1813734565967802859) for more info. ## Notes on Possible Direction diff --git a/examples/c00-readme.rs b/examples/c00-readme.rs index 433352b..f11fd64 100644 --- a/examples/c00-readme.rs +++ b/examples/c00-readme.rs @@ -35,7 +35,7 @@ const MODEL_AND_KEY_ENV_NAME_LIST: &[(&str, &str)] = &[ // - model in Groq models -> Groq // - For anything else -> Ollama // -// This can be customized; see `examples/c03-kind.rs` +// This can be customized; see `examples/c03-mapper.rs` #[tokio::main] async fn main() -> Result<(), Box> {