Skip to content

Commit 1f2f15d

Browse files
committed
subcrates, p2p done, todo models
1 parent 68c7719 commit 1f2f15d

37 files changed

+894
-99
lines changed

Cargo.lock

Lines changed: 28 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
[package]
2-
name = "dkn-compute"
3-
version = "0.2.10"
1+
[workspace]
2+
resolver = "2"
3+
members = ["compute", "p2p", "workflows"]
4+
default-members = ["compute"]
5+
6+
[workspace.package]
47
edition = "2021"
58
license = "Apache-2.0"
6-
readme = "README.md"
7-
authors = ["Erhan Tezcan <[email protected]>"]
8-
9-
# profiling build for flamegraphs
10-
[profile.profiling]
11-
inherits = "release"
12-
debug = true
139

14-
[features]
15-
# used by flamegraphs & instruments
16-
profiling = []
10+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1711

18-
[dependencies]
12+
[workspace.dependencies]
1913
tokio-util = { version = "0.7.10", features = ["rt"] }
2014
tokio = { version = "1", features = ["macros", "rt-multi-thread", "signal"] }
2115
parking_lot = "0.12.2"
@@ -24,55 +18,6 @@ serde_json = "1.0"
2418
async-trait = "0.1.81"
2519
reqwest = "0.12.5"
2620

27-
# utilities
28-
dotenvy = "0.15.7"
29-
base64 = "0.22.0"
30-
hex = "0.4.3"
31-
hex-literal = "0.4.1"
32-
url = "2.5.0"
33-
urlencoding = "2.1.3"
34-
uuid = { version = "1.8.0", features = ["v4"] }
35-
rand = "0.8.5"
36-
37-
# logging & errors
3821
env_logger = "0.11.3"
3922
log = "0.4.21"
4023
eyre = "0.6.12"
41-
42-
# encryption (ecies) & signatures (ecdsa) & hashing & bloom-filters
43-
ecies = { version = "0.2", default-features = false, features = ["pure"] }
44-
libsecp256k1 = "0.7.1"
45-
sha2 = "0.10.8"
46-
sha3 = "0.10.8"
47-
fastbloom-rs = "0.5.9"
48-
49-
# workflows
50-
ollama-workflows = { git = "https://github.com/andthattoo/ollama-workflows" }
51-
52-
# peer-to-peer
53-
libp2p = { git = "https://github.com/anilaltuner/rust-libp2p.git", rev = "7ce9f9e", features = [
54-
# libp2p = { version = "0.54.1", features = [
55-
"dcutr",
56-
"ping",
57-
"relay",
58-
"autonat",
59-
"identify",
60-
"tokio",
61-
"gossipsub",
62-
"mdns",
63-
"noise",
64-
"macros",
65-
"tcp",
66-
"yamux",
67-
"quic",
68-
"kad",
69-
] }
70-
libp2p-identity = { version = "0.2.9", features = ["secp256k1"] }
71-
tracing = { version = "0.1.40" }
72-
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
73-
port_check = "0.2.1"
74-
75-
# Vendor OpenSSL so that its easier to build cross-platform packages
76-
[dependencies.openssl]
77-
version = "*"
78-
features = ["vendored"]

compute/Cargo.toml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
[package]
2+
name = "dkn-compute"
3+
version = "0.2.10"
4+
edition.workspace = true
5+
license.workspace = true
6+
readme = "README.md"
7+
authors = [
8+
"Erhan Tezcan <[email protected]>",
9+
"Anil Altuner <[email protected]",
10+
]
11+
12+
# profiling build for flamegraphs
13+
[profile.profiling]
14+
inherits = "release"
15+
debug = true
16+
17+
[features]
18+
# used by flamegraphs & instruments
19+
profiling = []
20+
21+
[dependencies]
22+
tokio-util = { version = "0.7.10", features = ["rt"] }
23+
tokio = { version = "1", features = ["macros", "rt-multi-thread", "signal"] }
24+
parking_lot = "0.12.2"
25+
serde = { version = "1.0", features = ["derive"] }
26+
serde_json = "1.0"
27+
async-trait = "0.1.81"
28+
reqwest = "0.12.5"
29+
30+
# utilities
31+
dotenvy = "0.15.7"
32+
base64 = "0.22.0"
33+
hex = "0.4.3"
34+
hex-literal = "0.4.1"
35+
url = "2.5.0"
36+
urlencoding = "2.1.3"
37+
uuid = { version = "1.8.0", features = ["v4"] }
38+
rand = "0.8.5"
39+
port_check = "0.2.1"
40+
41+
# logging & errors
42+
env_logger.workspace = true
43+
log.workspace = true
44+
eyre.workspace = true
45+
tracing = { version = "0.1.40" }
46+
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
47+
48+
# encryption (ecies) & signatures (ecdsa) & hashing & bloom-filters
49+
ecies = { version = "0.2", default-features = false, features = ["pure"] }
50+
libsecp256k1 = "0.7.1"
51+
sha2 = "0.10.8"
52+
sha3 = "0.10.8"
53+
fastbloom-rs = "0.5.9"
54+
55+
# workflows
56+
ollama-workflows = { git = "https://github.com/andthattoo/ollama-workflows" }
57+
58+
# p2p
59+
dkn-p2p = { path = "../p2p" }
60+
61+
# Vendor OpenSSL so that its easier to build cross-platform packages
62+
[dependencies.openssl]
63+
version = "*"
64+
features = ["vendored"]
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/config/mod.rs renamed to compute/src/config/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ mod ollama;
33
mod openai;
44

55
use crate::utils::{address_in_use, crypto::to_address};
6+
use dkn_p2p::libp2p::Multiaddr;
67
use eyre::{eyre, Result};
7-
use libp2p::Multiaddr;
88
use libsecp256k1::{PublicKey, SecretKey};
99
use models::ModelConfig;
1010
use ollama::OllamaConfig;
File renamed without changes.
File renamed without changes.

src/config/openai.rs renamed to compute/src/config/openai.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
#![allow(unused)]
2-
31
use eyre::{eyre, Context, Result};
42
use ollama_workflows::Model;
53
use serde::Deserialize;
64

7-
const OPENAI_API_KEY: &str = "OPENAI_API_KEY";
8-
95
const OPENAI_MODELS_API: &str = "https://api.openai.com/v1/models";
106

117
/// [Model](https://platform.openai.com/docs/api-reference/models/object) API object.
@@ -14,16 +10,20 @@ struct OpenAIModel {
1410
/// The model identifier, which can be referenced in the API endpoints.
1511
id: String,
1612
/// The Unix timestamp (in seconds) when the model was created.
13+
#[allow(unused)]
1714
created: u64,
1815
/// The object type, which is always "model".
16+
#[allow(unused)]
1917
object: String,
2018
/// The organization that owns the model.
19+
#[allow(unused)]
2120
owned_by: String,
2221
}
2322

2423
#[derive(Debug, Clone, Deserialize)]
2524
struct OpenAIModelsResponse {
2625
data: Vec<OpenAIModel>,
26+
#[allow(unused)]
2727
object: String,
2828
}
2929

@@ -35,7 +35,7 @@ pub struct OpenAIConfig {
3535
impl OpenAIConfig {
3636
/// Looks at the environment variables for OpenAI API key.
3737
pub fn new() -> Self {
38-
let api_key = std::env::var(OPENAI_API_KEY).ok();
38+
let api_key = std::env::var("OPENAI_API_KEY").ok();
3939

4040
Self { api_key }
4141
}

0 commit comments

Comments
 (0)