Skip to content

0. Design intent of PanML

Willza edited this page May 19, 2023 · 14 revisions

The goal of the PanML library is to simplify code for generative AI experimentation and analysis at the right level of abstraction. We are currently going with the following design structure.

# LLM instantiation
# Where model: name of the underlying LLM, and source: HuggingFace, OpenAI, or other providers
lm = ModelPack(model='...', source='...')

# LLM inference with probability, perplexity scores
lm.predict(prompt) -> return response, with scores

# LLM training
# where x and y are lists
# For instruct based training regime, x and y can be different,
# For self-supervised autoregressive training regime, x and y can be set as the same
lm.fit(x, y)

# LLM prompt chaining
# where prompt modifier is a list containing the prompts corresponding to each sequence of chains
lm.predict(prompt, prompt_modifier) -> return final response

# LLM code generation
# where prompt is an instruction for code generation and variables are objects (values or data objects, e.g. dataframes) 
# to be used in the context of the generated code
lm.predict_code(prompt, variables) -> return code 

# Vector search instantiation
# Where source: FAISS, Pinecone, or other providers, mode: method of search, e.g. "flat", "ivfflat", etc
vectors = VectorEngine(source='...', mode='')

# Vector search store setup
# Where docs: list containing sentences
vectors.store(docs)

# Vector search execution
# Where query: text of the query, k: top number of sentences most similar to be retrieved
vectors.search(query, k) -> return list of similar sentences