Skip to main content


Banana is focused on building the machine learning infrastructure.

This example goes over how to use LangChain to interact with Banana models

# Install the package
pip install banana-dev
# get new tokens:
# We need three parameters to make a API call:
# * a team api key
# * the model's unique key
# * the model's url slug

import os
from getpass import getpass

# You can get this from the main dashboard
# at
os.environ["BANANA_API_KEY"] = "YOUR_API_KEY"
# OR
# BANANA_API_KEY = getpass()
from langchain.llms import Banana
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain
template = """Question: {question}

Answer: Let's think step by step."""

prompt = PromptTemplate(template=template, input_variables=["question"])
# Both of these are found in your model's 
# detail page in
llm = Banana(model_key="YOUR_MODEL_KEY", model_url_slug="YOUR_MODEL_URL_SLUG")
llm_chain = LLMChain(prompt=prompt, llm=llm)
question = "What NFL team won the Super Bowl in the year Justin Beiber was born?"