Skip to content

Commit 8ecc44f

Browse files
committed
feat(python/sdk): Add LeMUR 3 models (#5539)
GitOrigin-RevId: d7133a9b8de0d1c9c541903bc06d5b7601374c99
1 parent db2f671 commit 8ecc44f

File tree

3 files changed

+54
-25
lines changed

3 files changed

+54
-25
lines changed

assemblyai/lemur.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def question(
208208
Args:
209209
questions: One or a list of questions to ask.
210210
context: The context which is shared among all questions. This can be a string or a dictionary.
211-
final_model: The model that is used for the final prompt after compression is performed (options: "basic", "default", "assemblyai/mistral-7b", and "anthropic/claude-2-1").
211+
final_model: The model that is used for the final prompt after compression is performed.
212212
max_output_size: Max output size in tokens
213213
timeout: The timeout in seconds to wait for the answer(s).
214214
temperature: Change how deterministic the response is, with 0 being the most deterministic and 1 being the least deterministic.
@@ -252,7 +252,7 @@ def question_async(
252252
Args:
253253
questions: One or a list of questions to ask.
254254
context: The context which is shared among all questions. This can be a string or a dictionary.
255-
final_model: The model that is used for the final prompt after compression is performed (options: "basic", "default", "assemblyai/mistral-7b", and "anthropic/claude-2-1").
255+
final_model: The model that is used for the final prompt after compression is performed.
256256
max_output_size: Max output size in tokens
257257
timeout: The timeout in seconds to wait for the answer(s).
258258
temperature: Change how deterministic the response is, with 0 being the most deterministic and 1 being the least deterministic.
@@ -295,7 +295,7 @@ def summarize(
295295
Args:
296296
context: An optional context on the transcript.
297297
answer_format: The format on how the summary shall be summarized.
298-
final_model: The model that is used for the final prompt after compression is performed (options: "basic", "default", "assemblyai/mistral-7b", and "anthropic/claude-2-1").
298+
final_model: The model that is used for the final prompt after compression is performed.
299299
max_output_size: Max output size in tokens
300300
timeout: The timeout in seconds to wait for the summary.
301301
temperature: Change how deterministic the response is, with 0 being the most deterministic and 1 being the least deterministic.
@@ -334,7 +334,7 @@ def summarize_async(
334334
Args:
335335
context: An optional context on the transcript.
336336
answer_format: The format on how the summary shall be summarized.
337-
final_model: The model that is used for the final prompt after compression is performed (options: "basic", "default", "assemblyai/mistral-7b", and "anthropic/claude-2-1").
337+
final_model: The model that is used for the final prompt after compression is performed.
338338
max_output_size: Max output size in tokens
339339
timeout: The timeout in seconds to wait for the summary.
340340
temperature: Change how deterministic the response is, with 0 being the most deterministic and 1 being the least deterministic.
@@ -375,7 +375,7 @@ def action_items(
375375
Args:
376376
context: An optional context on the transcript.
377377
answer_format: The preferred format for the result action items.
378-
final_model: The model that is used for the final prompt after compression is performed (options: "basic", "default", "assemblyai/mistral-7b", and "anthropic/claude-2-1").
378+
final_model: The model that is used for the final prompt after compression is performed.
379379
max_output_size: Max output size in tokens
380380
timeout: The timeout in seconds to wait for the action items response.
381381
temperature: Change how deterministic the response is, with 0 being the most deterministic and 1 being the least deterministic.
@@ -415,7 +415,7 @@ def action_items_async(
415415
Args:
416416
context: An optional context on the transcript.
417417
answer_format: The preferred format for the result action items.
418-
final_model: The model that is used for the final prompt after compression is performed (options: "basic", "default", "assemblyai/mistral-7b", and "anthropic/claude-2-1").
418+
final_model: The model that is used for the final prompt after compression is performed.
419419
max_output_size: Max output size in tokens
420420
timeout: The timeout in seconds to wait for the action items response.
421421
temperature: Change how deterministic the response is, with 0 being the most deterministic and 1 being the least deterministic.
@@ -451,7 +451,7 @@ def task(
451451
452452
Args:
453453
prompt: The prompt to use for this task.
454-
final_model: The model that is used for the final prompt after compression is performed (options: "basic", "default", "assemblyai/mistral-7b", and "anthropic/claude-2-1").
454+
final_model: The model that is used for the final prompt after compression is performed.
455455
max_output_size: Max output size in tokens
456456
timeout: The timeout in seconds to wait for the task.
457457
temperature: Change how deterministic the response is, with 0 being the most deterministic and 1 being the least deterministic.
@@ -485,7 +485,7 @@ def task_async(
485485
486486
Args:
487487
prompt: The prompt to use for this task.
488-
final_model: The model that is used for the final prompt after compression is performed (options: "basic", "default", "assemblyai/mistral-7b", and "anthropic/claude-2-1").
488+
final_model: The model that is used for the final prompt after compression is performed.
489489
max_output_size: Max output size in tokens
490490
timeout: The timeout in seconds to wait for the task.
491491
temperature: Change how deterministic the response is, with 0 being the most deterministic and 1 being the least deterministic.

assemblyai/types.py

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,38 +1844,59 @@ def from_lemur_source(cls, source: LemurSource) -> Self:
18441844

18451845
class LemurModel(str, Enum):
18461846
"""
1847-
LeMUR features four model modes, Basic, Default, Mistral 7B, and Claude v2.1, that allow you to
1848-
configure your request to suit your needs. These options tell LeMUR whether to use the more
1849-
advanced Default model or the cheaper, faster, but simplified Basic model. The implicit setting
1850-
is Default when no option is explicitly passed in.
1847+
LeMUR features different model modes that allow you to configure your request to suit your needs.
1848+
"""
1849+
1850+
claude3_5_sonnet = "anthropic/claude-3-5-sonnet"
1851+
"""
1852+
Claude 3.5 Sonnet is the most intelligent model to date, outperforming Claude 3 Opus on a wide range of evaluations, with the speed and cost of Claude 3 Sonnet.
1853+
"""
1854+
1855+
claude3_opus = "anthropic/claude-3-opus"
1856+
"""
1857+
Claude 3 Opus is good at handling complex analysis, longer tasks with many steps, and higher-order math and coding tasks.
1858+
"""
1859+
1860+
claude3_haiku = "anthropic/claude-3-haiku"
1861+
"""
1862+
Claude 3 Haiku is the fastest model that can execute lightweight actions.
1863+
"""
1864+
1865+
claude3_sonnet = "anthropic/claude-3-sonnet"
1866+
"""
1867+
Claude 3 Sonnet is a legacy model with a balanced combination of performance and speed for efficient, high-throughput tasks.
1868+
"""
1869+
1870+
claude2_1 = "anthropic/claude-2-1"
1871+
"""
1872+
Claude 2.1 is a legacy model similar to Claude 2.0. The key difference is that it minimizes model hallucination and system prompts, has a larger context window, and performs better in citations.
1873+
"""
1874+
1875+
claude2_0 = "anthropic/claude-2"
1876+
"""
1877+
Claude 2.0 is a legacy model that has good complex reasoning. It offers more nuanced responses and improved contextual comprehension.
18511878
"""
18521879

18531880
default = "default"
18541881
"""
1855-
LeMUR Default is the standard model to use. It is capable of handling any task as well, or better
1856-
than LeMUR Basic. Default is capable of more nuanced and complex questions, where Basic would provide poor results.
1882+
Legacy model. The same as `claude2_0`.
1883+
"""
18571884

1858-
Additionally, responses provide more insightful responses with Default.
1859-
The drawback of this expanded functionality and quality is execution speed and cost. Default is up to 20% slower than
1860-
Basic and has an increased cost.
1885+
claude_instant1_2 = "anthropic/claude-instant-1-2"
1886+
"""
1887+
Claude Instant is a legacy model that is optimized for speed and cost. Claude Instant can complete requests up to 20% faster than Claude 2.0.
18611888
"""
18621889

18631890
basic = "basic"
18641891
"""
1865-
LeMUR Basic is a simplified model optimized for speed and cost allowing you to complete simple requests quickly, and cheaply.
1866-
LeMUR Basic can complete requests up to 20% faster than Default.
1867-
1868-
The best use cases for Basic include summary and simple questions with factual answers. It is not recommended to use Basic
1869-
for complex/subjective tasks where answers require more nuance to be effective.
1892+
Legacy model. The same as `claude_instant1_2`.
18701893
"""
18711894

18721895
mistral7b = "assemblyai/mistral-7b"
18731896
"""
18741897
Mistral 7B is an open source model that works well for summarization and answering questions.
18751898
"""
18761899

1877-
claude2_1 = "anthropic/claude-2-1"
1878-
18791900

18801901
class LemurQuestionAnswer(BaseModel):
18811902
"""

tests/unit/test_lemur.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,16 @@ def test_lemur_task_succeeds_input_text(httpx_mock: HTTPXMock):
525525
@pytest.mark.parametrize(
526526
"final_model",
527527
(
528-
aai.LemurModel.mistral7b,
528+
aai.LemurModel.claude3_5_sonnet,
529+
aai.LemurModel.claude3_opus,
530+
aai.LemurModel.claude3_haiku,
531+
aai.LemurModel.claude3_sonnet,
529532
aai.LemurModel.claude2_1,
533+
aai.LemurModel.claude2_0,
534+
aai.LemurModel.default,
535+
aai.LemurModel.claude_instant1_2,
536+
aai.LemurModel.basic,
537+
aai.LemurModel.mistral7b,
530538
),
531539
)
532540
def test_lemur_task_succeeds(final_model, httpx_mock: HTTPXMock):

0 commit comments

Comments
 (0)