GPTCache is ignoring cached question for the same session #583
Unanswered
Sebastian7C
asked this question in
Q&A
Replies: 1 comment 1 reply
-
the test example maybe help you to solve the problem GPTCache/tests/unit_tests/test_session.py Lines 83 to 122 in acc20f0 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm facing an issue with storing my cache by session. When I use the same session for a question that has already been cached, it seems like the cache is completely ignored. Here's a snippet of my code:
`from gptcache.session import Session
from gptcache import cache
from gptcache.adapter import openai
import os
cache.init()
cache.set_openai_key()
Creating a session
session = Session(name="my-session")
Asking a question and getting a response
response = openai.ChatCompletion.create(
model='gpt-3.5-turbo',
messages=[
{
'role': 'user',
'content': "what's Github"
}],
session=session,
temperature=0.9
)
Asking the same question again with the same session
response = openai.ChatCompletion.create(
model='gpt-3.5-turbo',
messages=[
{
'role': 'user',
'content': "what's Github"
}],
session=session,
temperature=0.9
)
`
I'm wondering if anyone has insights on how to make sessions work properly in this context. Any help would be appreciated. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions