zilliztech / GPTCache

Semantic cache for LLMs. Fully integrated with LangChain and llama_index.
https://gptcache.readthedocs.io
MIT License
6.89k stars 480 forks source link

Adapter the openai 1.x version #614

Closed SimFG closed 3 months ago

sre-ci-robot commented 4 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SimFG

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/zilliztech/GPTCache/blob/dev/OWNERS)~~ [SimFG] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 62.16216% with 28 lines in your changes are missing coverage. Please review.

Project coverage is 72.68%. Comparing base (44d1a66) to head (bcf9310). Report is 15 commits behind head on dev.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/zilliztech/GPTCache/pull/614/graphs/tree.svg?width=650&height=150&src=pr&token=E30WxqBeJJ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zilliztech)](https://app.codecov.io/gh/zilliztech/GPTCache/pull/614?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zilliztech) ```diff @@ Coverage Diff @@ ## dev #614 +/- ## =========================================== - Coverage 92.92% 72.68% -20.24% =========================================== Files 97 99 +2 Lines 4253 4166 -87 =========================================== - Hits 3952 3028 -924 - Misses 301 1138 +837 ``` | [Files](https://app.codecov.io/gh/zilliztech/GPTCache/pull/614?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zilliztech) | Coverage Δ | | |---|---|---| | [gptcache/embedding/openai.py](https://app.codecov.io/gh/zilliztech/GPTCache/pull/614?src=pr&el=tree&filepath=gptcache%2Fembedding%2Fopenai.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zilliztech#diff-Z3B0Y2FjaGUvZW1iZWRkaW5nL29wZW5haS5weQ==) | `0.00% <ø> (-94.12%)` | :arrow_down: | | [gptcache/utils/\_\_init\_\_.py](https://app.codecov.io/gh/zilliztech/GPTCache/pull/614?src=pr&el=tree&filepath=gptcache%2Futils%2F__init__.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zilliztech#diff-Z3B0Y2FjaGUvdXRpbHMvX19pbml0X18ucHk=) | `77.41% <100.00%> (-11.93%)` | :arrow_down: | | [gptcache/utils/response.py](https://app.codecov.io/gh/zilliztech/GPTCache/pull/614?src=pr&el=tree&filepath=gptcache%2Futils%2Fresponse.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zilliztech#diff-Z3B0Y2FjaGUvdXRpbHMvcmVzcG9uc2UucHk=) | `69.23% <75.00%> (-30.77%)` | :arrow_down: | | [gptcache/adapter/openai.py](https://app.codecov.io/gh/zilliztech/GPTCache/pull/614?src=pr&el=tree&filepath=gptcache%2Fadapter%2Fopenai.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zilliztech#diff-Z3B0Y2FjaGUvYWRhcHRlci9vcGVuYWkucHk=) | `64.15% <90.47%> (-17.43%)` | :arrow_down: | | [gptcache/adapter/\_util.py](https://app.codecov.io/gh/zilliztech/GPTCache/pull/614?src=pr&el=tree&filepath=gptcache%2Fadapter%2F_util.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zilliztech#diff-Z3B0Y2FjaGUvYWRhcHRlci9fdXRpbC5weQ==) | `47.91% <47.91%> (ø)` | | ... and [29 files with indirect coverage changes](https://app.codecov.io/gh/zilliztech/GPTCache/pull/614/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zilliztech)
shashankram commented 2 weeks ago

@SimFG I am still seeing an issue with gptcache when using the OpenAI embeddings:

  File "/test/.venv/lib/python3.10/site-packages/gptcache/embedding/openai.py", line 37, in __init__
    if openai.api_base:
AttributeError: module 'openai' has no attribute 'api_base'. Did you mean: 'api_type'?

Is gptcache not compatible with the latest openai module? Is there a newer version of the gptcache pakcage that is published to the pip repo? The last one was released on November 2023.