Integrations
Langchain
LangChain is a framework for developing context-aware, reasoning applications powered by language models.
To install the LangChain x Together library, run:
pip install --upgrade langchain-together
Here's sample code to get you started with Langchain + Together AI:
from langchain_together import ChatTogether
chat = ChatTogether(model="meta-llama/Llama-3-70b-chat-hf")
for m in chat.stream("Tell me fun things to do in NYC"):
print(m.content, end="", flush=True)
Output:
The city that never sleeps! New York City is a hub of entertainment, culture, and adventure, offering countless fun things to do for visitors of all ages and interests. Here are some ideas to get you started:
**Iconic Landmarks and Attractions:**
1. **Statue of Liberty and Ellis Island**: Take a ferry to Liberty Island to see the iconic statue up close and visit the Ellis Island Immigration Museum.
2. **Central Park**: Explore the 843-acre green oasis in the middle of Manhattan, featuring lakes, gardens, and plenty of walking paths.
3. **Empire State Building**: Enjoy panoramic views of the city from the observation deck of this iconic skyscraper.
4. **The Metropolitan Museum of Art**: One of the world's largest and most famous museums, with a collection that spans over 5,000 years of human history.
LlamaIndex
LlamaIndex is a simple, flexible data framework for connecting custom data sources to large language models (LLMs).
Here's sample code to get you started with Llama Index + Together AI:
!pip install llama-index langchain
from llama_index.llms import OpenAILike
llm = OpenAILike(
model="mistralai/Mixtral-8x7B-Instruct-v0.1",
api_base="https://api.together.xyz/v1",
api_key="<API KEY>",
is_chat_model=True,
is_function_calling_model=True,
temperature=0.1,
)
response = llm.complete("Write up to 500 words essay explaining Large Language Models")
print(response)
Updated 6 days ago