### liblab Portal Getting Started
Source: https://liblab.com/docs/tutorials/others/rag-with-sdk/index
A guide for new users to get started with the liblab Portal. It covers account creation, project setup, and initial steps for API specification management and SDK generation.
```APIDOC
liblab Portal - Getting Started:
1. Sign Up/Login:
- Visit the liblab portal and create an account or log in if you already have one.
- Access: https://app.liblab.com/join
2. Create a New Project:
- Navigate to the 'Projects' section.
- Click 'Create New Project'.
- Provide a project name and description.
3. Upload API Specification:
- Within your project, select 'Upload Specification'.
- Supported formats: OpenAPI (v2, v3), Swagger.
- You can upload a file or provide a URL to your specification.
4. Configure SDK Generation:
- Go to the 'SDK Generation' tab.
- Select the target programming languages (e.g., Python, JavaScript, Java).
- Customize generation options such as output directory, versioning, and specific SDK features.
5. Generate SDKs:
- Click the 'Generate SDKs' button.
- The portal will process your specification and generate the SDKs for the selected languages.
- Download the generated SDK packages.
6. Documentation Generation:
- Navigate to the 'Documentation' tab.
- Configure settings for generating API and SDK documentation.
- Publish your documentation to a hosted environment.
7. API Spec Management:
- Use the portal to manage versions of your API specification.
- Track changes and ensure consistency across your developer ecosystem.
```
--------------------------------
### Run SDK Example Commands
Source: https://liblab.com/docs/get-started/quickstart-generate-sdk/index
Demonstrates the terminal commands to navigate to the example directory, make the install script executable, run the installation, activate the virtual environment, and execute the sample Python application.
```bash
cd output/python/examples
chmod +x ./install.sh
./install.sh
source ./.venv/bin/activate
python sample.py
```
--------------------------------
### Install liblab CLI
Source: https://liblab.com/docs/get-started/getting-started/index
Installs the liblab command-line interface using the Homebrew package manager. This is the primary method for getting started with liblab.
```shell
brew install liblab
```
--------------------------------
### liblab Portal Getting Started
Source: https://liblab.com/docs/integrate-with-cicd/publish-your-sdk
Guides users through the initial steps of using the liblab portal. Covers account creation, project setup, and navigating the portal's features for SDK generation and management.
```APIDOC
liblab Portal - Getting Started:
A web-based interface for managing SDK generation and API documentation.
Covers:
- User registration and login.
- Creating new API projects.
- Uploading API specifications (OpenAPI, etc.).
- Configuring SDK generation settings.
- Managing generated SDKs and documentation.
Inputs: API specification files, project details.
Outputs: Generated SDKs, documentation, project management dashboard.
Limitations: Requires an active liblab account and a valid API specification.
```
--------------------------------
### TypeScript SDK: Setup and Run Example
Source: https://liblab.com/docs/tutorials/customizations/build-an-sdk-with-streaming/index
Instructions for testing the TypeScript SDK, including navigating to the example directory, installing dependencies, configuring the generation request, and executing the script.
```bash
cd output/typescript/examples
npm run setup
```
```typescript
const generateRequest: GenerateRequest = {
model: 'llama3.1:8b',
prompt: 'Tell me a joke',
stream: true,
};
// Assuming api.generate(generateRequest) is called elsewhere in src/index.ts
// npm run start
```
```text
[email protected] start> tsc && node dist/index.js
{
model: 'llama3.1:8b',
createdAt: '2024-12-10T00:25:03.9792376Z',
response: 'Here',
done: false,
doneReason: undefined,
context: undefined,
totalDuration: undefined,
loadDuration: undefined,
promptEvalCount: undefined,
promptEvalDuration: undefined,
evalCount: undefined,
evalDuration: undefined
}
...
{
model: 'llama3.1:8b',
createdAt: '2024-12-10T00:25:04.2602098Z',
response: '',
done: true,
doneReason: 'stop',
context: [
128006, 882, 128007, 271, 41551, 757, 264, 22380, 128009, 128006, 78191, 128007, 271, 8586, 596, 832, 1473, 3923, 656, 499, 1650, 264, 12700, 46895, 273, 1980, 2127, 3242, 14635, 13
],
totalDuration: 3104377400,
loadDuration: 2724683300,
promptEvalCount: 14,
promptEvalDuration: 95000000,
evalCount: 18,
evalDuration: 283000000
}
```
--------------------------------
### liblab Get Started Link
Source: https://liblab.com/blog/authors
Link to the liblab application to get started with their services.
```html
Get Started
```
--------------------------------
### Example liblab Configuration File
Source: https://liblab.com/docs/get-started/quickstart-generate-sdk/index
An example of a `liblab.config.json` file, detailing settings for SDK name, API version, spec file path, supported languages, authentication methods, and language-specific customizations.
```json
{
"sdkName": "test-sdk",
"apiVersion": "1.0.0",
"apiName": "test-api",
"specFilePath": "spec.json",
"languages": [
"csharp",
"go",
"python",
"typescript"
],
"auth": [
"bearer"
],
"customizations": {
"includeOptionalSnippetParameters": true,
"authentication": {
"access": {
"prefix": "Bearer"
}
},
"devContainer": false,
"generateEnv": true,
"inferServiceNames": false,
"injectedModels": [],
"license": {
"type": "MIT"
},
"responseHeaders": false,
"retry": {
"enabled": true,
"maxAttempts": 3,
"retryDelay": 150
}
},
"languageOptions": {
"python": {
"alwaysInitializeOptionals": false,
"pypiPackageName": "",
"githubRepoName": "",
"ignoreFiles": [],
"sdkVersion": "1.0.0",
"liblabVersion": "2"
},
"typescript": {
"bundle": false,
"exportClassDefault": false,
"httpClient": "fetch",
"npmName": "",
"npmOrg": "",
"githubRepoName": "",
"ignoreFiles": [],
"sdkVersion": "1.0.0",
"liblabVersion": "1"
},
"go": {
"goModuleName": "github.com/swagger-api/swagger-petstore",
"githubRepoName": "",
"ignoreFiles": [],
"sdkVersion": "1.0.0",
"liblabVersion": "2"
},
"csharp": {
"packageId": "",
"githubRepoName": "",
"ignoreFiles": [],
"sdkVersion": "1.0.0",
"liblabVersion": "2"
}
},
"publishing": {
"githubOrg": ""
}
}
```
--------------------------------
### Install liblab CLI with pnpm
Source: https://liblab.com/docs/get-started/getting-started/index
Installs the liblab CLI globally using pnpm. Requires Node.js version 18.17 or later and pnpm.
```bash
pnpm add -g liblab
```
--------------------------------
### Python SDK: Setup and Run Example
Source: https://liblab.com/docs/tutorials/customizations/build-an-sdk-with-streaming/index
Steps to set up a Python virtual environment, configure a generation request, and run the SDK example. This includes activating the environment and executing the Python script.
```bash
cd output/python/examples
chmod +x install.sh
./install.sh
source .venv/bin/activate
```
```powershell
cd output/python/examples
./install.cmd
.venv/Scripts/Activate.ps1
```
```python
request_body = GenerateRequest(model="llama3.1:8b", prompt="Tell me a joke", stream=True)
# Assuming sdk.api.generate is called elsewhere in sample.py
# python sample.py
```
```text
GenerateResponse(
model='llama3.1:8b',
created_at='2025-01-05T14:25:31.57605Z',
response='Here',
done=False
)
...
GenerateResponse(
model='llama3.1:8b',
created_at='2025-01-05T14:25:31.8601164Z',
response='',
done=True,
done_reason='stop',
context=[128006, 882, 128007, 271, 41551, 757, 264, 22380, 128009, 128006, 78191, 128007, 271, 8586, 596, 832, 1473, 3923, 656, 499, 1650, 264, 12700, 46895, 273, 1980, 2127, 3242, 14635, 0],
total_duration=7032005800,
load_duration=6623531800,
prompt_eval_count=14,
prompt_eval_duration=120000000,
eval_count=18,
eval_duration=287000000
)
```
--------------------------------
### Install liblab CLI with npm
Source: https://liblab.com/docs/get-started/getting-started/index
Installs the liblab CLI globally using npm. Requires Node.js version 18.17 or later.
```bash
npm install -g liblab
```
--------------------------------
### Test TypeScript/JavaScript SDK
Source: https://liblab.com/docs/howto/go-huma/index
Steps to set up and run the generated TypeScript/JavaScript SDK example. This involves navigating to the example directory, installing dependencies, and starting the example.
```bash
cd output/typescript/examples
npm run setup
npm run start
```
--------------------------------
### liblab Get Started Link
Source: https://liblab.com/blog/tags/announcement
A call-to-action link directing users to the 'Get Started' page or application, encouraging them to sign up or begin using liblab's services.
```html
Get Started
```
--------------------------------
### Testing TypeScript/JavaScript SDK
Source: https://liblab.com/docs/howto/remix/index
Instructions for setting up and running the generated SDK examples for TypeScript and JavaScript projects. It involves navigating to the examples directory and executing setup and start commands.
```Bash
cd output/typescript/examples
npm run setup
npm run start
```
--------------------------------
### Run Python SDK Example
Source: https://liblab.com/docs/howto/nextjs/index
Steps to set up and run the Python SDK example, including making the install script executable, running it, activating the virtual environment, and executing the sample script.
```shell
cd output/python/examples
chmod +x install.sh
./install.sh
source .venv/bin/activate
python3 sample.py
```
--------------------------------
### Basic Huma API Setup
Source: https://liblab.com/docs/howto/go-huma/index
Demonstrates the initial setup of a Huma API using the Chi router. It includes defining the API name and version, initializing the router and API, and starting the HTTP server.
```go
package main
import (
"context"
"net/http"
"github.com/danielgtaylor/huma/v2"
"github.com/danielgtaylor/huma/v2/adapters/humachi"
"github.com/go-chi/chi/v5"
)
func main() {
// Create a new Huma API configuration
config := huma.DefaultConfig("My API", "1.0.0")
// Initialize the Chi router
r := chi.NewRouter()
// Initialize the API with Chi router
api := humachi.New(r, config)
// Start the server
http.ListenAndServe(":8888", api)
}
```
--------------------------------
### LibLab CLI Quickstart Commands
Source: https://context7_llms
Commands to install the LibLab CLI, initialize a project with an OpenAPI specification, and build the SDK.
```shell
npm install -g liblab
```
```shell
liblab init --spec
```
```shell
liblab build
```
--------------------------------
### Install liblab CLI
Source: https://liblab.com/blog/create-csharp-sdk-payment-gateway
Installs the liblab command-line interface globally using npm. This is the first step to start generating SDKs.
```bash
npm install -g liblab
```
--------------------------------
### Start Remix Development Server
Source: https://liblab.com/docs/howto/remix/index
Starts the Remix development server, allowing you to preview your application. This command requires Node.js and npm to be installed.
```bash
npm run dev
```
--------------------------------
### Verify liblab CLI Installation
Source: https://liblab.com/docs/cli/cli-installation
Checks if the liblab CLI has been installed correctly by displaying its version.
```shell
liblab --version
```
--------------------------------
### Install liblab CLI with Homebrew
Source: https://liblab.com/docs/cli/cli-installation
Installs the liblab CLI using Homebrew. First, tap the liblab repository, then install the package.
```shell
brew tap liblaber/homebrew-liblab
brew install liblab
```
--------------------------------
### Liblab Build Success Output
Source: https://liblab.com/docs/get-started/quickstart-generate-sdk/index
Example output indicating successful SDK generation for multiple languages and confirmation of download.
```bash
✓ C# built✓ Go built✓ Java built✓ Python built✓ TypeScript builtSuccessfully generated SDKs downloaded. You can find them inside the "output" folderSuccessfully generated SDK's for C#, TypeScript, Go, Python and Java ♡
```
--------------------------------
### Install liblab CLI with npm
Source: https://liblab.com/docs/cli/cli-installation
Installs the liblab CLI globally using npm. Ensure Node.js version 18.17 or later is installed.
```shell
npm install -g liblab
```
--------------------------------
### Install liblab CLI with pnpm
Source: https://liblab.com/docs/cli/cli-installation
Installs the liblab CLI globally using pnpm. Requires Node.js version 18.17 or later and pnpm installed.
```shell
pnpm add -g liblab
```
--------------------------------
### SDK Client Example
Source: https://liblab.com/blog/how-to-build-an-sdk
Illustrates the structure of an SDK client wrapper, including initialization with authentication and environment settings, and methods for configuring the client's base URL and access token.
```python
class Llamastore:
def __init__(self, access_token="", environment=Environment.DEFAULT) -> None:
# The llama service
self.llama_service = LlamaService(access_token)
# Set a different URL for different environments
def set_base_url(self, url: str) -> None:
pass # Implementation details omitted
# Set the API access token
def set_access_token(self, token: str) -> None:
pass # Implementation details omitted
```
--------------------------------
### Update liblab CLI with npm
Source: https://liblab.com/docs/cli/cli-installation
Updates the globally installed liblab CLI to the latest version using npm.
```shell
npm update -g liblab
```
--------------------------------
### Update liblab CLI with pnpm
Source: https://liblab.com/docs/cli/cli-installation
Updates the globally installed liblab CLI to the latest version using pnpm.
```shell
pnpm up -g liblab
```
--------------------------------
### Initialize liblab Project
Source: https://liblab.com/blog/create-csharp-sdk-payment-gateway
Initializes a new liblab project, setting up the necessary configuration files for SDK generation.
```bash
liblab init
```
--------------------------------
### Setup Local MCP Server
Source: https://liblab.com/docs/mcp/howto-connect-mcp-to-vscode/index
Commands to navigate to the generated MCP server directory and run the setup script. This prepares the server environment for execution.
```bash
cd output/mcp
npm run setup
```
--------------------------------
### Update liblab CLI with Homebrew
Source: https://liblab.com/docs/cli/cli-installation
Updates the liblab CLI installed via Homebrew by first updating the package list and then upgrading the package.
```shell
brew update
brew install liblab
```
--------------------------------
### Initialize liblab Configuration
Source: https://liblab.com/docs/get-started/quickstart-generate-sdk/index
Command to create a new liblab configuration file (`liblab.config.json`) in the current directory. This file is essential for defining SDK generation parameters.
```bash
liblab init
```
--------------------------------
### Run liblab CLI using npx
Source: https://liblab.com/docs/cli/cli-installation
Executes the latest version of the liblab CLI without global installation, useful for CI/CD environments.
```shell
npx liblab@latest [command]
```
--------------------------------
### Generated SDKs Output Directory Structure
Source: https://liblab.com/docs/get-started/quickstart-generate-sdk/index
Illustrates the typical directory structure of generated SDKs within the 'output' folder after a successful liblab build.
```bash
output/
├─ csharp
├─ go
├─ java
├─ python
├─ typescript
└─ terraform
```
--------------------------------
### Go Server Implementation with OpenAPI Docs Serving
Source: https://liblab.com/docs/howto/go-goa/index
This Go code snippet demonstrates how to set up a main server file. It includes a sample greeting service implementation and configures the server to serve static OpenAPI documentation files from the './gen/http' directory under the '/docs/' endpoint. It also shows how to start the HTTP server and log its status.
```go
package main
import (
"context"
"log"
"net/http"
"your_module_path/gen/http/greeting"
)
// greetingSvc implements the generated greeting.Service interface
type greetingSvc struct{}
// Greet handles requests by returning a personalized greeting
func (s *greetingSvc) Greet(ctx context.Context, p *greeting.GreetPayload) (string, error) {
return "Hello, " + p.Name, nil
}
func main() {
// Assume mainMux is initialized elsewhere, e.g., from generated code
var mainMux *http.ServeMux // Placeholder for actual mux initialization
// Serve static OpenAPI documentation
docsHandler := http.StripPrefix("/docs/", http.FileServer(http.Dir("./gen/http")))
mainMux.Handle("/docs/", docsHandler)
// Start the HTTP server
srv := &http.Server{
Addr: ":8080",
Handler: mainMux,
}
log.Println("Server is running on http://localhost:8080")
log.Println("OpenAPI docs are available at http://localhost:8080/docs/openapi3.json (or .yaml)")
log.Fatal(srv.ListenAndServe())
}
```
--------------------------------
### Preview Documentation
Source: https://liblab.com/docs/tutorials/documentation/mintlify-integration/index
Command to start a local development server to preview your generated documentation pages.
```bash
mintlify dev
```
--------------------------------
### Setup and Start Local MCP Server
Source: https://liblab.com/docs/mcp/howto-connect-mcp-to-cursor/index
These shell commands are used to set up and start a locally generated MCP server. Navigate to the server's output directory, install dependencies, and then run the server.
```shell
cd output/mcp
npm run setup
```
--------------------------------
### Build SDKs with Liblab CLI
Source: https://liblab.com/docs/get-started/quickstart-generate-sdk/index
Command to initiate the SDK generation process using the liblab CLI, with an option to skip validation.
```bash
liblab build --skip-validation
```
--------------------------------
### Project Setup and Initialization
Source: https://liblab.com/docs/tutorials/customizations/build-a-typescript-sdk-with-pagination/index
Commands to create a new project directory, navigate into it, and initialize a new liblab project. This process generates a basic `liblab.config.json` file.
```bash
mkdir -p typescript-pagination
cd typescript-pagination
liblab init
```
--------------------------------
### Run Example Project
Source: https://liblab.com/blog/testing-and-debugging-sdks-with-proxyman
Navigate to the generated SDK's example project directory and execute the development server using npm.
```shell
cd my-sdk/output/typescript/examples
npm run dev
```
--------------------------------
### Test TypeScript/JavaScript SDK
Source: https://liblab.com/docs/howto/flask/index
Steps to navigate to the generated TypeScript/JavaScript SDK examples directory and run setup and start scripts to test the SDK.
```bash
cd output/typescript/examples
npm run setup
npm run start
```
--------------------------------
### Add liblab Homebrew Tap
Source: https://liblab.com/docs/get-started/getting-started/index
Adds the liblab repository to your Homebrew taps, a prerequisite for installing the liblab CLI via Homebrew.
```bash
brew tap liblaber/homebrew-liblab
```
--------------------------------
### Test Python SDK
Source: https://liblab.com/docs/howto/go-huma/index
Steps to set up and run the generated Python SDK example. This includes making the install script executable, running it, activating the virtual environment, and executing the sample script.
```bash
cd output/python/examples
chmod +x install.sh
./install.sh
source .venv/bin/activate
python3 sample.py
```
--------------------------------
### Microsoft Clarity Initialization
Source: https://liblab.com/docs/cli/cli-installation
Integrates Microsoft Clarity for user behavior analytics. It loads the Clarity tracking script asynchronously to collect session data and heatmaps.
```javascript
!function(t,e,n,c,a,r,s){t[n]=t[n]||function(){(t[n].q=t[n].q||[]).push(arguments)},(r=e.createElement(c)).async=1,r.src="https://www.clarity.ms/tag/"+a,(s=e.getElementsByTagName(c)[0]).parentNode.insertBefore(r,s)}(window,document,"clarity","script","c5lcpjmqnd")
```
--------------------------------
### Run Docusaurus Site
Source: https://liblab.com/docs/tutorials/documentation/build-docusaurus-site/index
Commands to install dependencies and start the Docusaurus development server to view the documentation site.
```bash
cd llama-store-docs
npm install
npm run start
```
--------------------------------
### PostHog Initialization
Source: https://liblab.com/docs/cli/cli-installation
Initializes the PostHog analytics client with a specific API host and ID. It includes methods for capturing events, identifying users, and managing feature flags.
```javascript
!function(){var t,e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}();t=null!==e?e:"dark",document.documentElement.setAttribute("data-theme",t)}(),function(){try{for(var[t,e]of new URLSearchParams(window.location.search).entries())if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()
```
```javascript
!function(t,e){var o,s,r,a;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,n,p){(r=t.createElement("script")).type="text/javascript",r.async=!0,r.src=n.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(a=t.getElementsByTagName("script")[0]).parentNode.insertBefore(r,a);var c=e;void 0!==p?c=e[p]=[ ]:(p="posthog",c.people=c.people||[]),c.toString=function(t){var e="posthog";return"posthog"!==p&&(e+="."+p),t||(e+=" (stub)"),e},c.people.toString=function(){return c.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(" "),s=0;s {
const yourSdk = new YourSdk({
token: "YOUR_TOKEN",
});
const data = await yourSdk.store.getInventory();
console.log(data);
})();
```
--------------------------------
### Test C# SDK
Source: https://liblab.com/docs/howto/go-huma/index
Steps to set up and run the generated C# SDK example. This involves navigating to the example directory and running the project using the .NET CLI.
```bash
cd output/csharp/Example
dotnet run --framework net9.0
```
--------------------------------
### Setup Python Environment for AI GitHub Agent
Source: https://liblab.com/blog/how-ai-can-use-tools-to-integrate-with-external-systems
This snippet outlines the necessary steps to set up a Python environment for an AI GitHub agent example. It includes creating a directory, installing required libraries such as langgraph, langchain-core, langchain-openai, requests, and python-dotenv, and configuring environment variables like OPENAI_API_KEY and GITHUB_TOKEN.
```bash
mkdir ai-github-agent
cd ai-github-agent
pip install langgraph langchain-core langchain-openai requests python-dotenv
touch .env
# Add environment variables to .env file:
# OPENAI_API_KEY=your_openai_api_key_here
# GITHUB_TOKEN=your_github_personal_access_token_here
# Ensure your GITHUB_TOKEN has 'repo' scope for the example to work.
```