Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
bbca015
chore(release): 🔖 0.7.1-rc.1 [skip ci]
edenreich Feb 8, 2025
cdf6eca
fix: Enhance Tool and ToolFunction structures with description and pa…
edenreich Feb 9, 2025
62b7463
chore(release): 🔖 0.7.1-rc.2 [skip ci]
edenreich Feb 9, 2025
0e4d1b4
refactor: Remove ToolParameterType and ToolParameter structs to simpl…
edenreich Feb 9, 2025
3f36c5f
refactor: Rename parameters to arguments in ToolFunctionResponse and …
edenreich Feb 9, 2025
0fc63e0
chore(release): 🔖 0.7.1-rc.3 [skip ci]
edenreich Feb 9, 2025
d51e911
feat: Add optional tool_call_id to Message struct and update serializ…
edenreich Feb 9, 2025
935609c
chore(release): 🔖 0.8.0-rc.1 [skip ci]
edenreich Feb 9, 2025
4edcd4b
test: Add assertion for tool_calls length in response test
edenreich Feb 9, 2025
9e5f5da
docs: Improve the docs for Tool-Use, update it
edenreich Feb 9, 2025
b666c33
docs: Enhance InferenceGatewayAPI docblocks with additional error han…
edenreich Feb 9, 2025
422e857
docs: Remove redundant whitespace in InferenceGatewayAPI documentation
edenreich Feb 10, 2025
9c56170
refactor: Initialize the client with tools optionally
edenreich Feb 10, 2025
cb43ca8
refactor: Implement Default trait for Message and MessageRole structs
edenreich Feb 10, 2025
eef16e8
refactor: Use in the tests two different conventions to see what's po…
edenreich Feb 10, 2025
0fda0dc
docs: Update the example in the README.md
edenreich Feb 10, 2025
e6eb55d
docs: Resort functions examples, healthcheck is less important so put…
edenreich Feb 10, 2025
ef474b4
docs: Improve the example by mentioning the workflow of messages exch…
edenreich Feb 10, 2025
223395c
chore(release): 🔖 0.8.0-rc.2 [skip ci]
edenreich Feb 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
# Changelog

All notable changes to this project will be documented in this file.

## [0.8.0-rc.2](https://github.com/inference-gateway/rust-sdk/compare/0.8.0-rc.1...0.8.0-rc.2) (2025-02-10)

### ♻️ Improvements

* Implement Default trait for Message and MessageRole structs ([cb43ca8](https://github.com/inference-gateway/rust-sdk/commit/cb43ca8034cec51bb4037e21dd1be9a8ce7312f3))
* Initialize the client with tools optionally ([9c56170](https://github.com/inference-gateway/rust-sdk/commit/9c56170a17939b7ecf8a71ae04425313cf97727c))
* Use in the tests two different conventions to see what's possible ([eef16e8](https://github.com/inference-gateway/rust-sdk/commit/eef16e8afedd2b28a2a54aa25f2364adfe11973b))

### 📚 Documentation

* Enhance InferenceGatewayAPI docblocks with additional error handling and return details ([b666c33](https://github.com/inference-gateway/rust-sdk/commit/b666c3338d81e193396d43d927a5b09569f70752))
* Improve the docs for Tool-Use, update it ([9e5f5da](https://github.com/inference-gateway/rust-sdk/commit/9e5f5da14120b553ef045502dd704be5dcccd67f))
* Improve the example by mentioning the workflow of messages exchange ([ef474b4](https://github.com/inference-gateway/rust-sdk/commit/ef474b427fd28527b589d7ff966acda4ea1d3cec))
* Remove redundant whitespace in InferenceGatewayAPI documentation ([422e857](https://github.com/inference-gateway/rust-sdk/commit/422e8571c862547bf78aa2415528bf0814084319))
* Resort functions examples, healthcheck is less important so put it at the bottom ([e6eb55d](https://github.com/inference-gateway/rust-sdk/commit/e6eb55d89a32a39603496303ed2b4d05b8bbf885))
* Update the example in the README.md ([0fda0dc](https://github.com/inference-gateway/rust-sdk/commit/0fda0dc4dbed741dbfe8b62197ed6aea43e6b9e5))

### ✅ Miscellaneous

* Add assertion for tool_calls length in response test ([4edcd4b](https://github.com/inference-gateway/rust-sdk/commit/4edcd4b43e64bca6a1ac1856e8e57c4eabd0e0a8))

## [0.8.0-rc.1](https://github.com/inference-gateway/rust-sdk/compare/0.7.1-rc.3...0.8.0-rc.1) (2025-02-09)

### ✨ Features

* Add optional tool_call_id to Message struct and update serialization tests ([d51e911](https://github.com/inference-gateway/rust-sdk/commit/d51e9115bbcd4fb5f098e99dfda9f11c00febf07))

## [0.7.1-rc.3](https://github.com/inference-gateway/rust-sdk/compare/0.7.1-rc.2...0.7.1-rc.3) (2025-02-09)

### ♻️ Improvements

* Remove ToolParameterType and ToolParameter structs to simplify code ([0e4d1b4](https://github.com/inference-gateway/rust-sdk/commit/0e4d1b4a0519adb1c23dc5f25f841af72e7c6527))
* Rename parameters to arguments in ToolFunctionResponse and update ToolCallResponse structure ([3f36c5f](https://github.com/inference-gateway/rust-sdk/commit/3f36c5f969a7b46417613c9fd11f1760d841ff76))

## [0.7.1-rc.2](https://github.com/inference-gateway/rust-sdk/compare/0.7.1-rc.1...0.7.1-rc.2) (2025-02-09)

### 🐛 Bug Fixes

* Enhance Tool and ToolFunction structures with description and parameters updates, use JSON raw value for now ([cdf6eca](https://github.com/inference-gateway/rust-sdk/commit/cdf6eca712c07003841cea55d57ae62cfa3bca2b))

## [0.7.1-rc.1](https://github.com/inference-gateway/rust-sdk/compare/0.7.0...0.7.1-rc.1) (2025-02-08)

### ♻️ Improvements

* Remove tool_calls from Message struct and update related tests ([265bdec](https://github.com/inference-gateway/rust-sdk/commit/265bdec49b9a4394cb78e0bf286f0c267a9a3b06))

### 👷 CI

* Improve the Release Process Allowing to have Release Candidates ([#3](https://github.com/inference-gateway/rust-sdk/issues/3)) ([b97e5da](https://github.com/inference-gateway/rust-sdk/commit/b97e5da228ccfa8719f0211a0a28fa344bf4954c))

### 📚 Documentation

* Remove unnecessary code block from README.md ([dcb7c26](https://github.com/inference-gateway/rust-sdk/commit/dcb7c26493be82790615b7434acbf3ddb13b4fc1))

## [0.7.0](https://github.com/inference-gateway/rust-sdk/compare/0.6.3...0.7.0) (2025-02-07)

### ✨ Features
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "inference-gateway-sdk"
version = "0.7.0"
version = "0.8.0-rc.2"
edition = "2021"
description = "Rust SDK for interacting with various language models through the Inference Gateway"
license = "MIT"
Expand Down
91 changes: 57 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ An SDK written in Rust for the [Inference Gateway](https://github.com/inference-
- [Listing Models from a specific provider](#listing-models-from-a-specific-provider)
- [Generating Content](#generating-content)
- [Streaming Content](#streaming-content)
- [Health Check](#health-check)
- [Tool-Use](#tool-use)
- [Health Check](#health-check)
- [Contributing](#contributing)
- [License](#license)

Expand Down Expand Up @@ -193,10 +193,12 @@ use futures_util::{StreamExt, pin_mut};
Message {
role: MessageRole::System,
content: system_message,
tool_call_id: None
},
Message {
role: MessageRole::User,
content: "Write a poem".to_string(),
tool_call_id: None
},
];
let client = InferenceGatewayClient::new("http://localhost:8080");
Expand Down Expand Up @@ -224,19 +226,6 @@ use futures_util::{StreamExt, pin_mut};
// ...rest of the main function
```

### Health Check

To check if the Inference Gateway is running, use the `health_check` method:

```rust
// ...rest of the imports
use log::info;

// ...main function
let is_healthy = client.health_check().await?;
info!("API is healthy: {}", is_healthy);
```

### Tool-Use

You can pass to the generate_content function also tools, which will be available for the LLM to use:
Expand All @@ -250,33 +239,67 @@ use inference_gateway_sdk::{
Provider,
MessageRole,
Tool,
ToolType,
ToolParameters,
ToolParameterType,
ToolFunction,
ToolType
};

let resp = client.generate_content(Provider::Groq, "deepseek-r1-distill-llama-70b", vec![
Message{
role: MessageRole::System,
content: "You are an helpful assistent.".to_string()
},
Message{
role: MessageRole::User,
content: "What is the current weather in Berlin?".to_string()
}
], vec![
let tools = vec![
Tool {
r#type: ToolType::Function,
name: "get_current_weather".to_string(),
description: "Get the weather for a location".to_string(),
parameters: ToolParameters {
name: "location".to_string(),
r#type: ToolParameterType::String,
default: None,
description: "The city name".to_string(),
function: ToolFunction {
name: "get_current_weather".to_string(),
description: "Get the weather for a location".to_string(),
parameters: json!({
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name"
}
},
"required": ["location"]
}),
},
},
];
let resp = client.with_tools(Some(tools)).generate_content(Provider::Groq, "deepseek-r1-distill-llama-70b", vec![
Message {
role: MessageRole::System,
content: "You are an helpful assistent.".to_string(),
..Default::default()
},
Message {
role: MessageRole::User,
content: "What is the current weather in Berlin?".to_string(),
..Default::default()
}
]).await?;

for tool_call in resp.response.tool_calls {
log::info!("Tool Call Requested by the LLM: {:?}", tool_call);
// Make the function call with the parameters requested by the LLM

let message = Message {
role: MessageRole::Tool,
content: "The content from the tool".to_string(),
tool_call_id: Some(tool_call.id) // the tool call id so the LLM can reference it
};

// Append this message to the next request
}
```

### Health Check

To check if the Inference Gateway is running, use the `health_check` method:

```rust
// ...rest of the imports
use log::info;

// ...main function
let is_healthy = client.health_check().await?;
info!("API is healthy: {}", is_healthy);
```

## Contributing
Expand Down
Loading