Я пытаюсь создать приключенческую игру с ИИ, основанную на этом руководстве Поддерживается.from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider
from langchain.memory import CassandraChatMessageHistory, ConversationBufferMemory
from langchain.llms import OpenAI
from langchain import LLMChain, PromptTemplate
import json
cloud_config= {
'secure_connect_bundle': 'secure-connect-choose-your-own-adventure.zip'
}
with open("choose_your_own_adventure-token.json") as f:
secrets = json.load(f)
CLIENT_ID = secrets["clientId"]
CLIENT_SECRET = secrets["secret"]
ASTRA_DB_KEYSPACE = ""
OPENAI_API_KEY = ""
auth_provider = PlainTextAuthProvider(CLIENT_ID, CLIENT_SECRET)
cluster = Cluster(cloud=cloud_config, auth_provider=auth_provider)
session = cluster.connect()
message_history = CassandraChatMessageHistory(
session_id="anything",
session=session,
keyspace=ASTRA_DB_KEYSPACE,
ttl_seconds=3600
)
message_history.clear()
cass_buff_memory = ConversationBufferMemory(
memory_key="chat_history",
chat_memory=message_history
)
template = """..."""
prompt = PromptTemplate(
input_variables=["chat_history", "human_input"],
template=template
)
llm = OpenAI(openai_api_key=OPENAI_API_KEY)
llm_chain = LLMChain(
llm=llm,
prompt=prompt,
memory=cass_buff_memory
)
choice = "start"
while True:
response = llm_chain.predict(human_input=choice)
print(response.strip())
if "The End." in response:
break
choice = input("Your reply: ") ```
I tried to import libraries and expected them to work
Подробнее здесь: https://stackoverflow.com/questions/772 ... -supported
Импорт LLMchain из корневого модуля Langchain больше не поддерживается ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Импорт LLMchain из корневого модуля Langchain больше не поддерживается
Anonymous » » в форуме Python - 0 Ответы
- 2 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Userwarnning: импорт словеса из корневого модуля Langchain больше не поддерживается
Anonymous » » в форуме Python - 0 Ответы
- 2 Просмотры
-
Последнее сообщение Anonymous
-