Skip to content

Commit

Permalink
Mathnathan/issue14406 (#14409)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathnathan authored Jun 26, 2024
1 parent d76f0c8 commit 48d22f4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,33 @@ def metadata(self) -> LLMMetadata:
)

def _get_context_window(self) -> int:
# Check https://docs.perplexity.ai/docs/model-cards for latest model information
model_context_windows = {
"sonar-small-chat": 16384,
"sonar-small-online": 12000,
"sonar-medium-chat": 16384,
"sonar-medium-online": 12000,
"codellama-34b-instruct": 16384,
"mistral-7b-instruct": 16384,
# Perplexity Models
"llama-3-sonar-small-32k-chat": 32768,
"llama-3-sonar-small-32k-online": 28000,
"llama-3-sonar-large-32k-chat": 32768,
"llama-3-sonar-large-32k-online": 28000,
# Open Source Models
"llama-3-8b-instruct": 8192,
"llama-3-70b-instruct": 8192,
"mixtral-8x7b-instruct": 16384,
}
return model_context_windows.get(
self.model, 4096
) # Default to 4096 if model not found

def _is_chat_model(self) -> bool:
# Check https://docs.perplexity.ai/docs/model-cards for latest model information
chat_models = {
"sonar-small-chat",
"sonar-small-online",
"sonar-medium-chat",
"sonar-medium-online" "codellama-34b-instruct",
"mistral-7b-instruct",
# Perplexity Models
"llama-3-sonar-small-32k-chat",
"llama-3-sonar-small-32k-online",
"llama-3-sonar-large-32k-chat",
"llama-3-sonar-large-32k-online",
# Open Source Models
"llama-3-8b-instruct",
"llama-3-70b-instruct",
"mixtral-8x7b-instruct",
}
return self.model in chat_models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exclude = ["**/BUILD"]
license = "MIT"
name = "llama-index-llms-perplexity"
readme = "README.md"
version = "0.1.3"
version = "0.1.4"

[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
Expand Down

0 comments on commit 48d22f4

Please sign in to comment.