I’m developing a project to analyze multiple interview transcripts using Large Language Models (LLMs), specifically Claude 3.5 via the Claude API. While I’ve successfully analyzed individual interviews, I’m facing challenges in optimizing the process and maintaining context across multiple interviews, particularly given the stateless nature of the API. Here are my main questions:
-
Is it possible to use a single prompt for analysis while dynamically changing only the interview content, without losing information from previous analyses, considering the stateless API design?
-
How can I implement a two-step analysis using a stateless LLM API:
a) Conduct a general analysis across all interviews to identify shared themes.
b) Compare each individual interview to these main themes. -
If there are API usage limitations, how can I estimate the required resources (tokens/costs) for this type of multi-step analysis?
Current Implementation:
I’m using Claude 3.5 via the Claude API in a Jupyter Notebook. Here’s a simplified version of my current approach:
def analyze_interviews(interviews_dict: Dict[int, str]) -> Dict[int, Any]:
results = {}
for interview_id, interview_text in interviews_dict.items():
prompt = f"""
[Analysis instructions here]
{interview_text}
"""
content = api_call(prompt)
results[interview_id] = content
return results
analysis_results = analyze_interviews(dict_interviews)
for interview_id, analysis in analysis_results.items():
print(f"Analysis of Interview {interview_id}:")
print(analysis)
print("n" + "="*50 + "n")
Thanks !