jupyterlab / jupyter-ai

A generative AI extension for JupyterLab
https://jupyter-ai.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
3.23k stars 332 forks source link

Support passing parameters to model providers through the %%ai cell magic #171

Open seanpmorgan opened 1 year ago

seanpmorgan commented 1 year ago

Problem

The use of a standardized SMEndpointProvider in jupyter-ai simplifies the end user experience, but in practice we'll need to customize the provider as endpoints handle input/output formats differently.

The langchain llm SagemakerEndpoint has support to provide a custom content_handler to support endpoint specifics.

https://github.com/jupyterlab/jupyter-ai/pull/52 begins to address this by adding a default handler, but there's no easy way to customize this through the jupyter cell magic.

Proposed Solution

I'd propose the ability to pass arguments like:

%%ai sagemaker-endpoint:us-west-2:jumpstart-dft-hf-text2text-flan-t5-xxl {'content_handler': MyCustomContentHandler}

welcome[bot] commented 1 year ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada: