Releases: zilliztech/GPTCache
v0.1.25
🎉 Introduction to new functions of GPTCache
- Support the DocArray vector database
from gptcache.manager import manager_factory
data_manager = manager_factory("sqlite,docarray")
- Add rwkv model for embedding
from gptcache.embedding import Rwkv
test_sentence = 'Hello, world.'
encoder = Rwkv(model='sgugger/rwkv-430M-pile')
embed = encoder.to_embeddings(test_sentence)
What's Changed
- [skip ci]Add workflow to publish release image by @Bennu-Li in #345
- Update the doc directory by @SimFG in #348
- Add the docker image doc by @SimFG in #349
- DocArray as a vectorstore by @jupyterjazz in #351
- Fix the doc generation failure by @SimFG in #352
- Replace base image and simplify dockerfile by @Chiiizzzy in #353
- Example with DocArray by @jupyterjazz in #354
- Add comments for session by @shiyu22 in #355
- DocArray example adjustment by @jupyterjazz in #356
- Improve the generation doc script by @SimFG in #358
- Change the model test cases as L2 cases by @SimFG in #362
- Add concat_context. by @wxywb in #365
- Add the pre/report/session docs by @SimFG in #364
- Add rwkv model for embedding. by @wxywb in #363
- Update the version to
0.1.25
by @SimFG in #367
New Contributors
- @jupyterjazz made their first contribution in #351
Full Changelog: 0.1.24...0.1.25
v0.1.24
🎉 Introduction to new functions of GPTCache
- Support the langchain embedding
from gptcache.embedding import LangChain
from langchain.embeddings.openai import OpenAIEmbeddings
test_sentence = 'Hello, world.'
embeddings = OpenAIEmbeddings(model="your-embeddings-deployment-name")
encoder = LangChain(embeddings=embeddings)
embed = encoder.to_embeddings(test_sentence)
- Add gptcache client
from gptcache import Client
client = Client()
client.put("Hi", "Hi back")
ans = client.get("Hi")
- Support pgvector as vector store
from gptcache.manager import manager_factory
data_manager = manager_factory("sqlite,pgvector", vector_params={"dimension": 10})
- Add the GPTCache server doc
reference: https://github.com/zilliztech/GPTCache/blob/main/docs/usage.md#Build-GPTCache-server
What's Changed
Full Changelog: 0.1.23...0.1.24
v0.1.23
🎉 Introduction to new functions of GPTCache
- Support the session for the
LangChainLLMs
from langchain import OpenAI
from gptcache.adapter.langchain_models import LangChainLLMs
from gptcache.session import Session
session = Session(name="sqlite-example")
llm = LangChainLLMs(llm=OpenAI(temperature=0), session=session)
- Optimize the summarization context process
from gptcache import cache
from gptcache.processor.context.summarization_context import SummarizationContextProcess
context_process = SummarizationContextProcess()
cache.init(
pre_embedding_func=context_process.pre_process,
)
- Add BabyAGI bootcamp
details: https://github.com/zilliztech/GPTCache/blob/main/docs/bootcamp/langchain/baby_agi.ipynb
What's Changed
- Update langchain llms with session by @shiyu22 in #327
- Wrap gptcache server in a docker image by @Chiiizzzy in #329
- Fix requirements conflict for sphinx by @jaelgu in #330
- Use self-hosted tokenizer and update summarization context. by @wxywb in #331
- Optimize some code by @SimFG in #333
- Add BabyAGI bootcamp by @shiyu22 in #334
- Improve the api for the
import_ruamel
by @SimFG in #336
Full Changelog: 0.1.22...0.1.23
v0.1.22
🎉 Introduction to new functions of GPTCache
- Process the dialog context through the context processing interface, which currently supports two ways: summarize and selective context
import transformers
from gptcache.processor.context.summarization_context import SummarizationContextProcess
from gptcache.processor.context.selective_context import SelectiveContextProcess
from gptcache import cache
summarizer = transformers.pipeline("summarization", model="facebook/bart-large-cnn")
context_process = SummarizationContextProcess(summarizer, None, 512)
cache.init(
pre_embedding_func=context_process.pre_process,
)
context_processor = SelectiveContextProcess()
cache.init(
pre_embedding_func=context_process.pre_process,
)
What's Changed
- Add SummarizationContextProcess by @wxywb in #316
- Support duckdb by @SimFG in #323
- Add cmd for gptcache server by @Chiiizzzy in #325
- Support the selective context processor by @SimFG in #326
Full Changelog: 0.1.21...0.1.22
v0.1.21
🎉 Introduction to new functions of GPTCache
- Support the temperature param
from gptcache.adapter import openai
openai.ChatCompletion.create(
model="gpt-3.5-turbo",
temperature = 1.0, # Change temperature here
messages=[{
"role": "user",
"content": question
}],
)
- Add the session layer
from gptcache.adapter import openai
from gptcache.session import Session
session = Session(name="my-session")
question = "what do you think about chatgpt"
openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "user", "content": question}
],
session=session
)
details: https://github.com/zilliztech/GPTCache/tree/main/examples#How-to-run-with-session
- Support config cache with yaml for server
from gptcache.adapter.api import init_similar_cache_from_config
init_similar_cache_from_config(config_dir="cache_config_template.yml")
config file template: https://github.com/zilliztech/GPTCache/blob/main/cache_config_template.yml
- Adapt the dolly model
from gptcache.adapter.dolly import Dolly
llm = Dolly.from_model(model="databricks/dolly-v2-3b")
llm(question)
What's Changed
- Use temperature to control possibility of skip_cache by @jaelgu in #306
- Add template for similar cache init config by @Chiiizzzy in #308
- Add dolly by @junjiejiangjjj in #311
- Add session usage doc by @shiyu22 in #310
- Add docs for temperature by @jaelgu in #312
- Dolly and llama docs by @junjiejiangjjj in #314
- Some minor polish on cache init by @Chiiizzzy in #313
- Update the version to
0.1.21
by @SimFG in #318
Full Changelog: 0.1.20...0.1.21
v0.1.20
🎉 Introduction to new functions of GPTCache
- support the
temperature
param, like openai
A non-negative number of sampling temperature, defaults to 0.
A higher temperature makes the output more random.
A lower temperature means a more deterministic and confident output.
- Add llama adapter
from gptcache.adapter.llama_cpp import Llama
llm = Llama('./models/7B/ggml-model.bin')
answer = llm(prompt=question)
Full Changelog: 0.1.19...0.1.20
v0.1.19
🎉 Introduction to new functions of GPTCache
- Add stability sdk adapter (text -> image)
import os
import time
from gptcache import cache
from gptcache.processor.pre import get_prompt
from gptcache.adapter.stability_sdk import StabilityInference, generation
from gptcache.embedding import Onnx
from gptcache.manager.factory import manager_factory
from gptcache.similarity_evaluation.distance import SearchDistanceEvaluation
# init gptcache
onnx = Onnx()
data_manager = manager_factory('sqlite,faiss,local',
data_dir='./',
vector_params={'dimension': onnx.dimension},
object_params={'path': './images'}
)
cache.init(
pre_embedding_func=get_prompt,
embedding_func=onnx.to_embeddings,
data_manager=data_manager,
similarity_evaluation=SearchDistanceEvaluation()
)
api_key = os.getenv('STABILITY_KEY', 'key-goes-here')
stability_api = StabilityInference(
key=os.environ['STABILITY_KEY'], # API Key reference.
verbose=False, # Print debug messages.
engine='stable-diffusion-xl-beta-v2-2-2', # Set the engine to use for generation.
)
start = time.time()
answers = stability_api.generate(
prompt='a cat sitting besides a dog',
width=256,
height=256
)
stability reference: https://platform.stability.ai/docs/features/text-to-image
- Add minigpt4 adapter
Notice: It cannot be used directly, it needs to cooperate with mini-GPT4 source code, refer to: Vision-CAIR/MiniGPT-4#136
What's Changed
- Unify the format of
manager
variable names inmanager_factory
method by @SimFG in #276 - Adapt stability_sdk by @jaelgu in #277
- Add minigpt4 adapter by @shiyu22 in #274
- Update docs by @jaelgu in #278
- Make np evaluation positively correlated with the similarity. by @wxywb in #280
- Add temperature_softmax in post processor by @jaelgu in #282
- Update the version to
0.1.19
by @SimFG in #283
Full Changelog: 0.1.18...0.1.19
v0.1.18
🎉 Introduction to new functions of GPTCache
- Add vqa bootcamp
reference: https://github.com/zilliztech/GPTCache/tree/main/docs/bootcamp/replicate
- Add two streamlit multimodal demos
reference: https://github.com/zilliztech/GPTCache/tree/main/docs/bootcamp/streamlit
- Add vit image embedding func
from gptcache.embedding import ViT
encoder = ViT(model="google/vit-base-patch16-384")
embed = encoder.to_embeddings(image)
- Add
init_similar_cache
func for the GPTCache api module
from gptcache.adapter.api import init_similar_cache
init_similar_cache("cache_data")
- The simple GPTCache server provides similar cache
- clone the GPTCache repo,
git clone https://github.com/zilliztech/GPTCache.git
- install the gptcache model,
pip install gptcache
- run the GPTCache server,
cd gptcache_server && python server.py
What's Changed
- Add vqa bootcamp by @shiyu22 in #263
- Update vqa bootcamp by @shiyu22 in #265
- Modify np evaluation to support vqa by @jaelgu in #264
- Update README by @shiyu22 in #266
- Add evaluation options in vqa bootcamp by @jaelgu in #267
- Add two streamlit demos. by @wxywb in #268
- feat: Implement vit image embedding by @Pouyanpi in #270
- Add
init_similar_cache
func for providing easier similar cache init by @SimFG in #272 - Update sql example by @shiyu22 in #273
- Update the version to
0.1.18
by @SimFG in #275
Full Changelog: 0.1.17...0.1.18
v0.1.17
🎉 Introduction to new functions of GPTCache
- Add image embedding timm
import requests
from PIL import Image
from gptcache.embedding import Timm
url = 'https://raw.githubusercontent.com/zilliztech/GPTCache/main/docs/GPTCache.png'
image = Image.open(requests.get(url, stream=True).raw) # Read image url as PIL.Image
encoder = Timm(model='resnet18')
image_tensor = encoder.preprocess(image)
embed = encoder.to_embeddings(image_tensor)
- Add Replicate adapter, vqa (visual question answering) (experimental)
from gptcache.adapter import replicate
question = "what is in the image?"
replicate.run(
"andreasjansson/blip-2:xxx",
input={
"image": open(image_path, 'rb'),
"question": question
}
)
- Support to flush data for preventing accidental loss of memory data
from gptcache import cache
cache.flush()
What's Changed
- Add image embedding timm by @jaelgu in #249
- Fix typo in release_note.md by @eltociear in #251
- Allow image path or file-like object as input of image embedding by @jaelgu in #252
- Fix docs by @junjiejiangjjj in #250
- Add replicate run adapter by @shiyu22 in #248
- Fix adapter with image object store by @jaelgu in #253
- Fix image mode issue by @jaelgu in #254
- Fix that 'NoneType' object has no attribute 'answers' by @SimFG in #256
- Update the bootcamp doc by @shiyu22 in #257
- Support to flush data for preventing accidental loss of memory data by @SimFG in #258
- Add evaluator for vqa by @jaelgu in #259
- Enable adapter.replicate docstring in API reference by @jaelgu in #260
- Update the version to
0.1.17
by @SimFG in #261
New Contributors
- @eltociear made their first contribution in #251
Full Changelog: 0.1.16...0.1.17
v0.1.16
🎉 Introduction to new functions of GPTCache
- Add StableDiffusion adapter (experimental)
import torch
from gptcache.adapter.diffusers import StableDiffusionPipeline
from gptcache.processor.pre import get_prompt
from gptcache import cache
cache.init(
pre_embedding_func=get_prompt,
)
model_id = "stabilityai/stable-diffusion-2-1"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
prompt = "a photo of an astronaut riding a horse on mars"
pipe(prompt=prompt).images[0]
-
Add speech to text bootcamp, link
-
More convenient management of cache files
from gptcache.manager.factory import manager_factory
data_manager = manager_factory('sqlite,faiss', data_dir="test_cache", vector_params={"dimension": 5})
- Add a simple GPTCache server (experimental)
After starting this server, you can:
- put the data to cache, like:
curl -X PUT -d "receive a hello message" "http://localhost:8000?prompt=hello"
- get the data from cache, like:
curl -X GET "http://localhost:8000?prompt=hello"
Currently the service is just a map cache, more functions are still under development.
What's Changed
- Adapt StableDiffusion by @jaelgu in #234
- Add audio embedding with data2vec by @jaelgu in #238
- Support multi-model question by @junjiejiangjjj in #235
- Add speech to text bootcamp by @shiyu22 in #239
- Fix auto API references script for gptcache.adapter by @jaelgu in #240
- Update README with multimodal adapter in modules by @jaelgu in #242
- Add manager_factory to create data_manager by @junjiejiangjjj in #241
- Add a simple GPTCache server by @SimFG in #244
Full Changelog: 0.1.15...0.1.16