You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[PremAI](https://app.premai.io) is an all-in-one platform that simplifies the process of creating robust, production-ready applications powered by Generative AI. By streamlining the development process, PremAI allows you to concentrate on enhancing user experience and driving overall growth for your application.
8
+
9
+
### Prerequisites
10
+
11
+
Refer to the [quick start](https://docs.premai.io/introduction) guide to getting started with the PremAI platform, create your first project and grab your API key.
12
+
13
+
### Usage
14
+
15
+
Please make sure you have premai python sdk installed. Otherwise you can do it using this command:
16
+
17
+
```bash
18
+
pip install -U premai
19
+
```
20
+
21
+
Here is a quick example on how to use premai python sdk with dspy
> Please note: Project ID 123 is just an example. You can find your project ID inside our platform under which you created your project.
31
+
32
+
### Constructor
33
+
34
+
The constructor initializes the base class `LM` and verifies the `api_key` provided or defined through the `PREMAI_API_KEY` environment variable.
35
+
36
+
```python
37
+
classPremAI(LM):
38
+
def__init__(
39
+
self,
40
+
model: str,
41
+
project_id: int,
42
+
api_key: str,
43
+
base_url: Optional[str] =None,
44
+
session_id: Optional[int] =None,
45
+
**kwargs,
46
+
) -> None:
47
+
```
48
+
49
+
**Parameters:**
50
+
51
+
-`model` (_str_): Models supported by PremAI. Example: `mistral-tiny`. We recommend using the model selected in [project launchpad](https://docs.premai.io/get-started/launchpad).
52
+
-`project_id` (_int_): The [project id](https://docs.premai.io/get-started/projects) which contains the model of choice.
53
+
-`api_key` (_Optional[str]_, _optional_): API provider from PremAI. Defaults to None.
54
+
-`session_id` (_Optional[int]_, _optional_): The ID of the session to use. It helps to track the chat history.
55
+
-`**kwargs`: Additional language model arguments will be passed to the API provider.
Retrieves completions from PremAI by calling `request`.
62
+
63
+
Internally, the method handles the specifics of preparing the request prompt and corresponding payload to obtain the response.
64
+
65
+
After generation, the completions are post-processed based on the `model_type` parameter.
66
+
67
+
**Parameters:**
68
+
69
+
-`prompt` (_str_): Prompt to send to PremAI.
70
+
-`**kwargs`: Additional keyword arguments for completion request. Example: parameters like `temperature`, `max_tokens` etc. You can find all the additional kwargs [here](https://docs.premai.io/get-started/sdk#optional-parameters).
[PremAI](https://app.premai.io) is an all-in-one platform that simplifies the process of creating robust, production-ready applications powered by Generative AI. By streamlining the development process, PremAI allows you to concentrate on enhancing user experience and driving overall growth for your application.
4
+
5
+
### Prerequisites
6
+
7
+
Refer to the [quick start](https://docs.premai.io/introduction) guide to getting started with the PremAI platform, create your first project and grab your API key.
8
+
9
+
### Setting up the PremAI Client
10
+
11
+
The constructor initializes the base class `LM` to support prompting requests to supported PremAI hosted models. This requires the following parameters:
12
+
13
+
-`model` (_str_): Models supported by PremAI. Example: `mistral-tiny`. We recommend using the model selected in [project launchpad](https://docs.premai.io/get-started/launchpad).
14
+
-`project_id` (_int_): The [project id](https://docs.premai.io/get-started/projects) which contains the model of choice.
15
+
-`api_key` (_Optional[str]_, _optional_): API provider from PremAI. Defaults to None.
16
+
-`session_id` (_Optional[int]_, _optional_): The ID of the session to use. It helps to track the chat history.
17
+
-`**kwargs`: Additional language model arguments will be passed to the API provider.
0 commit comments