-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved embedding out into its own file, fixed ui running
- Loading branch information
Showing
36 changed files
with
343 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
toolchain/chidori-core/package_node/types/ChatCompletionReq.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
toolchain/chidori-core/package_node/types/SupportedLanguage.ts
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
toolchain/chidori-core/package_node/types/SupportedMemoryProviders.ts
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
toolchain/chidori-core/package_node/types/SupportedModelProviders.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
toolchain/chidori-core/package_node/types/WebserviceCellEndpoint.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[project] | ||
name = "chidori-core" | ||
version = "1.0.0" | ||
description = "" | ||
authors = [{ name = "Colton Pierson", email = "[email protected]" }] | ||
dependencies = [ | ||
] | ||
readme = "README.md" | ||
requires-python = "== 3.11" | ||
|
||
[tool.rye] | ||
managed = true | ||
virtual = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
use futures_util::FutureExt; | ||
use crate::cells::{LLMEmbeddingCell, LLMPromptCell}; | ||
use crate::execution::primitives::operation::{InputItemConfiguration, InputSignature, InputType, OperationFnOutput, OperationNode, OutputItemConfiguration, OutputSignature}; | ||
use crate::library::std::ai::llm::ai_llm_run_embedding_model; | ||
|
||
#[tracing::instrument] | ||
pub fn llm_embedding_cell(cell: &LLMEmbeddingCell) -> OperationNode { | ||
let LLMEmbeddingCell { | ||
function_invocation, | ||
configuration, | ||
req, | ||
name, | ||
.. | ||
} = cell; | ||
let schema = | ||
chidori_prompt_format::templating::templates::analyze_referenced_partials(&&req); | ||
let mut role_blocks = | ||
chidori_prompt_format::templating::templates::extract_roles_from_template(&&req); | ||
|
||
let mut output_signature = OutputSignature::new(); | ||
if let Some(name) = name { | ||
output_signature.functions.insert( | ||
name.clone(), | ||
OutputItemConfiguration::Value, | ||
); | ||
} | ||
|
||
let mut input_signature = InputSignature::new(); | ||
|
||
// We only require the globals to be passed in if the user has not specified this prompt as a function | ||
if configuration.get("fn").is_none() { | ||
for (key, value) in &schema.items { | ||
input_signature.globals.insert( | ||
key.clone(), | ||
InputItemConfiguration { | ||
ty: Some(InputType::String), | ||
default: None, | ||
}, | ||
); | ||
} | ||
} | ||
|
||
let (_, template) = role_blocks.drain(..).next().unwrap(); | ||
let template = template.expect("Must include template"); | ||
let name = name.clone(); | ||
let is_function_invocation = function_invocation.clone(); | ||
OperationNode::new( | ||
name.clone(), | ||
input_signature, | ||
output_signature, | ||
Box::new(move |s, x, _, _| { | ||
let template = template.clone(); | ||
let name = name.clone(); | ||
let s = s.clone(); | ||
async move { | ||
OperationFnOutput::with_value(ai_llm_run_embedding_model(&s, x, template, name.clone(), is_function_invocation).await) | ||
}.boxed() | ||
}), | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.