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

#15 Add pluggable backends and stop relying on every-ai #26

Closed
wants to merge 1 commit into from

Conversation

tm-kn
Copy link
Member

@tm-kn tm-kn commented Nov 16, 2023

May be easier to just review #27 as that PR includes all those changes and a few updates.

#15

  • Stop relying on every-ai.
  • Instead, implement an interface that's specific to wagtail-ai and allow for any other library to be used.
  • Implement a backend that uses https://github.com/simonw/llm instead of every-ai.
  • Implement a test echo backend.

I still have not considered how #17 and using non-OpenAI models would work but that'd be the next step. I think making this extensible/pluggable feels like a natural first step.

for param_key, param_val in self.llm_prompt_params.items():
kwargs.setdefault(param_key, param_val)

return model.prompt(full_prompt, **kwargs)
Copy link
Member Author

Choose a reason for hiding this comment

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

Thought: We could have a separate backend that uses system prompt and one that does not.

@tm-kn tm-kn force-pushed the feature/15-pluggable-backends branch from c6262cf to a4ee8dd Compare November 16, 2023 16:34
return self.response_iterator

def text(self) -> str:
return " ".join(self.response_iterator)
Copy link
Member Author

Choose a reason for hiding this comment

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

Thought: We could make sure the iterator content gets saved somewhere because I guess it'll get exhausted... We don't want weird side-effects even if it's a test backend.

@tm-kn tm-kn changed the title #15 Add pluggable backends and stop relying on every-ai Add pluggable backends and stop relying on every-ai Nov 16, 2023
@tm-kn tm-kn requested review from tomusher and zerolab November 21, 2023 17:33
@tm-kn tm-kn force-pushed the feature/15-pluggable-backends branch from a4ee8dd to de4d985 Compare November 22, 2023 12:37
@tm-kn tm-kn changed the title Add pluggable backends and stop relying on every-ai #15 Add pluggable backends and stop relying on every-ai Nov 22, 2023
@tm-kn
Copy link
Member Author

tm-kn commented Nov 24, 2023

Closing in favour of #27.

@tm-kn tm-kn closed this Nov 24, 2023
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.

1 participant