forked from nomic-ai/gpt4all
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'nomic-ai:main' into main
- Loading branch information
Showing
109 changed files
with
4,617 additions
and
1,373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
blank_issues_enabled: false | ||
version: 2.1 | ||
version: 2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,4 +183,7 @@ build_* | |
build-* | ||
|
||
# IntelliJ | ||
.idea/ | ||
.idea/ | ||
|
||
# LLM models | ||
*.gguf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,39 @@ | ||
import logging | ||
from typing import Dict, List | ||
|
||
from api_v1.settings import settings | ||
from fastapi import APIRouter, Depends, Response, Security, status | ||
import requests | ||
from fastapi import APIRouter, HTTPException | ||
from pydantic import BaseModel, Field | ||
from typing import List, Dict | ||
|
||
logger = logging.getLogger(__name__) | ||
logger.setLevel(logging.DEBUG) | ||
|
||
### This should follow https://github.com/openai/openai-openapi/blob/master/openapi.yaml | ||
|
||
# Define the router for the engines module | ||
router = APIRouter(prefix="/engines", tags=["Search Endpoints"]) | ||
|
||
# Define the models for the engines module | ||
class ListEnginesResponse(BaseModel): | ||
data: List[Dict] = Field(..., description="All available models.") | ||
|
||
|
||
class EngineResponse(BaseModel): | ||
data: List[Dict] = Field(..., description="All available models.") | ||
|
||
|
||
router = APIRouter(prefix="/engines", tags=["Search Endpoints"]) | ||
|
||
|
||
# Define the routes for the engines module | ||
@router.get("/", response_model=ListEnginesResponse) | ||
async def list_engines(): | ||
''' | ||
List all available GPT4All models from | ||
https://raw.githubusercontent.com/nomic-ai/gpt4all/main/gpt4all-chat/metadata/models2.json | ||
''' | ||
raise NotImplementedError() | ||
return ListEnginesResponse(data=[]) | ||
|
||
|
||
try: | ||
response = requests.get('https://raw.githubusercontent.com/nomic-ai/gpt4all/main/gpt4all-chat/metadata/models2.json') | ||
response.raise_for_status() # This will raise an HTTPError if the HTTP request returned an unsuccessful status code | ||
engines = response.json() | ||
return ListEnginesResponse(data=engines) | ||
except requests.RequestException as e: | ||
logger.error(f"Error fetching engine list: {e}") | ||
raise HTTPException(status_code=500, detail="Error fetching engine list") | ||
|
||
# Define the routes for the engines module | ||
@router.get("/{engine_id}", response_model=EngineResponse) | ||
async def retrieve_engine(engine_id: str): | ||
''' ''' | ||
|
||
raise NotImplementedError() | ||
return EngineResponse() | ||
try: | ||
# Implement logic to fetch a specific engine's details | ||
# This is a placeholder, replace with your actual data retrieval logic | ||
engine_details = {"id": engine_id, "name": "Engine Name", "description": "Engine Description"} | ||
return EngineResponse(data=[engine_details]) | ||
except Exception as e: | ||
logger.error(f"Error fetching engine details: {e}") | ||
raise HTTPException(status_code=500, detail=f"Error fetching details for engine {engine_id}") |
Oops, something went wrong.