Skip to content

Commit 39312d0

Browse files
committed
Add Inception API provider implementation and documentation
1 parent 135dba2 commit 39312d0

2 files changed

Lines changed: 100 additions & 0 deletions

File tree

Providers/Inception.ps1

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
<#
3+
.SYNOPSIS
4+
Invokes the Inception API to generate responses using specified models.
5+
6+
.DESCRIPTION
7+
The Invoke-InceptionProvider function sends requests to the Inception API and returns the generated content.
8+
It requires an API key to be set in the environment variable 'INCEPTION_API_KEY'.
9+
10+
.PARAMETER ModelName
11+
The name of the Inception model to use (e.g., 'mercury-coder').
12+
13+
.PARAMETER Messages
14+
An array of hashtables containing the messages to send to the model.
15+
16+
.EXAMPLE
17+
$Message = New-ChatMessage -Prompt 'What is a diffusion model?'
18+
$response = Invoke-InceptionProvider -ModelName 'mercury-coder' -Messages $Message
19+
20+
.NOTES
21+
Requires the INCEPTION_API_KEY environment variable to be set with a valid API key.
22+
API Reference: https://docs.inceptionlabs.ai/
23+
#>
24+
function Invoke-InceptionProvider {
25+
param(
26+
[Parameter(Mandatory)]
27+
[string]$ModelName,
28+
[Parameter(Mandatory)]
29+
[hashtable[]]$Messages
30+
)
31+
32+
$headers = @{
33+
'Authorization' = "Bearer $env:INCEPTION_API_KEY"
34+
'Content-Type' = 'application/json'
35+
}
36+
37+
$body = @{
38+
'model' = $ModelName
39+
'messages' = $Messages
40+
}
41+
42+
$Uri = "https://api.inceptionlabs.ai/v1/chat/completions"
43+
44+
$params = @{
45+
Uri = $Uri
46+
Method = 'POST'
47+
Headers = $headers
48+
Body = $body | ConvertTo-Json -Depth 10
49+
}
50+
51+
try {
52+
$response = Invoke-RestMethod @params
53+
return $response.choices[0].message.content
54+
}
55+
catch {
56+
$statusCode = $_.Exception.Response.StatusCode.value__
57+
$errorMessage = $_.ErrorDetails.Message
58+
Write-Error "Inception API Error (HTTP $statusCode): $errorMessage"
59+
return "Error calling Inception API: $($_.Exception.Message)"
60+
}
61+
}

guides/inception.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Inception
2+
3+
To use Inception with `psaisuite` you will need to [create an account](https://inceptionlabs.ai/). After logging in, go to your dashboard and generate a new API key. Once you have your key, add it to your environment as follows:
4+
5+
```shell
6+
$env:INCEPTION_API_KEY = "your-inception-api-key"
7+
```
8+
9+
## Create a Chat Completion
10+
11+
Install `psaisuite` from the PowerShell Gallery.
12+
13+
```powershell
14+
Install-Module PSAISuite
15+
```
16+
17+
In your code:
18+
19+
```powershell
20+
# Import the module
21+
Import-Module PSAISuite
22+
23+
$provider = "inception"
24+
$model_id = "mercury-coder"
25+
26+
# Create the model identifier
27+
$model = "{0}:{1}" -f $provider, $model_id
28+
$Message = New-ChatMessage -Prompt "What is a diffusion model?"
29+
Invoke-ChatCompletion -Message $Message -Model $model
30+
```
31+
32+
```shell
33+
Messages : {"role":"user","content":"What is a diffusion model?"}
34+
Response : [Inception's response here]
35+
Model : inception:mercury-coder
36+
Provider : inception
37+
ModelName : mercury-coder
38+
Timestamp : Sun 03 09 2025 9:56:29 AM
39+
```

0 commit comments

Comments
 (0)