Sfoglia il codice sorgente

Beautify JSON docs (#906)

Co-authored-by: Deven Patel <deven298@yahoo.com>
Deven Patel 1 anno fa
parent
commit
5428765329

+ 3 - 3
docs/data-sources/json.mdx

@@ -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:
-```
+```python
     import json
     a = {"foo": "bar"}
     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)
 ```
 Example:
-```
+```python
 import os
 
 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."
 ```
 temp.json
-```
+```json
 {
     "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."

+ 8 - 11
examples/rest-api/main.py

@@ -1,19 +1,16 @@
-import os
 import logging
+import os
+
 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 utils import generate_error_message_for_api_keys
+
 from embedchain import Pipeline as App
 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)
 

+ 3 - 2
examples/rest-api/models.py

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

+ 1 - 2
examples/rest-api/services.py

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