ibm-granite-community / pm

Granite Community Project Management
0 stars 0 forks source link

create utility library with model connection preamble #116

Closed adampingel closed 1 month ago

adampingel commented 1 month ago

aka "the shim"

Consolidate the first cells of the notebooks into a new repo that can be installed in a single line at the top of notebooks.

After the install, there would be a cell with an import line and 2 additional lines -- one for Replicate and one for Ollama. Something like:

from ibm_granite_community import find_langchain_model

model = find_langchain_model(platform="Replicate", model_id="...")
# model = find_langchain_model(platform="Ollama", model_id="...")

I use LangChain as the example here, but am open to other implementations.

Sub-Tasks

adampingel commented 1 month ago

I'm interested in getting something in place soon, even if we have open questions or misgivings. I think this is something we can and will be refining for a while.

With that said, I invite @gabe-l-hart , @deanwampler , @fayvor , and others to weigh in with opinions...

gabe-l-hart commented 1 month ago

@adampingel since I'm not super familiar with the notebooks yet, can you provide links to the kind of boilerplate you're imagining sticking in this utility library?

deanwampler commented 1 month ago

I would start with helper functions we define in notebooks. Which ones appear in one variation or another over and over? Good candidates for the util lib. On the other hand, some of those will have useful info internally about calling APIs, like Ollama's, and will be less visible if "hidden" in a library. So, it's a balancing act.

A compromise approach is to show simplified implementations of some utilities in "early" notebooks, then tell the reader that util versions will be used subsequently.

rawkintrevo commented 1 month ago

I was going to init with the is_this_colab function and other stuff from PM #102

rawkintrevo commented 1 month ago

https://colab.research.google.com/drive/1CfNPXZ1xy4QOAy_EW5GoLbovsFQu3nR5?usp=sharing

fayvor commented 1 month ago

A compromise approach is to show simplified implementations of some utilities in "early" notebooks, then tell the reader that util versions will be used subsequently.

@deanwampler this could work if we link to the recipe where we use the utility. I'm thinking about a cookbook where your fettucine recipe refers to your pesto recipe.

rawkintrevo commented 1 month ago

see init https://github.com/ibm-granite-community/utils (or any other utillities to put in)

rawkintrevo commented 1 month ago

Is there a current implementation of find_langchain_model ?

adampingel commented 1 month ago

No -- that's in scope for this ticket. For now you can assume that the only model platforms we are supporting are Ollama and Replicate.

fayvor commented 1 month ago

For now you can assume that the only model platforms we are supporting are Ollama and Replicate. We might want to add HuggingFace to that list next.

Here is an interesting joint package by HuggingFace and Langchain that brings HuggingFace models via transformers and pipelines into LangChain.

rawkintrevo commented 1 month ago

qid

https://colab.research.google.com/drive/1iTIZYadhDICOMY5cZmtdrxD6G4WyLyg2?usp=sharing

rawkintrevo commented 1 month ago

reopen, maybe send it to review, this is a strange workflow (operating on new repo)