Skip to main content
Open In ColabOpen on GitHub

ChatChatAbso

This will help you getting started with ChatAbso chat models. For detailed documentation of all ChatChatAbso features and configurations head to the API reference.

  • You can find the full documentation for the Abso router [here] (https://abso.ai)

Overviewโ€‹

Integration detailsโ€‹

ClassPackageLocalSerializableJS supportPackage downloadsPackage latest
ChatChatAbsolangchain-absoโŒโŒโŒPyPI - DownloadsPyPI - Version

Setupโ€‹

To access ChatAbso models you'll need to create an OpenAI account, get an API key, and install the langchain-abso integration package.

Credentialsโ€‹

  • TODO: Update with relevant info.

Head to (TODO: link) to sign up to ChatAbso and generate an API key. Once you've done this set the ABSO_API_KEY environment variable:

import getpass
import os

if not os.getenv("OPENAI_API_KEY"):
os.environ["OPENAI_API_KEY"] = getpass.getpass("Enter your OpenAI API key: ")

Installationโ€‹

The LangChain ChatAbso integration lives in the langchain-abso package:

%pip install -qU langchain-abso

Instantiationโ€‹

Now we can instantiate our model object and generate chat completions:

from langchain_abso import ChatChatAbso

llm = ChatChatAbso(fast_model="gpt-4o", slow_model="o3-mini")

Invocationโ€‹

messages = [
(
"system",
"You are a helpful assistant that translates English to French. Translate the user sentence.",
),
("human", "I love programming."),
]
ai_msg = llm.invoke(messages)
ai_msg
print(ai_msg.content)

Chainingโ€‹

We can chain our model with a prompt template like so:

from langchain_core.prompts import ChatPromptTemplate

prompt = ChatPromptTemplate(
[
(
"system",
"You are a helpful assistant that translates {input_language} to {output_language}.",
),
("human", "{input}"),
]
)

chain = prompt | llm
chain.invoke(
{
"input_language": "English",
"output_language": "German",
"input": "I love programming.",
}
)
API Reference:ChatPromptTemplate

API referenceโ€‹

For detailed documentation of all ChatChatAbso features and configurations head to the API reference: https://python.langchain.com/api_reference/en/latest/chat_models/langchain_abso.chat_models.ChatChatAbso.html


Was this page helpful?