Skip to content

Commit

Permalink
fix: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
leoguillaumegouv committed Oct 16, 2024
1 parent 3b3ba37 commit cc6cc17
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/endpoints/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ async def upload_file(file: UploadFile = File(...), request: FilesRequest = Body
Supported files types:
- pdf: Portable Document Format file.
- json: JavaScript Object Notation file.
For JSON, file structure like a list of documents: [{"text": "hello world", "metadata": {"title": "my document"}}, ...]} or [{"text": "hello world"}, ...]}
Each document must have a "text" key and "metadata" key (optional) with dict type value.
For JSON, file structure like a list of documents: [{"text": "hello world", "title": "my document", "metadata": {"autor": "me"}}, ...]} or [{"text": "hello world", "title": "my document"}, ...]}
Each document must have a "text" and "title" keys and "metadata" key (optional) with dict type value.
- html: Hypertext Markup Language file.
Max file size is 10MB.
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/_modelclients.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def create_embeddings(self, *args, **kwargs):


class ModelClient(OpenAI):
DEFAULT_TIMEOUT = 10
DEFAULT_TIMEOUT = 60

def __init__(self, type=Literal[EMBEDDINGS_MODEL_TYPE, LANGUAGE_MODEL_TYPE], *args, **kwargs):
"""
Expand Down
12 changes: 11 additions & 1 deletion docs/tutorials/chat_completions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
"# Chat completions"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0df030ba",
"metadata": {},
"outputs": [],
"source": [
"%pip install -qU openai"
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand Down Expand Up @@ -79,7 +89,7 @@
"for chunk in response:\n",
" if chunk.choices[0].finish_reason is not None:\n",
" break\n",
" print(chunk.choices[0].delta.content, end=\"\", flush=True)"
" print(chunk.choices[0].delta.content, end=\"\\n\", flush=True)"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/import_knowledge_database.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"source": [
"Le format du fichier doit être JSON, ici nous n'avons pas besoin de le convertir. En revanche, il est possible que le fichier ne respecte pas la structure définit dans la documentation de l'API.\n",
"\n",
"De plus le fichier ne doit pas dépasser 5MB, il est donc nécessaire de le découper en plusieurs fichiers."
"De plus le fichier ne doit pas dépasser 10MB, il est donc nécessaire de le découper en plusieurs fichiers."
]
},
{
Expand Down
4 changes: 3 additions & 1 deletion ui/pages/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@
with col1:
with st.expander("Upload a file", icon="📑"):
collection = st.selectbox(
"Select a collection", [f"{collection["name"]} - {collection["id"]}" for collection in collections], key="upload_file_selectbox"
"Select a collection",
[f"{collection["name"]} - {collection["id"]}" for collection in collections if collection["type"] == PRIVATE_COLLECTION_TYPE],
key="upload_file_selectbox",
)
collection_id = collection.split(" - ")[-1]
file_to_upload = st.file_uploader("File", type=["pdf", "html", "json"])
Expand Down

0 comments on commit cc6cc17

Please sign in to comment.