You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/partners/together
ccurme 22da9f5f3f
update scheduled tests (#20526)
repurpose scheduled tests to test over provider packages
3 months ago
..
langchain_together together[minor]: Update endpoint to non deprecated version (#19649) 3 months ago
scripts infra: add print rule to ruff (#16221) 5 months ago
tests infra: add print rule to ruff (#16221) 5 months ago
.gitignore together: package and embedding model (#14936) 7 months ago
LICENSE together: package and embedding model (#14936) 7 months ago
Makefile update scheduled tests (#20526) 3 months ago
README.md docs: update Together README.md (#18004) 3 months ago
poetry.lock partners: version constraints (#17492) 5 months ago
pyproject.toml together: release 0.1.0 (#20225) 3 months ago

README.md

langchain-together

This package contains the LangChain integration for Together's generative models.

Installation

pip install -U langchain-together

Embeddings

You can use Together's embedding models through TogetherEmbeddings class.

from langchain_together import TogetherEmbeddings

embeddings = TogetherEmbeddings(
    model='togethercomputer/m2-bert-80M-8k-retrieval'
)
embeddings.embed_query("What is a large language model?")

LLMs

You can use Together's generative AI models as Langchain LLMs:

from langchain_together import Together
from langchain_core.prompts import PromptTemplate

llm = Together(
    model="togethercomputer/RedPajama-INCITE-7B-Base",
    temperature=0.7,
    max_tokens=64,
    top_k=1,
    # together_api_key="..."
)

template = """Question: {question}
Answer: """
prompt = PromptTemplate.from_template(template)

chain = prompt | llm

question = "Who was the president in the year Justin Beiber was born?"
print(chain.invoke({"question": question}))