Beautify JSON docs (#906)

Co-authored-by: Deven Patel <deven298@yahoo.com>
This commit is contained in:
Deven Patel
2023-11-03 13:52:33 -07:00
committed by GitHub
parent 23c912f2b7
commit 5428765329
4 changed files with 15 additions and 18 deletions

View File

@@ -12,7 +12,7 @@ Here are the supported sources for loading `json`:
``` ```
If you would like to add other data structures (e.x. list, dict etc.), do: If you would like to add other data structures (e.x. list, dict etc.), do:
``` ```python
import json import json
a = {"foo": "bar"} a = {"foo": "bar"}
valid_json_string_data = json.dumps(a, indent=0) valid_json_string_data = json.dumps(a, indent=0)
@@ -21,7 +21,7 @@ If you would like to add other data structures (e.x. list, dict etc.), do:
valid_json_string_data = json.dumps(b, indent=0) valid_json_string_data = json.dumps(b, indent=0)
``` ```
Example: Example:
``` ```python
import os import os
from embedchain.apps.app import App from embedchain.apps.app import App
@@ -43,7 +43,7 @@ print(response)
"As of October 2023, Elon Musk's net worth is $255.2 billion." "As of October 2023, Elon Musk's net worth is $255.2 billion."
``` ```
temp.json temp.json
``` ```json
{ {
"question": "What is your net worth, Elon Musk?", "question": "What is your net worth, Elon Musk?",
"answer": "As of October 2023, Elon Musk's net worth is $255.2 billion, making him one of the wealthiest individuals in the world." "answer": "As of October 2023, Elon Musk's net worth is $255.2 billion, making him one of the wealthiest individuals in the world."

View File

@@ -1,19 +1,16 @@
import os
import logging import logging
import os
import yaml import yaml
from fastapi import FastAPI, UploadFile, Depends, HTTPException from database import Base, SessionLocal, engine
from fastapi import Depends, FastAPI, HTTPException, UploadFile
from models import DefaultResponse, DeployAppRequest, QueryApp, SourceApp
from services import get_app, get_apps, remove_app, save_app
from sqlalchemy.orm import Session from sqlalchemy.orm import Session
from utils import generate_error_message_for_api_keys
from embedchain import Pipeline as App from embedchain import Pipeline as App
from embedchain.client import Client from embedchain.client import Client
from models import (
QueryApp,
SourceApp,
DefaultResponse,
DeployAppRequest,
)
from database import Base, engine, SessionLocal
from services import get_app, save_app, get_apps, remove_app
from utils import generate_error_message_for_api_keys
Base.metadata.create_all(bind=engine) Base.metadata.create_all(bind=engine)

View File

@@ -1,7 +1,8 @@
from typing import Optional from typing import Optional
from pydantic import BaseModel, Field
from sqlalchemy import Column, String, Integer
from database import Base from database import Base
from pydantic import BaseModel, Field
from sqlalchemy import Column, Integer, String
class QueryApp(BaseModel): class QueryApp(BaseModel):

View File

@@ -1,6 +1,5 @@
from sqlalchemy.orm import Session
from models import AppModel from models import AppModel
from sqlalchemy.orm import Session
def get_app(db: Session, app_id: str): def get_app(db: Session, app_id: str):