Cinnamon / kotaemon

An open-source RAG-based tool for chatting with your documents.
https://cinnamon.github.io/kotaemon/
Apache License 2.0
17.58k stars 1.36k forks source link

[BUG] Adobe loader conflict with openai URL #364

Closed micuentadecasa closed 1 month ago

micuentadecasa commented 1 month ago

Description

when changing the loader to adobe with good credentials I see this error:

Invalid URL '/openai/deployments/gpt-4o/chat/completions?api-version=2024-02-15-preview': No scheme supplied. Perhaps you meant https:///openai/deployments/gpt-4o/chat/completions?api-version=2024-02-15-preview?

Reproduction steps

change the loader to adobe
upload a file

Screenshots

![DESCRIPTION](LINK.png)

Logs

The error is this

Traceback (most recent call last):
  File "/app/libs/ktem/ktem/index/file/pipelines.py", line 726, in stream
    file_id, docs = yield from pipeline.stream(
  File "/app/libs/ktem/ktem/index/file/pipelines.py", line 588, in stream
    docs = self.loader.load_data(file_path, extra_info=extra_info)
  File "/app/libs/kotaemon/kotaemon/loaders/adobe_loader.py", line 128, in load_data
    figure_captions = generate_figure_captions(
  File "/app/libs/kotaemon/kotaemon/loaders/utils/adobe.py", line 245, in generate_figure_captions
    results = [future.result() for future in futures]
  File "/app/libs/kotaemon/kotaemon/loaders/utils/adobe.py", line 245, in <listcomp>
    results = [future.result() for future in futures]
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/app/libs/kotaemon/kotaemon/loaders/utils/adobe.py", line 240, in <lambda>
    lambda: generate_single_figure_caption(vlm_endpoint, figure)
  File "/app/libs/kotaemon/kotaemon/loaders/utils/adobe.py", line 208, in generate_single_figure_caption
    output = generate_gpt4v(
  File "/app/libs/kotaemon/kotaemon/loaders/utils/gpt4v.py", line 48, in generate_gpt4v
    response = requests.post(endpoint, headers=headers, json=payload)
  File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 575, in request
    prep = self.prepare_request(req)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 484, in prepare_request
    p.prepare(
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 367, in prepare
    self.prepare_url(url, params)
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 438, in prepare_url
    raise MissingSchema(
requests.exceptions.MissingSchema: Invalid URL '/openai/deployments/gpt-4o/chat/completions?api-version=2024-02-15-preview': No scheme supplied. Perhaps you meant https:///openai/deployments/gpt-4o/chat/completions?api-version=2024-02-15-preview?

Browsers

No response

OS

No response

Additional information

No response

a652 commented 1 month ago

need to specify the value of 'AZURE_OPENAI_ENDPOINT' and 'AZURE_OPENAI_API_KEY' in the .env file.