Inference Logoinference.sh

Data Processing

Process and analyze data with AI.


Text Summarization

Condense long documents:

python
1from inferencesh import inference2 3client = inference(api_key="inf_your_key")4 5result = client.run({6    "app": "infsh/summarize",7    "input": {8        "text": long_document,9        "max_length": 20010    }11})12 13print(result["output"]["summary"])

Document Analysis

Extract information from documents:

python
1result = client.run({2    "app": "infsh/document-qa",3    "input": {4        "document": "/path/to/contract.pdf",5        "questions": [6            "What is the contract duration?",7            "What are the payment terms?",8            "Who are the parties involved?"9        ]10    }11})12 13for answer in result["output"]["answers"]:14    print(f"Q: {answer['question']}")15    print(f"A: {answer['answer']}\n")

Sentiment Analysis

Analyze text sentiment:

python
1result = client.run({2    "app": "infsh/sentiment",3    "input": {4        "texts": [5            "This product is amazing!",6            "Terrible customer service.",7            "It's okay, nothing special."8        ]9    }10})11 12for item in result["output"]["results"]:13    print(f"{item['text'][:30]}... → {item['sentiment']} ({item['score']:.2f})")

Output:

code
1This product is amazing!...  positive (0.95)2Terrible customer service....  negative (0.89)3It's okay, nothing special....  neutral (0.67)

Batch Processing

Process many items efficiently:

python
1texts = [...]  # Your data2 3# Run in batches4batch_size = 105results = []6 7for i in range(0, len(texts), batch_size):8    batch = texts[i:i + batch_size]9    10    result = client.run({11        "app": "infsh/summarize",12        "input": {"texts": batch}13    })14    15    results.extend(result["output"]["summaries"])

With Agent

Create a data analysis agent:

code
1You: Analyze this CSV file and tell me the key insights2 3Agent: I'll analyze your data.4       [Loading CSV...]5       [Running analysis...]6       7       Key insights from your sales data:8       9        Overview:10       - Total records: 15,43211       - Date range: Jan 2023 - Dec 202412       - Total revenue: $2.4M13       14        Trends:15       - Q4 shows 23% higher sales than Q116       - Product A is top performer (34% of revenue)17       - Customer retention rate: 67%18       19        Anomalies:20       - March 2024 shows unusual spike (investigate)21       - Category C declining (-15% YoY)22       23       Would you like me to create visualizations?

Common Data Apps

AppUse Case
summarizeCondense long text
sentimentAnalyze tone/sentiment
document-qaQ&A over documents
extractExtract structured data
translateLanguage translation
classifyCategorize text

Tips

For large datasets:

  • Use batch processing
  • Consider streaming for real-time results
  • Run on private workers for data privacy

For accuracy:

  • Clean your data first
  • Be specific in prompts
  • Validate results on a sample

Next

Multi-Agent System

we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.