MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / __init__

Method __init__

camel/models/cohere_model.py:51–69  ·  view source on GitHub ↗
(
        self,
        model_type: Union[ModelType, str],
        model_config_dict: Optional[Dict[str, Any]] = None,
        api_key: Optional[str] = None,
        url: Optional[str] = None,
        token_counter: Optional[BaseTokenCounter] = None,
    )

Source from the content-addressed store, hash-verified

49 ]
50 )
51 def __init__(
52 self,
53 model_type: Union[ModelType, str],
54 model_config_dict: Optional[Dict[str, Any]] = None,
55 api_key: Optional[str] = None,
56 url: Optional[str] = None,
57 token_counter: Optional[BaseTokenCounter] = None,
58 ):
59 import cohere
60
61 if model_config_dict is None:
62 model_config_dict = CohereConfig().as_dict()
63
64 api_key = api_key or os.environ.get("COHERE_API_KEY")
65 url = url or os.environ.get("COHERE_API_BASE_URL")
66 super().__init__(
67 model_type, model_config_dict, api_key, url, token_counter
68 )
69 self._client = cohere.ClientV2(api_key=self._api_key)
70
71 def _to_openai_response(self, response: 'ChatResponse') -> ChatCompletion:
72 if response.usage and response.usage.tokens:

Callers

nothing calls this directly

Calls 2

CohereConfigClass · 0.90
as_dictMethod · 0.45

Tested by

no test coverage detected