SyncCursorPage[Message](data=[Message(id='msg_Z6iImlhDNFDmXoCszSl8hOrp', assistant_id='asst_eYsWBFev7jeZZC3MRyZ9PuJK', attachments=[], completed_at=None, content=[TextContentBlock(text=Text(annotations=[FileCitationAnnotation
(end_index=117, file_citation=FileCitation(file_id='file-v3Y3HH9Kd0L2doxuoRVNU6kL'), start_index=99, text='【4:0†workText.txt】', type='file_citation')],
value='The name of the location is "Benediktinerabtei Gerleve" which is located in Billerbeck, Deutschland【4:0†workText.txt】.'), type='text')], created_at=1729687317, incomplete_at=None, incomplete_details=None,
metadata={}, object='thread.message', role='assistant', run_id='run_6KbPCSO8VqIP0bbqFjuSp4fV', status=None, thread_id='thread_aaRH59cvaPGh5L0J8WIviBBU'), Message(id='msg_GPAug3kAr7GSRSEuIPRUmYvc', assistant_id=None,
ttachments=[], completed_at=None, content=[TextContentBlock(text=Text(annotations=[], value='\n\nWhat is the name of the location?\n\n'), type='text')], created_at=1729687313, incomplete_at=None, incomplete_details=None,
metadata={}, object='thread.message', role='user', run_id=None, status=None, thread_id='thread_aaRH59cvaPGh5L0J8WIviBBU')], object='list', first_id='msg_Z6iImlhDNFDmXoCszSl8hOrp', last_id='msg_GPAug3kAr7GSRSEuIPRUmYvc', has_more=False)
Но с другим API-ключом, похоже, это не работает - данные не выводятся -
Message(id='msg_NCxFnnQPXL0gKhsxE2hJhYWh', assistant_id=None, attachments=[], completed_at=None, content=[TextContentBlock(text=Text(annotations=[],
value='\nWhat is the name of the location?\n'), type='text')], created_at=1729696968, incomplete_at=None, incomplete_details=None, metadata={},
object='thread.message', role='user', run_id=None, status=None, thread_id='thread_puBTFtaoMvauMBO2D6Wc2ylr')
Почему с одним ключом API работает, а с другим нет...?
У меня есть следующий простой помощник, использующий модель gpt-4o — [code]import os import sys from dotenv import load_dotenv from openai import OpenAI
print(f"Preparing assistant") assistant = client.beta.assistants.create( name="HTML Analyse Assistant", instructions="You are a machine learning researcher, answer questions about the provided text-file", model="gpt-4o", tools=[{"type": "file_search"}], ) assistant = client.beta.assistants.update( assistant_id=assistant.id, tool_resources={"file_search": {"vector_store_ids": [vector_store.id]}}, )
question = """ What is the name of the location? """
print(f"Preparing thread") thread = client.beta.threads.create() print(f"Preparing question") results = client.beta.threads.messages.create( thread_id = thread.id, role = "user", content = question ) print(f"Running for answer") run = client.beta.threads.runs.create ( thread_id = thread.id, assistant_id = assistant.id ) while run.status not in ["completed", "failed"]: run = client.beta.threads.runs.retrieve ( thread_id = thread.id, run_id = run.id ) if run.status == "completed": results = client.beta.threads.messages.list( thread_id=thread.id )
# resultAnswer = results.data[0].content[0].text.value fn = os.path.join(path, "result.txt") with open(fn, "w", encoding="utf-8", errors="ignore") as f: lines = f.writelines(str(results)) [/code] У меня есть несколько API-ключей openai, и для одного из них он отлично работает с таким результатом: [code]SyncCursorPage[Message](data=[Message(id='msg_Z6iImlhDNFDmXoCszSl8hOrp', assistant_id='asst_eYsWBFev7jeZZC3MRyZ9PuJK', attachments=[], completed_at=None, content=[TextContentBlock(text=Text(annotations=[FileCitationAnnotation (end_index=117, file_citation=FileCitation(file_id='file-v3Y3HH9Kd0L2doxuoRVNU6kL'), start_index=99, text='【4:0†workText.txt】', type='file_citation')], value='The name of the location is "Benediktinerabtei Gerleve" which is located in Billerbeck, Deutschland【4:0†workText.txt】.'), type='text')], created_at=1729687317, incomplete_at=None, incomplete_details=None, metadata={}, object='thread.message', role='assistant', run_id='run_6KbPCSO8VqIP0bbqFjuSp4fV', status=None, thread_id='thread_aaRH59cvaPGh5L0J8WIviBBU'), Message(id='msg_GPAug3kAr7GSRSEuIPRUmYvc', assistant_id=None, ttachments=[], completed_at=None, content=[TextContentBlock(text=Text(annotations=[], value='\n\nWhat is the name of the location?\n\n'), type='text')], created_at=1729687313, incomplete_at=None, incomplete_details=None, metadata={}, object='thread.message', role='user', run_id=None, status=None, thread_id='thread_aaRH59cvaPGh5L0J8WIviBBU')], object='list', first_id='msg_Z6iImlhDNFDmXoCszSl8hOrp', last_id='msg_GPAug3kAr7GSRSEuIPRUmYvc', has_more=False) [/code] Но с другим API-ключом, похоже, это не работает - данные не выводятся - [code]Message(id='msg_NCxFnnQPXL0gKhsxE2hJhYWh', assistant_id=None, attachments=[], completed_at=None, content=[TextContentBlock(text=Text(annotations=[], value='\nWhat is the name of the location?\n'), type='text')], created_at=1729696968, incomplete_at=None, incomplete_details=None, metadata={}, object='thread.message', role='user', run_id=None, status=None, thread_id='thread_puBTFtaoMvauMBO2D6Wc2ylr') [/code] Почему с одним ключом API работает, а с другим нет...?