Skip to content

Commit fc8e390

Browse files
authored
Merge pull request #1192 from AshAnand34/cohere-command-r-support
Added support for Cohere Command R.
2 parents 01a6e4d + 123dd7d commit fc8e390

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
""" Example script for using the Cohere Command R model. """
2+
3+
from llmware.models import ModelCatalog
4+
5+
def main():
6+
""" Demonstrates loading and using the Cohere Command R model. """
7+
8+
model_name = "command-r"
9+
10+
# Load the model using ModelCatalog
11+
model = ModelCatalog().load_model(model_name)
12+
13+
# Define a prompt for inference
14+
prompt = "Explain the theory of relativity in simple terms."
15+
16+
# Perform inference
17+
response = model.inference(prompt)
18+
19+
# Print the response
20+
print("LLM Response:", response["llm_response"])
21+
print("Usage:", response["usage"])
22+
23+
if __name__ == "__main__":
24+
main()

llmware/model_configs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,10 @@
437437

438438
{"model_name": 'command-medium-nightly', "display_name": "Cohere Command Medium", "model_family": "CohereGenModel",
439439
"model_category": "generative-api","model_location": "api", "context_window": 2048},
440-
440+
{"model_name": "command-r", "display_name": "Cohere Command R", "model_family": "CohereGenModel",
441+
"model_category": "generative-api", "model_location": "api", "context_window": 2048},
441442
{"model_name": 'command-xlarge-nightly', "display_name": "Cohere Command XLarge", "model_family": "CohereGenModel",
442443
"model_category": "generative-api","model_location": "api", "context_window": 2048},
443-
444444
{"model_name": 'summarize-xlarge', "display_name": "Cohere Summarize Xlarge", "model_family": "CohereGenModel",
445445
"model_category":"generative-api","model_location": "api", "context_window": 2048},
446446
{"model_name": 'summarize-medium', "display_name": "Cohere Summarize Medium", "model_family": "CohereGenModel",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
""" Test for Cohere Command R model integration. """
2+
3+
from llmware.models import ModelCatalog
4+
5+
def test_cohere_command_r():
6+
""" Test loading and basic inference for Cohere Command R model. """
7+
8+
model_name = "command-r"
9+
10+
# Load the model using ModelCatalog
11+
model = ModelCatalog().load_model(model_name)
12+
13+
# Define a simple prompt for testing
14+
prompt = "What is the capital of France?"
15+
16+
# Perform inference
17+
response = model.inference(prompt)
18+
19+
# Print the response for debugging
20+
print("LLM Response:", response["llm_response"])
21+
print("Usage:", response["usage"])
22+
23+
# Assert that the response is not None
24+
assert response is not None
25+
26+
return 0
27+
28+
if __name__ == "__main__":
29+
test_cohere_command_r()

0 commit comments

Comments
 (0)