[Doc update] update mistral example (#1012)
This commit is contained in:
@@ -13,7 +13,6 @@ Use the model provided on huggingface: `mistralai/Mistral-7B-v0.1`
|
|||||||
import os
|
import os
|
||||||
from embedchain import Pipeline as App
|
from embedchain import Pipeline as App
|
||||||
|
|
||||||
os.environ["OPENAI_API_KEY"] = "sk-xxx"
|
|
||||||
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = "hf_your_token"
|
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = "hf_your_token"
|
||||||
|
|
||||||
app = App.from_config("huggingface.yaml")
|
app = App.from_config("huggingface.yaml")
|
||||||
@@ -27,6 +26,11 @@ llm:
|
|||||||
max_tokens: 1000
|
max_tokens: 1000
|
||||||
top_p: 0.5
|
top_p: 0.5
|
||||||
stream: false
|
stream: false
|
||||||
|
|
||||||
|
embedder:
|
||||||
|
provider: huggingface
|
||||||
|
config:
|
||||||
|
model: 'sentence-transformers/all-mpnet-base-v2'
|
||||||
```
|
```
|
||||||
</CodeGroup>
|
</CodeGroup>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
from pathlib import Path
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import logging
|
import logging
|
||||||
from typing import Optional, Dict, Any
|
from pathlib import Path
|
||||||
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from embedchain.utils import detect_datatype
|
from embedchain.config import AddConfig
|
||||||
|
from embedchain.data_formatter.data_formatter import DataFormatter
|
||||||
from embedchain.helpers.json_serializable import register_deserializable
|
from embedchain.helpers.json_serializable import register_deserializable
|
||||||
from embedchain.loaders.base_loader import BaseLoader
|
from embedchain.loaders.base_loader import BaseLoader
|
||||||
from embedchain.loaders.local_text import LocalTextLoader
|
from embedchain.loaders.local_text import LocalTextLoader
|
||||||
from embedchain.data_formatter.data_formatter import DataFormatter
|
from embedchain.utils import detect_datatype
|
||||||
from embedchain.config import AddConfig
|
|
||||||
|
|
||||||
|
|
||||||
@register_deserializable
|
@register_deserializable
|
||||||
|
|||||||
@@ -196,7 +196,8 @@ def detect_datatype(source: Any) -> DataType:
|
|||||||
formatted_source = format_source(str(source), 30)
|
formatted_source = format_source(str(source), 30)
|
||||||
|
|
||||||
if url:
|
if url:
|
||||||
from langchain.document_loaders.youtube import ALLOWED_NETLOCK as YOUTUBE_ALLOWED_NETLOCS
|
from langchain.document_loaders.youtube import \
|
||||||
|
ALLOWED_NETLOCK as YOUTUBE_ALLOWED_NETLOCS
|
||||||
|
|
||||||
if url.netloc in YOUTUBE_ALLOWED_NETLOCS:
|
if url.netloc in YOUTUBE_ALLOWED_NETLOCS:
|
||||||
logging.debug(f"Source of `{formatted_source}` detected as `youtube_video`.")
|
logging.debug(f"Source of `{formatted_source}` detected as `youtube_video`.")
|
||||||
|
|||||||
Reference in New Issue
Block a user