mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
481d3855dc
- `llm(prompt)` -> `llm.invoke(prompt)` - `llm(prompt=prompt` -> `llm.invoke(prompt)` (same with `messages=`) - `llm(prompt, callbacks=callbacks)` -> `llm.invoke(prompt, config={"callbacks": callbacks})` - `llm(prompt, **kwargs)` -> `llm.invoke(prompt, **kwargs)`
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
"""Test Clarifai API wrapper.
|
|
In order to run this test, you need to have an account on Clarifai.
|
|
You can sign up for free at https://clarifai.com/signup.
|
|
pip install clarifai
|
|
|
|
You'll need to set env variable CLARIFAI_PAT_KEY to your personal access token key.
|
|
"""
|
|
|
|
from langchain_community.llms.clarifai import Clarifai
|
|
|
|
|
|
def test_clarifai_call() -> None:
|
|
"""Test valid call to clarifai."""
|
|
llm = Clarifai(
|
|
user_id="google-research",
|
|
app_id="summarization",
|
|
model_id="text-summarization-english-pegasus",
|
|
)
|
|
output = llm.invoke(
|
|
"A chain is a serial assembly of connected pieces, called links, \
|
|
typically made of metal, with an overall character similar to that\
|
|
of a rope in that it is flexible and curved in compression but \
|
|
linear, rigid, and load-bearing in tension. A chain may consist\
|
|
of two or more links."
|
|
)
|
|
|
|
assert isinstance(output, str)
|
|
assert llm._llm_type == "clarifai"
|
|
assert llm.model_id == "text-summarization-english-pegasus"
|