Skip to content

Commit

Permalink
pass key instead of rt
Browse files Browse the repository at this point in the history
  • Loading branch information
ssddOnTop committed Aug 11, 2024
1 parent 0d08b2d commit f4f803c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cli/generator/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl Generator {

if infer_type_names {
let mut llm_gen = InferTypeName::default();
let suggested_names = llm_gen.generate(config.config(), &self.runtime).await?;
let suggested_names = llm_gen.generate(config.config(), self.runtime.env.get("TAILCALL_SECRET")).await?;
let cfg = RenameTypes::new(suggested_names.iter())
.transform(config.config().to_owned())
.to_result()?;
Expand Down
6 changes: 3 additions & 3 deletions src/cli/llm/adapter.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::borrow::Cow;
use crate::core::runtime::TargetRuntime;

Check failure on line 2 in src/cli/llm/adapter.rs

View workflow job for this annotation

GitHub Actions / Check Examples

unused import: `crate::core::runtime::TargetRuntime`

Check failure on line 2 in src/cli/llm/adapter.rs

View workflow job for this annotation

GitHub Actions / Run Tests on linux-x64-musl

unused import: `crate::core::runtime::TargetRuntime`

Check failure on line 2 in src/cli/llm/adapter.rs

View workflow job for this annotation

GitHub Actions / Run Tests on linux-x64-gnu

unused import: `crate::core::runtime::TargetRuntime`

Check failure on line 2 in src/cli/llm/adapter.rs

View workflow job for this annotation

GitHub Actions / Run Tests on linux-arm64-musl

unused import: `crate::core::runtime::TargetRuntime`

Check failure on line 2 in src/cli/llm/adapter.rs

View workflow job for this annotation

GitHub Actions / Run Tests on linux-arm64-gnu

unused import: `crate::core::runtime::TargetRuntime`

Check failure on line 2 in src/cli/llm/adapter.rs

View workflow job for this annotation

GitHub Actions / Run Tests on darwin-x64

unused import: `crate::core::runtime::TargetRuntime`

Check failure on line 2 in src/cli/llm/adapter.rs

View workflow job for this annotation

GitHub Actions / Run Tests on darwin-arm64

unused import: `crate::core::runtime::TargetRuntime`

Check failure on line 2 in src/cli/llm/adapter.rs

View workflow job for this annotation

GitHub Actions / Run Tests on linux-ia32-gnu

unused import: `crate::core::runtime::TargetRuntime`

Check failure on line 2 in src/cli/llm/adapter.rs

View workflow job for this annotation

GitHub Actions / Run Tests on win32-x64-msvc

unused import: `crate::core::runtime::TargetRuntime`

Check failure on line 2 in src/cli/llm/adapter.rs

View workflow job for this annotation

GitHub Actions / Run Tests on win32-ia32-msvc

unused import: `crate::core::runtime::TargetRuntime`

pub struct Adapter {}

impl Adapter {
pub fn config(rt: &TargetRuntime) -> genai::adapter::AdapterConfig {
let env_key = rt.env.get("TAILCALL_SECRET");
pub fn config(key: Option<Cow<str>>) -> genai::adapter::AdapterConfig {
let mut config = genai::adapter::AdapterConfig::default();
if let Some(key) = env_key {
if let Some(key) = key {
config = config.with_auth_env_name(key);
}
config
Expand Down
5 changes: 3 additions & 2 deletions src/cli/llm/infer_type_name.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::borrow::Cow;
use std::collections::HashMap;

use genai::chat::{ChatMessage, ChatRequest, ChatResponse};
Expand Down Expand Up @@ -77,10 +78,10 @@ impl InferTypeName {
pub async fn generate(
&mut self,
config: &Config,
runtime: &TargetRuntime,
auth_key: Option<Cow<str>>,

Check failure on line 81 in src/cli/llm/infer_type_name.rs

View workflow job for this annotation

GitHub Actions / Check Examples

implicit elided lifetime not allowed here

Check failure on line 81 in src/cli/llm/infer_type_name.rs

View workflow job for this annotation

GitHub Actions / Run Tests on linux-x64-musl

implicit elided lifetime not allowed here

Check failure on line 81 in src/cli/llm/infer_type_name.rs

View workflow job for this annotation

GitHub Actions / Run Tests on linux-x64-gnu

implicit elided lifetime not allowed here

Check failure on line 81 in src/cli/llm/infer_type_name.rs

View workflow job for this annotation

GitHub Actions / Run Tests on linux-arm64-musl

implicit elided lifetime not allowed here

Check failure on line 81 in src/cli/llm/infer_type_name.rs

View workflow job for this annotation

GitHub Actions / Run Tests on linux-arm64-gnu

implicit elided lifetime not allowed here

Check failure on line 81 in src/cli/llm/infer_type_name.rs

View workflow job for this annotation

GitHub Actions / Run Tests on darwin-x64

implicit elided lifetime not allowed here

Check failure on line 81 in src/cli/llm/infer_type_name.rs

View workflow job for this annotation

GitHub Actions / Run Tests on darwin-arm64

implicit elided lifetime not allowed here

Check failure on line 81 in src/cli/llm/infer_type_name.rs

View workflow job for this annotation

GitHub Actions / Run Tests on linux-ia32-gnu

implicit elided lifetime not allowed here

Check failure on line 81 in src/cli/llm/infer_type_name.rs

View workflow job for this annotation

GitHub Actions / Run Tests on win32-x64-msvc

implicit elided lifetime not allowed here

Check failure on line 81 in src/cli/llm/infer_type_name.rs

View workflow job for this annotation

GitHub Actions / Run Tests on win32-ia32-msvc

implicit elided lifetime not allowed here
) -> Result<HashMap<String, String>> {
let wizard: Wizard<Question, Answer> =
Wizard::new(Model::GROQ.llama38192(), Adapter::config(runtime));
Wizard::new(Model::GROQ.llama38192(), Adapter::config(auth_key));

let mut new_name_mappings: HashMap<String, String> = HashMap::new();

Expand Down

0 comments on commit f4f803c

Please sign in to comment.