Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to share app.config.id with two programs with no success with huggingface (embedchain 0.1.88) #1291

Open
PhilFlash opened this issue Feb 28, 2024 · 0 comments

Comments

@PhilFlash
Copy link

馃悰 Describe the bug

I try to share documents with no success with huggingface

iwprog.yaml:

app:
  config:
    id: 'my-appli-1'
llm:
  provider: huggingface
  config:
    model: 'mistralai/Mistral-7B-Instruct-v0.2'
    top_p: 0.5

embedder:
  provider: huggingface
  config:
    model: 'sentence-transformers/all-mpnet-base-v2'

vectordb:
  provider: chroma
  config:
    collection_name: 'program-collection'
    dir: dbprog
    allow_reset: true

addpdf.py:

import os
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = "hf_token"

from embedchain import App
app = App.from_config("iwprog.yaml")

app.reset()
PDF_FILE =  os.path.join(os.getcwd(), 'mypdf.pdf')
app.add(PDF_FILE)

All is ok to read pdf

prog3.chat.py:

import os
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = "hf_token"

from embedchain import App

app = App.from_config(config={
  "app": {
    "config": {
      # this will persist and load data from app1 session
      "id": "my-appli-1",
    }
  }
})

while True:
    user_input = input("Enter your question (type 'exit' to quit): ")

    # Break the loop if the user types 'exit'
    if user_input.lower() in ['q', 'exit', 'quit']:
        break

    # Process the input and provide a response
    response = app.chat(user_input)
    print(response)

I have an error:

Traceback (most recent call last):
  File "E:\pythonProjects\ec_programs\prog3.chat.py", line 10, in <module>
    app = App.from_config(config={
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\pythonProjects\ec_programs\.venv\Lib\site-packages\embedchain\app.py", line 394, in from_config
    embedding_model = EmbedderFactory.create(
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\pythonProjects\ec_programs\.venv\Lib\site-packages\embedchain\factory.py", line 75, in create
    return embedder_class(config=embedder_config_class(**config_data))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\pythonProjects\ec_programs\.venv\Lib\site-packages\embedchain\embedder\openai.py", line 19, in __init__
    api_key = self.config.api_key or os.environ["OPENAI_API_KEY"]
                                     ~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 685, in __getitem__
KeyError: 'OPENAI_API_KEY'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant