by Anonymous » 16 Mar 2025, 17:17
Ich beginne mit OpenAI -API und experimentiere mit Langchain. Ich habe eine .csv -Datei mit ungefähr 1000 Zeilen und 85 Spalten mit Zeichenfolgenwerten. Ich fand einen Anfängerartikel, dem ich gefolgt bin, und habe ein Colab -Notizbuch mit dem folgenden Code: < /p>
Code: Select all
txt_file_path = '/content/drive/My Drive/Colab Notebooks/preprocessed_data_10.csv'
with open(txt_file_path, 'r', encoding="utf-8") as file:
data = file.read()
txt_file_path = '/content/drive/My Drive/Colab Notebooks/preprocessed_data_10.csv'
loader = TextLoader(file_path=txt_file_path, encoding="utf-8")
data = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
data = text_splitter.split_documents(data)
embeddings = OpenAIEmbeddings()
vectorstore = FAISS.from_documents(data, embedding=embeddings)
llm = ChatOpenAI(temperature=0.7, model_name="gpt-4")
memory = ConversationBufferMemory(memory_key='chat_history', return_messages=True)
conversation_chain = ConversationalRetrievalChain.from_llm(
llm=llm,
chain_type="stuff",
retriever=vectorstore.as_retriever(),
memory=memory
)
query = "question"
result = conversation_chain({"question": query})
answer = result["answer"]
answer
< /code>
Die Fehler, die ich habe, waren: < /p>
Error code: 429 - {'error': {'message': 'Request too large for gpt-4 in organization org-xxx on tokens per min (TPM): Limit 10000, Requested 139816.
< /code>
und < /p>
BadRequestError: Error code: 400 - {'error': {'message': "This model's maximum context length is 8192 tokens. However, your messages resulted in 32045 tokens.
Ich habe versucht herauszufinden, wie große CSV -Datei ich sie füttern kann, und reduzieren die Datei für 10 Zeilen und 53 Spalten.>
Ich beginne mit OpenAI -API und experimentiere mit Langchain. Ich habe eine .csv -Datei mit ungefähr 1000 Zeilen und 85 Spalten mit Zeichenfolgenwerten. Ich fand einen Anfängerartikel, dem ich gefolgt bin, und habe ein Colab -Notizbuch mit dem folgenden Code: < /p>
[code]txt_file_path = '/content/drive/My Drive/Colab Notebooks/preprocessed_data_10.csv'
with open(txt_file_path, 'r', encoding="utf-8") as file:
data = file.read()
txt_file_path = '/content/drive/My Drive/Colab Notebooks/preprocessed_data_10.csv'
loader = TextLoader(file_path=txt_file_path, encoding="utf-8")
data = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
data = text_splitter.split_documents(data)
embeddings = OpenAIEmbeddings()
vectorstore = FAISS.from_documents(data, embedding=embeddings)
llm = ChatOpenAI(temperature=0.7, model_name="gpt-4")
memory = ConversationBufferMemory(memory_key='chat_history', return_messages=True)
conversation_chain = ConversationalRetrievalChain.from_llm(
llm=llm,
chain_type="stuff",
retriever=vectorstore.as_retriever(),
memory=memory
)
query = "question"
result = conversation_chain({"question": query})
answer = result["answer"]
answer
< /code>
Die Fehler, die ich habe, waren: < /p>
Error code: 429 - {'error': {'message': 'Request too large for gpt-4 in organization org-xxx on tokens per min (TPM): Limit 10000, Requested 139816.
< /code>
und < /p>
BadRequestError: Error code: 400 - {'error': {'message': "This model's maximum context length is 8192 tokens. However, your messages resulted in 32045 tokens.
[/code]
Ich habe versucht herauszufinden, wie große CSV -Datei ich sie füttern kann, und reduzieren die Datei für 10 Zeilen und 53 Spalten.>