Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextSynth support #1919

Merged
merged 3 commits into from
Oct 2, 2023
Merged

TextSynth support #1919

merged 3 commits into from
Oct 2, 2023

Conversation

spolu
Copy link
Contributor

@spolu spolu commented Oct 2, 2023

Adds support for provider textsynth with models to be used in llm blocks.

First pass:

  • No chat
  • No streaming
  • No tokenization

Will tackle these in subsequent PRs.

Screenshot from 2023-10-02 15-38-17

@spolu spolu changed the title [WIP] TextSynth support TextSynth support Oct 2, 2023
@spolu spolu requested a review from fontanierh October 2, 2023 13:40
fontanierh
fontanierh previously approved these changes Oct 2, 2023
Copy link
Contributor

@fontanierh fontanierh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good !


let response = match status {
hyper::StatusCode::OK => {
// print content of c
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copilot prompt to cleanup

Some(api_key) => {
self.api_key = Some(api_key.clone());
}
None => match tokio::task::spawn_blocking(|| std::env::var("TEXTSYNTH_API_KEY")).await?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need spawn blocking ? Would have expected this to not be cpu bound

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this is cargo-culted... we can clean-up everywhere. The thing is that std::env::var is kinda blocking but we can probably optimize

if m == -1 {
let tokens = self.encode(prompt).await?;
max_tokens = Some((self.context_size() - tokens.len()) as i32);
// println!("Using max_tokens = {}", max_tokens.unwrap());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

@spolu spolu merged commit bdc7252 into main Oct 2, 2023
1 check passed
@spolu spolu deleted the spolu-textsynth branch October 2, 2023 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants